From bf75945e7a1ae7c1000682716643c942c1e19ba6 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Mon, 11 Aug 2014 16:00:44 -0700 Subject: Rework shadow interpolation bug:16852257 Use pow(alpha, 1.5) to avoid harsh edges on shadow alpha ramps. Also adjusts shadow constants to compensate. Change-Id: I5869956d7d292db2a8e496bc320084b6d64c3fb7 --- libs/hwui/Program.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'libs/hwui/Program.h') diff --git a/libs/hwui/Program.h b/libs/hwui/Program.h index 3e191d0a0186..1d95c40b6233 100644 --- a/libs/hwui/Program.h +++ b/libs/hwui/Program.h @@ -72,19 +72,20 @@ namespace uirenderer { #define PROGRAM_MODULATE_SHIFT 35 #define PROGRAM_HAS_AA_SHIFT 36 +#define PROGRAM_HAS_SHADOW_AA_SHIFT 37 -#define PROGRAM_HAS_EXTERNAL_TEXTURE_SHIFT 37 -#define PROGRAM_HAS_TEXTURE_TRANSFORM_SHIFT 38 +#define PROGRAM_HAS_EXTERNAL_TEXTURE_SHIFT 38 +#define PROGRAM_HAS_TEXTURE_TRANSFORM_SHIFT 39 -#define PROGRAM_HAS_GAMMA_CORRECTION 39 +#define PROGRAM_HAS_GAMMA_CORRECTION 40 -#define PROGRAM_IS_SIMPLE_GRADIENT 40 +#define PROGRAM_IS_SIMPLE_GRADIENT 41 -#define PROGRAM_HAS_COLORS 41 +#define PROGRAM_HAS_COLORS 42 -#define PROGRAM_HAS_DEBUG_HIGHLIGHT 42 -#define PROGRAM_EMULATE_STENCIL 43 -#define PROGRAM_HAS_ROUND_RECT_CLIP 44 +#define PROGRAM_HAS_DEBUG_HIGHLIGHT 43 +#define PROGRAM_EMULATE_STENCIL 44 +#define PROGRAM_HAS_ROUND_RECT_CLIP 45 /////////////////////////////////////////////////////////////////////////////// // Types @@ -135,6 +136,7 @@ struct ProgramDescription { bool isBitmapNpot; bool isAA; // drawing with a per-vertex alpha + bool isShadowAA; // drawing per vertex alpha with shadow interpolation bool hasGradient; Gradient gradientType; @@ -175,6 +177,7 @@ struct ProgramDescription { hasColors = false; isAA = false; + isShadowAA = false; modulate = false; @@ -262,6 +265,7 @@ struct ProgramDescription { if (swapSrcDst) key |= PROGRAM_KEY_SWAP_SRC_DST; if (modulate) key |= programid(0x1) << PROGRAM_MODULATE_SHIFT; if (isAA) key |= programid(0x1) << PROGRAM_HAS_AA_SHIFT; + if (isShadowAA) key |= programid(0x1) << PROGRAM_HAS_SHADOW_AA_SHIFT; if (hasExternalTexture) key |= programid(0x1) << PROGRAM_HAS_EXTERNAL_TEXTURE_SHIFT; if (hasTextureTransform) key |= programid(0x1) << PROGRAM_HAS_TEXTURE_TRANSFORM_SHIFT; if (hasGammaCorrection) key |= programid(0x1) << PROGRAM_HAS_GAMMA_CORRECTION; -- cgit v1.2.3-59-g8ed1b