From 524b2c17d0d22ff63c7b34abccf1682c08c9b7a0 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 17 May 2018 17:45:53 +0000 Subject: Annotate CFX_ImageTransformer with LIKELY(). Doing this in the inner loops gets us another small performance improvement. Change-Id: I61fdf4bf8363a66123b3be3bc7ca9b5370f451fc Reviewed-on: https://pdfium-review.googlesource.com/32710 Reviewed-by: Henrique Nakashima Commit-Queue: Lei Zhang --- core/fxge/dib/cfx_imagetransformer.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp index 5067de4710..68867b5560 100644 --- a/core/fxge/dib/cfx_imagetransformer.cpp +++ b/core/fxge/dib/cfx_imagetransformer.cpp @@ -12,6 +12,7 @@ #include "core/fxge/dib/cfx_imagestretcher.h" #include "core/fxge/fx_dib.h" +#include "third_party/base/compiler_specific.h" #include "third_party/base/numerics/safe_conversions.h" #include "third_party/base/ptr_util.h" @@ -488,7 +489,7 @@ void CFX_ImageTransformer::DoBilinearLoop( d.src_row_l = 0; matrix_fix.Transform(col, row, &d.src_col_l, &d.src_row_l, &d.res_x, &d.res_y); - if (InStretchBounds(d.src_col_l, d.src_row_l)) { + if (LIKELY(InStretchBounds(d.src_col_l, d.src_row_l))) { AdjustCoords(&d.src_col_l, &d.src_row_l); d.src_col_r = d.src_col_l + 1; d.src_row_r = d.src_row_l + 1; @@ -517,7 +518,7 @@ void CFX_ImageTransformer::DoBicubicLoop( d.src_row_l = 0; matrix_fix.Transform(col, row, &d.src_col_l, &d.src_row_l, &d.res_x, &d.res_y); - if (InStretchBounds(d.src_col_l, d.src_row_l)) { + if (LIKELY(InStretchBounds(d.src_col_l, d.src_row_l))) { AdjustCoords(&d.src_col_l, &d.src_row_l); bicubic_get_pos_weight(d.pos_pixel, d.u_w, d.v_w, d.src_col_l, d.src_row_l, d.res_x, d.res_y, stretch_width(), @@ -541,7 +542,7 @@ void CFX_ImageTransformer::DoDownSampleLoop( d.src_col = 0; d.src_row = 0; matrix_fix.Transform(col, row, &d.src_col, &d.src_row); - if (InStretchBounds(d.src_col, d.src_row)) { + if (LIKELY(InStretchBounds(d.src_col, d.src_row))) { AdjustCoords(&d.src_col, &d.src_row); func(d, dest); } -- cgit v1.2.3