From cabfcc1364eb7e4de0b15b3574fba45027b45cfc Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 7 Mar 2011 18:06:46 -0800 Subject: Add support for partial invalidates in WebView Bug #3461349 This change also fixes two bugs that prevented partial invalidates from working with other views. Both bugs were in our EGL implementation: they were preventing the caller from comparing the current context/surface with another context/surface. This was causing HardwareRenderer to always redraw the entire screen. Change-Id: I33e096b304d4a0b7e6c8f92930f71d2ece9bebf5 --- libs/hwui/DisplayListRenderer.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'libs/hwui/DisplayListRenderer.cpp') diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index d5d2ba0..737fa02 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -166,7 +166,7 @@ void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorde void DisplayList::init() { } -bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t level) { +bool DisplayList::replay(OpenGLRenderer& renderer, Rect& dirty, uint32_t level) { bool needsInvalidate = false; TextContainer text; mReader.rewind(); @@ -189,7 +189,7 @@ bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t level) { case DrawGLFunction: { Functor *functor = (Functor *) getInt(); DISPLAY_LIST_LOGD("%s%s %p", (char*) indent, OP_NAMES[op], functor); - needsInvalidate |= renderer.callDrawGLFunction(functor); + needsInvalidate |= renderer.callDrawGLFunction(functor, dirty); } break; case Save: { @@ -287,7 +287,7 @@ bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t level) { DisplayList* displayList = getDisplayList(); DISPLAY_LIST_LOGD("%s%s %p, %d", (char*) indent, OP_NAMES[op], displayList, level + 1); - needsInvalidate |= renderer.drawDisplayList(displayList, level + 1); + needsInvalidate |= renderer.drawDisplayList(displayList, dirty, level + 1); } break; case DrawLayer: { @@ -589,7 +589,8 @@ void DisplayListRenderer::interrupt() { void DisplayListRenderer::resume() { } -bool DisplayListRenderer::callDrawGLFunction(Functor *functor) { +bool DisplayListRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) { + // Ignore dirty during recording, it matters only when we replay addOp(DisplayList::DrawGLFunction); addInt((int) functor); return false; // No invalidate needed at record-time @@ -673,7 +674,9 @@ bool DisplayListRenderer::clipRect(float left, float top, float right, float bot return OpenGLRenderer::clipRect(left, top, right, bottom, op); } -bool DisplayListRenderer::drawDisplayList(DisplayList* displayList, uint32_t level) { +bool DisplayListRenderer::drawDisplayList(DisplayList* displayList, Rect& dirty, uint32_t level) { + // dirty is an out parameter and should not be recorded, + // it matters only when replaying the display list addOp(DisplayList::DrawDisplayList); addDisplayList(displayList); return false; -- cgit v1.1