summaryrefslogtreecommitdiffstats
path: root/libs/hwui
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-05-27 11:43:46 -0700
committerRomain Guy <romainguy@google.com>2011-05-27 11:43:46 -0700
commitf09ef51889f75289b041f9e9f949b7b82ed5b686 (patch)
treeabb6fa101bbf18deec6edbd1d799cf7eb31a2b41 /libs/hwui
parenta4fa2cd1c007c2bd0f330f6a3ffde2949d9574c5 (diff)
downloadframeworks_base-f09ef51889f75289b041f9e9f949b7b82ed5b686.zip
frameworks_base-f09ef51889f75289b041f9e9f949b7b82ed5b686.tar.gz
frameworks_base-f09ef51889f75289b041f9e9f949b7b82ed5b686.tar.bz2
Fix issue with drawColor(color, Mode.Clear)
Change-Id: I486b24a5b609c6f8adb0276037ddb24af2b888b2
Diffstat (limited to 'libs/hwui')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp14
-rw-r--r--libs/hwui/OpenGLRenderer.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 8e9e8be..6243b01 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -990,12 +990,26 @@ void OpenGLRenderer::setupDrawColorFilter() {
}
}
+void OpenGLRenderer::accountForClear(SkXfermode::Mode mode) {
+ if (mColorSet && mode == SkXfermode::kClear_Mode) {
+ mColorA = 1.0f;
+ mColorR = mColorG = mColorB = 0.0f;
+ mSetShaderColor = mDescription.setAlpha8Color(mColorR, mColorG, mColorB, mColorA);
+ }
+}
+
void OpenGLRenderer::setupDrawBlending(SkXfermode::Mode mode, bool swapSrcDst) {
+ // When the blending mode is kClear_Mode, we need to use a modulate color
+ // argb=1,0,0,0
+ accountForClear(mode);
chooseBlending((mColorSet && mColorA < 1.0f) || (mShader && mShader->blend()), mode,
mDescription, swapSrcDst);
}
void OpenGLRenderer::setupDrawBlending(bool blend, SkXfermode::Mode mode, bool swapSrcDst) {
+ // When the blending mode is kClear_Mode, we need to use a modulate color
+ // argb=1,0,0,0
+ accountForClear(mode);
chooseBlending(blend || (mColorSet && mColorA < 1.0f) || (mShader && mShader->blend()), mode,
mDescription, swapSrcDst);
}
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index 70abe88..e2dbba0 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -478,6 +478,7 @@ private:
void setupDrawAALine(GLvoid* vertices, GLvoid* distanceCoords, GLvoid* lengthCoords,
float strokeWidth);
void finishDrawTexture();
+ void accountForClear(SkXfermode::Mode mode);
void drawRegionRects(const Region& region);