summaryrefslogtreecommitdiffstats
path: root/libs/hwui/LayerRenderer.cpp
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2013-07-22 13:57:50 -0700
committerRomain Guy <romainguy@google.com>2013-07-22 14:37:21 -0700
commit448455fe783b0a711340322dca272b8cc0ebe473 (patch)
treee67a3894b8d1fc2cdfd08e7f45ff54c37070d279 /libs/hwui/LayerRenderer.cpp
parente4d4e20e8f84d53b4b7198300baaf3e21ff9be58 (diff)
downloadframeworks_base-448455fe783b0a711340322dca272b8cc0ebe473.zip
frameworks_base-448455fe783b0a711340322dca272b8cc0ebe473.tar.gz
frameworks_base-448455fe783b0a711340322dca272b8cc0ebe473.tar.bz2
Use global indices array to draw layers
An array of indices local to a layer would only be necessary if we changed the way we resolve T-junctions. Since we only ever draw quads, let's just use the indices we use everywhere else. This change also uses the global indices array to render list of colored rectangles to save on the number of vertices generated CPU-side. Change-Id: Ia6d1970b0e9247805af5a114ca2a84b5d0b7c282
Diffstat (limited to 'libs/hwui/LayerRenderer.cpp')
-rw-r--r--libs/hwui/LayerRenderer.cpp21
1 files changed, 0 insertions, 21 deletions
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp
index cfb1e97..f8076cc 100644
--- a/libs/hwui/LayerRenderer.cpp
+++ b/libs/hwui/LayerRenderer.cpp
@@ -130,10 +130,7 @@ void LayerRenderer::generateMesh() {
if (mLayer->region.isRect() || mLayer->region.isEmpty()) {
if (mLayer->mesh) {
delete[] mLayer->mesh;
- delete[] mLayer->meshIndices;
-
mLayer->mesh = NULL;
- mLayer->meshIndices = NULL;
mLayer->meshElementCount = 0;
}
@@ -154,17 +151,11 @@ void LayerRenderer::generateMesh() {
if (mLayer->mesh && mLayer->meshElementCount < elementCount) {
delete[] mLayer->mesh;
- delete[] mLayer->meshIndices;
-
mLayer->mesh = NULL;
- mLayer->meshIndices = NULL;
}
- bool rebuildIndices = false;
if (!mLayer->mesh) {
mLayer->mesh = new TextureVertex[count * 4];
- mLayer->meshIndices = new uint16_t[elementCount];
- rebuildIndices = true;
}
mLayer->meshElementCount = elementCount;
@@ -173,7 +164,6 @@ void LayerRenderer::generateMesh() {
const float height = mLayer->layer.getHeight();
TextureVertex* mesh = mLayer->mesh;
- uint16_t* indices = mLayer->meshIndices;
for (size_t i = 0; i < count; i++) {
const android::Rect* r = &rects[i];
@@ -187,17 +177,6 @@ void LayerRenderer::generateMesh() {
TextureVertex::set(mesh++, r->right, r->top, u2, v1);
TextureVertex::set(mesh++, r->left, r->bottom, u1, v2);
TextureVertex::set(mesh++, r->right, r->bottom, u2, v2);
-
- 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
- }
}
}