From 205d46067ace24bd4b111cf44efc96caff6c4d30 Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Mon, 25 Apr 2011 12:43:45 +0000 Subject: 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 --- gpu/include/GrScalar.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'gpu/include/GrScalar.h') 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) -- cgit v1.2.3