summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-01-26 22:47:01 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-01-26 22:47:01 -0800
commit38f34ed20a52d027cbf1b72fe22c6d616810613b (patch)
tree173b771b222048deea4b55a29fe2d20c91cdb0dc
parenta05a3e3ad7fbb27d1629836141e9d52937299bda (diff)
parent7c53a0d6078620df3abc4997acfe267ef903f5c6 (diff)
downloadframeworks_base-38f34ed20a52d027cbf1b72fe22c6d616810613b.zip
frameworks_base-38f34ed20a52d027cbf1b72fe22c6d616810613b.tar.gz
frameworks_base-38f34ed20a52d027cbf1b72fe22c6d616810613b.tar.bz2
am 7c53a0d6: Merge "Don\'t draw the same triangles several times. Bug #3388197" into honeycomb
* commit '7c53a0d6078620df3abc4997acfe267ef903f5c6': Don't draw the same triangles several times. Bug #3388197
-rw-r--r--core/java/android/view/View.java4
-rw-r--r--libs/hwui/LayerRenderer.cpp22
-rw-r--r--libs/hwui/OpenGLRenderer.cpp4
3 files changed, 18 insertions, 12 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 2e6664b..0898045 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -8125,11 +8125,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
// TODO: We should pass the dirty rect
canvas.onPreDraw(null);
+ final int restoreCount = canvas.save();
+
computeScroll();
canvas.translate(-mScrollX, -mScrollY);
- final int restoreCount = canvas.save();
-
mPrivateFlags |= DRAWN | DRAWING_CACHE_VALID;
// Fast path for layouts with no backgrounds
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp
index 36709dc..2dd4dca 100644
--- a/libs/hwui/LayerRenderer.cpp
+++ b/libs/hwui/LayerRenderer.cpp
@@ -99,11 +99,13 @@ void LayerRenderer::generateMesh() {
mLayer->meshIndices = NULL;
}
+ bool rebuildIndices = false;
if (!mLayer->mesh) {
mLayer->mesh = new TextureVertex[count * 4];
mLayer->meshIndices = new uint16_t[elementCount];
- mLayer->meshElementCount = elementCount;
+ rebuildIndices = true;
}
+ mLayer->meshElementCount = elementCount;
const float texX = 1.0f / float(mLayer->width);
const float texY = 1.0f / float(mLayer->height);
@@ -125,14 +127,16 @@ void LayerRenderer::generateMesh() {
TextureVertex::set(mesh++, r->left, r->bottom, u1, v2);
TextureVertex::set(mesh++, r->right, r->bottom, u2, v2);
- uint16_t quad = i * 4;
- int index = i * 6;
- indices[index ] = quad; // top-left
- indices[index + 1] = quad + 1; // top-right
- indices[index + 2] = quad + 2; // bottom-left
- indices[index + 3] = quad + 2; // bottom-left
- indices[index + 4] = quad + 1; // top-right
- indices[index + 5] = quad + 3; // bottom-right
+ if (rebuildIndices) {
+ uint16_t quad = i * 4;
+ int index = i * 6;
+ indices[index ] = quad; // top-left
+ indices[index + 1] = quad + 1; // top-right
+ indices[index + 2] = quad + 2; // bottom-left
+ indices[index + 3] = quad + 2; // bottom-left
+ indices[index + 4] = quad + 1; // top-right
+ indices[index + 5] = quad + 3; // bottom-right
+ }
}
#endif
}
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 81c3407..2960395 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1613,10 +1613,12 @@ void OpenGLRenderer::drawLayer(Layer* layer, float x, float y, SkPaint* paint) {
setupDrawColorFilter();
setupDrawBlending(layer->blend || layer->alpha < 255, layer->mode, false);
setupDrawProgram();
- setupDrawDirtyRegionsDisabled();
setupDrawPureColorUniforms();
setupDrawColorFilterUniforms();
setupDrawTexture(layer->texture);
+ // TODO: The current layer, if any, will be dirtied with the bounding box
+ // of the layer we are drawing. Since the layer we are drawing has
+ // a mesh, we know the dirty region, we should use it instead
setupDrawModelViewTranslate(rect.left, rect.top, rect.right, rect.bottom);
setupDrawMesh(&layer->mesh[0].position[0], &layer->mesh[0].texture[0]);