From 70ca14e08ae197547ac412e8a1210e1ebdfb2eb1 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 13 Dec 2010 18:24:33 -0800 Subject: Refactor OpenGLRenderer to simplify OpenGL drawing code. This is the first step of the refactoring: - drawColorRect - drawTextureMesh Remaining methods to refactor: - setupTextureAlpha8 - drawPath - setupShadow - drawText - drawLines - composeLayerRegion Change-Id: I0fced6a05b6b6eee10ee7cef0c3fbdaa6cefab20 --- libs/hwui/ProgramCache.h | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'libs/hwui/ProgramCache.h') diff --git a/libs/hwui/ProgramCache.h b/libs/hwui/ProgramCache.h index fc3e248713f3..3acd18a9e097 100644 --- a/libs/hwui/ProgramCache.h +++ b/libs/hwui/ProgramCache.h @@ -102,14 +102,8 @@ struct ProgramDescription { kGradientSweep }; - ProgramDescription(): - hasTexture(false), hasAlpha8Texture(false), modulate(false), - hasBitmap(false), isBitmapNpot(false), hasGradient(false), - gradientType(kGradientLinear), - shadersMode(SkXfermode::kClear_Mode), isBitmapFirst(false), - bitmapWrapS(GL_CLAMP_TO_EDGE), bitmapWrapT(GL_CLAMP_TO_EDGE), - colorOp(kColorNone), colorMode(SkXfermode::kClear_Mode), - framebufferMode(SkXfermode::kClear_Mode), swapSrcDst(false) { + ProgramDescription() { + reset(); } // Texturing @@ -141,6 +135,35 @@ struct ProgramDescription { SkXfermode::Mode framebufferMode; bool swapSrcDst; + /** + * Resets this description. All fields are reset back to the default + * values they hold after building a new instance. + */ + void reset() { + hasTexture = false; + hasAlpha8Texture = false; + + modulate = false; + + hasBitmap = false; + isBitmapNpot = false; + + hasGradient = false; + gradientType = kGradientLinear; + + shadersMode = SkXfermode::kClear_Mode; + + isBitmapFirst = false; + bitmapWrapS = GL_CLAMP_TO_EDGE; + bitmapWrapT = GL_CLAMP_TO_EDGE; + + colorOp = kColorNone; + colorMode = SkXfermode::kClear_Mode; + + framebufferMode = SkXfermode::kClear_Mode; + swapSrcDst = false; + } + /** * Indicates, for a given color, whether color modulation is required in * the fragment shader. When this method returns true, the program should -- cgit v1.2.3-59-g8ed1b