aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBitmapProcState_matrix.h
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2017-01-04 13:01:55 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-06 18:41:34 +0000
commit9953737bcf885a52c08ade6c503f2202e4dd9aa5 (patch)
treed53ac822a3eec694d78b6a3c36daa99a4f1e7021 /src/core/SkBitmapProcState_matrix.h
parent1c4717b54b21bc6c640864caf600ef16496803ec (diff)
Avoid SkFixed overflow in decal bitmap procs
The check for decal mode can overflow in SkFixed. Promote to 64bit (48.16) instead. Also update can_truncate_to_fixed_for_decal() to take SkFixed params and used it in ClampX_ClampY_filter_scale_SSE2(). BUG=chromium:675444 R=reed@google.com CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I759464cdaa5c005159e38e32167fb1937e2a1d28 Reviewed-on: https://skia-review.googlesource.com/6538 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/core/SkBitmapProcState_matrix.h')
-rw-r--r--src/core/SkBitmapProcState_matrix.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/SkBitmapProcState_matrix.h b/src/core/SkBitmapProcState_matrix.h
index e0180c6a5c..ea784c675c 100644
--- a/src/core/SkBitmapProcState_matrix.h
+++ b/src/core/SkBitmapProcState_matrix.h
@@ -70,9 +70,10 @@ void SCALE_FILTER_NAME(const SkBitmapProcState& s,
}
#ifdef CHECK_FOR_DECAL
- if (can_truncate_to_fixed_for_decal(fx, dx, count, maxX)) {
- decal_filter_scale(xy, SkFractionalIntToFixed(fx),
- SkFractionalIntToFixed(dx), count);
+ const SkFixed fixedFx = SkFractionalIntToFixed(fx);
+ const SkFixed fixedDx = SkFractionalIntToFixed(dx);
+ if (can_truncate_to_fixed_for_decal(fixedFx, fixedDx, count, maxX)) {
+ decal_filter_scale(xy, fixedFx, fixedDx, count);
} else
#endif
{