summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-11-04 14:40:26 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-11-04 14:40:26 -0700
commitb9def8e721fd646246d98a53c24a68737592f216 (patch)
treeed3e2811203059fff17ee237d1cf2394f6d0618b
parenta4f03f98f16dca51ac5630b4f41bec08a7da1091 (diff)
parent7f78b0c3ae6222b39f6240524390de9764f21764 (diff)
downloadframeworks_base-b9def8e721fd646246d98a53c24a68737592f216.zip
frameworks_base-b9def8e721fd646246d98a53c24a68737592f216.tar.gz
frameworks_base-b9def8e721fd646246d98a53c24a68737592f216.tar.bz2
Merge "Lines would not set the scissor before drawing."
-rw-r--r--libs/hwui/OpenGLRenderer.cpp31
-rw-r--r--libs/hwui/OpenGLRenderer.h3
2 files changed, 21 insertions, 13 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 09e01f6..cad991d 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -941,8 +941,11 @@ void OpenGLRenderer::drawPatch(SkBitmap* bitmap, const int32_t* xDivs, const int
}
void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) {
+ // TODO: Should do quickReject for each line
if (mSnapshot->invisible) return;
+ setupDraw();
+
int alpha;
SkXfermode::Mode mode;
getAlphaAndMode(paint, &alpha, &mode);
@@ -961,7 +964,7 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) {
mode, false, true, (GLvoid*) 0, (GLvoid*) gMeshTextureOffset,
mCaches.line.getMeshBuffer());
} else {
- setupColorRect(0.0f, 0.0f, 1.0f, 1.0f, r, g, b, a, mode, false);
+ setupColorRect(0.0f, 0.0f, 1.0f, 1.0f, r, g, b, a, mode, false, true);
}
const float strokeWidth = paint->getStrokeWidth();
@@ -1408,7 +1411,8 @@ void OpenGLRenderer::drawColorRect(float left, float top, float right, float bot
}
void OpenGLRenderer::setupColorRect(float left, float top, float right, float bottom,
- float r, float g, float b, float a, SkXfermode::Mode mode, bool ignoreTransform) {
+ float r, float g, float b, float a, SkXfermode::Mode mode,
+ bool ignoreTransform, bool ignoreMatrix) {
GLuint textureUnit = 0;
// Describe the required shaders
@@ -1433,21 +1437,24 @@ void OpenGLRenderer::setupColorRect(float left, float top, float right, float bo
glVertexAttribPointer(mCaches.currentProgram->position, 2, GL_FLOAT, GL_FALSE,
gMeshStride, 0);
- // Setup uniforms
- mModelView.loadTranslate(left, top, 0.0f);
- mModelView.scale(right - left, bottom - top, 1.0f);
- if (!ignoreTransform) {
- mCaches.currentProgram->set(mOrthoMatrix, mModelView, *mSnapshot->transform);
- dirtyLayer(left, top, right, bottom, *mSnapshot->transform);
- } else {
- mat4 identity;
- mCaches.currentProgram->set(mOrthoMatrix, mModelView, identity);
- dirtyLayer(left, top, right, bottom);
+ if (!ignoreMatrix) {
+ // Setup uniforms
+ mModelView.loadTranslate(left, top, 0.0f);
+ mModelView.scale(right - left, bottom - top, 1.0f);
+ if (!ignoreTransform) {
+ mCaches.currentProgram->set(mOrthoMatrix, mModelView, *mSnapshot->transform);
+ dirtyLayer(left, top, right, bottom, *mSnapshot->transform);
+ } else {
+ mat4 identity;
+ mCaches.currentProgram->set(mOrthoMatrix, mModelView, identity);
+ dirtyLayer(left, top, right, bottom);
+ }
}
mCaches.currentProgram->setColor(r, g, b, a);
// Setup attributes and uniforms required by the shaders
if (mShader) {
+ if (ignoreMatrix) mModelView.loadIdentity();
mShader->setupProgram(mCaches.currentProgram, mModelView, *mSnapshot, &textureUnit);
}
if (mColorFilter) {
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index 2d612d4..93c2e6c 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -233,7 +233,8 @@ private:
* Setups shaders to draw a colored rect.
*/
void setupColorRect(float left, float top, float right, float bottom,
- float r, float g, float b, float a, SkXfermode::Mode mode, bool ignoreTransform);
+ float r, float g, float b, float a, SkXfermode::Mode mode,
+ bool ignoreTransform, bool ignoreMatrix = false);
/**
* Draws a textured rectangle with the specified texture. The specified coordinates