diff options
author | 2012-10-09 19:45:59 +0000 | |
---|---|---|
committer | 2012-10-09 19:45:59 +0000 | |
commit | cc0c8e6084e140c962ae9a6885992bafea8ec048 (patch) | |
tree | 05ca2b701f62e02e3215f986ebcef5a378043aa2 /src | |
parent | bae1712d2ec48671d59d08b292f118be7edf6dd8 (diff) |
correctly handle negative values in fixed_clamp()
Review URL: https://codereview.appspot.com/6633049
git-svn-id: http://skia.googlecode.com/svn/trunk@5867 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkBitmapProcState_matrixProcs.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/SkBitmapProcState_matrixProcs.cpp b/src/core/SkBitmapProcState_matrixProcs.cpp index a0cfc33f8a..9fa3cd6d0f 100644 --- a/src/core/SkBitmapProcState_matrixProcs.cpp +++ b/src/core/SkBitmapProcState_matrixProcs.cpp @@ -113,17 +113,21 @@ extern const SkBitmapProcState::MatrixProc RepeatX_RepeatY_Procs_neon[]; static inline U16CPU fixed_clamp(SkFixed x) { #ifdef SK_CPU_HAS_CONDITIONAL_INSTR - if (x >> 16) - x = 0xFFFF; if (x < 0) x = 0; + if (x >> 16) + x = 0xFFFF; #else if (x >> 16) { +#if 0 // is this faster? + x = (~x >> 31) & 0xFFFF; +#else if (x < 0) x = 0; else x = 0xFFFF; +#endif } #endif return x; |