diff options
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/DisplayListRenderer.cpp | 26 | ||||
-rw-r--r-- | libs/hwui/DisplayListRenderer.h | 6 | ||||
-rw-r--r-- | libs/hwui/LayerRenderer.cpp | 22 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 12 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.h | 2 |
5 files changed, 18 insertions, 50 deletions
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index c2106d4..cfc853c 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -82,8 +82,6 @@ void PathHeap::flatten(SkFlattenableWriteBuffer& buffer) const { /////////////////////////////////////////////////////////////////////////////// const char* DisplayList::OP_NAMES[] = { - "AcquireContext", - "ReleaseContext", "Save", "Restore", "RestoreToCount", @@ -239,16 +237,6 @@ bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t level) { needsInvalidate |= renderer.callDrawGLFunction(functor); } break; - case AcquireContext: { - DISPLAY_LIST_LOGD("%s%s", (char*) indent, OP_NAMES[op]); - renderer.acquireContext(); - } - break; - case ReleaseContext: { - DISPLAY_LIST_LOGD("%s%s", (char*) indent, OP_NAMES[op]); - renderer.releaseContext(); - } - break; case Save: { int rendererNum = getInt(); DISPLAY_LIST_LOGD("%s%s %d", (char*) indent, OP_NAMES[op], rendererNum); @@ -644,15 +632,9 @@ void DisplayListRenderer::finish() { } void DisplayListRenderer::interrupt() { - } -void DisplayListRenderer::resume() { -} -void DisplayListRenderer::acquireContext() { - // TODO: probably noop instead of calling super - addOp(DisplayList::AcquireContext); - OpenGLRenderer::acquireContext(); +void DisplayListRenderer::resume() { } bool DisplayListRenderer::callDrawGLFunction(Functor *functor) { @@ -661,12 +643,6 @@ bool DisplayListRenderer::callDrawGLFunction(Functor *functor) { return false; // No invalidate needed at record-time } -void DisplayListRenderer::releaseContext() { - // TODO: probably noop instead of calling super - addOp(DisplayList::ReleaseContext); - OpenGLRenderer::releaseContext(); -} - int DisplayListRenderer::save(int flags) { addOp(DisplayList::Save); addInt(flags); diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h index bab5149..a6d2bfe 100644 --- a/libs/hwui/DisplayListRenderer.h +++ b/libs/hwui/DisplayListRenderer.h @@ -89,9 +89,7 @@ public: // IMPORTANT: Update the intialization of OP_NAMES in the .cpp file // when modifying this file enum Op { - AcquireContext = 0, - ReleaseContext, - Save, + Save = 0, Restore, RestoreToCount, SaveLayer, @@ -245,8 +243,6 @@ public: void finish(); bool callDrawGLFunction(Functor *functor); - void acquireContext(); - void releaseContext(); void interrupt(); void resume(); 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 c378f46..2960395 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -191,10 +191,6 @@ void OpenGLRenderer::interrupt() { mCaches.unbindMeshBuffer(); } -void OpenGLRenderer::acquireContext() { - interrupt(); -} - void OpenGLRenderer::resume() { glViewport(0, 0, mSnapshot->viewport.getWidth(), mSnapshot->viewport.getHeight()); @@ -212,10 +208,6 @@ void OpenGLRenderer::resume() { glBlendEquation(GL_FUNC_ADD); } -void OpenGLRenderer::releaseContext() { - resume(); -} - bool OpenGLRenderer::callDrawGLFunction(Functor *functor) { interrupt(); if (mDirtyClip) { @@ -1621,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]); diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index 77de1d2..64def03 100644 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -71,8 +71,6 @@ public: virtual void resume(); virtual bool callDrawGLFunction(Functor *functor); - virtual void acquireContext(); - virtual void releaseContext(); int getSaveCount() const; virtual int save(int flags); |