diff options
author | 2011-04-25 12:43:45 +0000 | |
---|---|---|
committer | 2011-04-25 12:43:45 +0000 | |
commit | 205d46067ace24bd4b111cf44efc96caff6c4d30 (patch) | |
tree | f405973a26a367e566ecbd4c327ad929654d8e1f /gpu/include/GrScalar.h | |
parent | e624caf6c33e1379a7f6f8333a8f0ec25025420e (diff) |
Move alpha-ramp AA to GrContext, detect cases when AA is applied via other methods (smooth lines, MSAA) or rect falls on integer coords and skip the alpha ramp path. Use pre-fab index buffer for alpha-ramped fill rects and stroke rects.
Review URL: http://codereview.appspot.com/4449047/
git-svn-id: http://skia.googlecode.com/svn/trunk@1169 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gpu/include/GrScalar.h')
-rw-r--r-- | gpu/include/GrScalar.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gpu/include/GrScalar.h b/gpu/include/GrScalar.h index 1353fb2148..7aaa43d33f 100644 --- a/gpu/include/GrScalar.h +++ b/gpu/include/GrScalar.h @@ -56,11 +56,19 @@ */ #define GrFloatToFixed(x) ((GrFixed)((x) * GR_Fixed1)) -inline GrFixed GrFixedAbs(GrFixed x) { +static inline GrFixed GrFixedAbs(GrFixed x) { int32_t s = (x & 0x80000000) >> 31; return (GrFixed)(((int32_t)x ^ s) - s); } +static inline bool GrFixedIsInt(GrFixed x) { + return 0 == (x & 0xffff); +} + +static inline bool GrFloatIsInt(float x) { + return x == (float)(int)x; +} + /////////////////////////////////////////////////////////////////////////////// #if GR_SCALAR_IS_FIXED @@ -72,6 +80,7 @@ inline GrFixed GrFixedAbs(GrFixed x) { #define GrScalarHalf(x) ((x) >> 1) #define GrScalarAve(x,y) (((x)+(y)) >> 1) #define GrScalarAbs(x) GrFixedAbs(x) + #define GrScalarIsInt GrFixedIsInt #define GR_Scalar1 GR_Fixed1 #define GR_ScalarHalf GR_FixedHalf #define GR_ScalarMax GR_FixedMax @@ -85,6 +94,7 @@ inline GrFixed GrFixedAbs(GrFixed x) { #define GrScalarHalf(x) ((x) * 0.5f) #define GrScalarAbs(x) fabsf(x) #define GrScalarAve(x,y) (((x) + (y)) * 0.5f) + #define GrScalarIsInt GrFloatIsInt #define GR_Scalar1 1.f #define GR_ScalarHalf 0.5f #define GR_ScalarMax (FLT_MAX) |