diff options
| author | Romain Guy <romainguy@google.com> | 2011-01-24 16:33:45 -0800 |
|---|---|---|
| committer | Romain Guy <romainguy@google.com> | 2011-01-24 18:39:56 -0800 |
| commit | 7d7b5490a0b0763e831b31bc11f17d8159b5914a (patch) | |
| tree | 7326e41a76618cba25a9757b43db779a607b9bdf /libs/hwui | |
| parent | 3dd0908a65095cb6946001ae3039ab87a47b4f33 (diff) | |
| download | frameworks_base-7d7b5490a0b0763e831b31bc11f17d8159b5914a.zip frameworks_base-7d7b5490a0b0763e831b31bc11f17d8159b5914a.tar.gz frameworks_base-7d7b5490a0b0763e831b31bc11f17d8159b5914a.tar.bz2 | |
Enable partial invalidates when rendering with OpenGL.
Change-Id: Ie8be06c4776b815e8737753eb8003b4fd8936130
Diffstat (limited to 'libs/hwui')
| -rw-r--r-- | libs/hwui/DisplayListRenderer.cpp | 3 | ||||
| -rw-r--r-- | libs/hwui/DisplayListRenderer.h | 4 | ||||
| -rw-r--r-- | libs/hwui/LayerRenderer.cpp | 4 | ||||
| -rw-r--r-- | libs/hwui/LayerRenderer.h | 2 | ||||
| -rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 13 | ||||
| -rw-r--r-- | libs/hwui/OpenGLRenderer.h | 3 |
6 files changed, 17 insertions, 12 deletions
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index a768efe..d70fba8 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -629,7 +629,8 @@ void DisplayListRenderer::setViewport(int width, int height) { mHeight = height; } -void DisplayListRenderer::prepare(bool opaque) { +void DisplayListRenderer::prepareDirty(float left, float top, + float right, float bottom, bool opaque) { mSnapshot = new Snapshot(mFirstSnapshot, SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag); mSaveCount = 1; diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h index 6c8e8f5..bab5149 100644 --- a/libs/hwui/DisplayListRenderer.h +++ b/libs/hwui/DisplayListRenderer.h @@ -28,7 +28,7 @@ #include <SkTSearch.h> #include "OpenGLRenderer.h" -#include "Functor.h" +#include "utils/Functor.h" namespace android { namespace uirenderer { @@ -241,7 +241,7 @@ public: DisplayList* getDisplayList(); void setViewport(int width, int height); - void prepare(bool opaque); + void prepareDirty(float left, float top, float right, float bottom, bool opaque); void finish(); bool callDrawGLFunction(Functor *functor); diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp index 1c89577..36709dc 100644 --- a/libs/hwui/LayerRenderer.cpp +++ b/libs/hwui/LayerRenderer.cpp @@ -26,7 +26,7 @@ namespace uirenderer { // Rendering /////////////////////////////////////////////////////////////////////////////// -void LayerRenderer::prepare(bool opaque) { +void LayerRenderer::prepareDirty(float left, float top, float right, float bottom, bool opaque) { LAYER_RENDERER_LOGD("Rendering into layer, fbo = %d", mLayer->fbo); #if RENDER_LAYERS_AS_REGIONS @@ -35,7 +35,7 @@ void LayerRenderer::prepare(bool opaque) { glBindFramebuffer(GL_FRAMEBUFFER, mLayer->fbo); - OpenGLRenderer::prepare(opaque); + OpenGLRenderer::prepareDirty(0.0f, 0.0f, mLayer->width, mLayer->height, opaque); } void LayerRenderer::finish() { diff --git a/libs/hwui/LayerRenderer.h b/libs/hwui/LayerRenderer.h index 1e39847..d2f565e 100644 --- a/libs/hwui/LayerRenderer.h +++ b/libs/hwui/LayerRenderer.h @@ -46,7 +46,7 @@ public: ~LayerRenderer() { } - void prepare(bool opaque); + void prepareDirty(float left, float top, float right, float bottom, bool opaque); void finish(); bool hasLayer(); diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 98f8fc5..d343a6f 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -136,6 +136,10 @@ void OpenGLRenderer::setViewport(int width, int height) { } void OpenGLRenderer::prepare(bool opaque) { + prepareDirty(0.0f, 0.0f, mWidth, mHeight, opaque); +} + +void OpenGLRenderer::prepareDirty(float left, float top, float right, float bottom, bool opaque) { mCaches.clearGarbage(); mSnapshot = new Snapshot(mFirstSnapshot, @@ -146,15 +150,14 @@ void OpenGLRenderer::prepare(bool opaque) { glDisable(GL_DITHER); + glEnable(GL_SCISSOR_TEST); + glScissor(left, mSnapshot->height - bottom, right - left, bottom - top); + mSnapshot->setClip(left, top, right, bottom); + if (!opaque) { - glDisable(GL_SCISSOR_TEST); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); } - - glEnable(GL_SCISSOR_TEST); - glScissor(0, 0, mWidth, mHeight); - mSnapshot->setClip(0.0f, 0.0f, mWidth, mHeight); } void OpenGLRenderer::finish() { diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index bd29609..77de1d2 100644 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -62,7 +62,8 @@ public: virtual void setViewport(int width, int height); - virtual void prepare(bool opaque); + void prepare(bool opaque); + virtual void prepareDirty(float left, float top, float right, float bottom, bool opaque); virtual void finish(); // These two calls must not be recorded in display lists |
