Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Side by Side Diff: src/core/SkBitmapProcState_utils.h

Issue 21931002: ARM Skia NEON patches - 18 - Preparation work for BitmapProcState (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #ifndef SkBitmapProcState_utils_DEFINED
2 #define SkBitmapProcState_utils_DEFINED
3
4 // Helper to ensure that when we shift down, we do it w/o sign-extension
5 // so the caller doesn't have to manually mask off the top 16 bits
6 //
7 static unsigned SK_USHIFT16(unsigned x) {
8 return x >> 16;
9 }
10
11 /*
12 * The decal_ functions require that
13 * 1. dx > 0
14 * 2. [fx, fx+dx, fx+2dx, fx+3dx, ... fx+(count-1)dx] are all <= maxX
15 *
16 * In addition, we use SkFractionalInt to keep more fractional precision than
17 * just SkFixed, so we will abort the decal_ call if dx is very small, since
18 * the decal_ function just operates on SkFixed. If that were changed, we could
19 * skip the very_small test here.
20 */
21 static inline bool can_truncate_to_fixed_for_decal(SkFractionalInt frX,
22 SkFractionalInt frDx,
23 int count, unsigned max) {
24 SkFixed dx = SkFractionalIntToFixed(frDx);
25
26 // if decal_ kept SkFractionalInt precision, this would just be dx <= 0
27 // I just made up the 1/256. Just don't want to perceive accumulated error
28 // if we truncate frDx and lose its low bits.
29 if (dx <= SK_Fixed1 / 256) {
30 return false;
31 }
32
33 // We cast to unsigned so we don't have to check for negative values, which
34 // will now appear as very large positive values, and thus fail our test!
35 SkFixed fx = SkFractionalIntToFixed(frX);
36 return (unsigned)SkFixedFloorToInt(fx) <= max &&
37 (unsigned)SkFixedFloorToInt(fx + dx * (count - 1)) < max;
38 }
39
40 #endif /* #ifndef SkBitmapProcState_utils_DEFINED */
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState_matrixProcs.cpp ('k') | src/opts/SkBitmapProcState_matrixProcs_neon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698