diff options
author | Romain Guy <romainguy@google.com> | 2012-03-26 16:45:05 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2012-03-26 16:45:05 -0700 |
commit | 6554943a1dd6854c0f4976900956e556767b49e1 (patch) | |
tree | 82d43bbb28af4feeb6c358077ac1083ca3598e7b /libs/hwui | |
parent | a9dd820184ee4d083bd9b2af735dcf50b78fc6cd (diff) | |
download | frameworks_base-6554943a1dd6854c0f4976900956e556767b49e1.zip frameworks_base-6554943a1dd6854c0f4976900956e556767b49e1.tar.gz frameworks_base-6554943a1dd6854c0f4976900956e556767b49e1.tar.bz2 |
Use a status_t return type for GL functors
WebView needs more fine-grained control over the behavior of the
framework upon execution of the display lists. The new status_t
allows WebView to requests its functor to be re-executed directly
without causing a redraw of the entire hierarchy.
Change-Id: I97a8141dc5c6eeb6805b6024cc1e76fce07d24cc
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/DisplayListRenderer.cpp | 22 | ||||
-rw-r--r-- | libs/hwui/DisplayListRenderer.h | 6 | ||||
-rw-r--r-- | libs/hwui/FontRenderer.cpp | 2 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 8 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.h | 4 |
5 files changed, 22 insertions, 20 deletions
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index 118608d..93acafc 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -18,6 +18,8 @@ #include <SkCamera.h> +#include <private/hwui/DrawGlInfo.h> + #include "DisplayListLogBuffer.h" #include "DisplayListRenderer.h" #include "Caches.h" @@ -796,9 +798,9 @@ void DisplayList::transformRect(float left, float top, float right, float bottom * in the output() function, since that function processes the same list of opcodes for the * purposes of logging display list info for a given view. */ -bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t width, +status_t DisplayList::replay(OpenGLRenderer& renderer, uint32_t width, uint32_t height, Rect& dirty, int32_t flags, uint32_t level) { - bool needsInvalidate = false; + status_t drawGlStatus = 0; TextContainer text; mReader.rewind(); @@ -843,7 +845,7 @@ bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t width, Functor *functor = (Functor *) getInt(); DISPLAY_LIST_LOGD("%s%s %p", (char*) indent, OP_NAMES[op], functor); renderer.startMark("GL functor"); - needsInvalidate |= renderer.callDrawGLFunction(functor, dirty); + drawGlStatus |= renderer.callDrawGLFunction(functor, dirty); renderer.endMark(); } break; @@ -950,7 +952,7 @@ bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t width, int32_t flags = getInt(); DISPLAY_LIST_LOGD("%s%s %p, %dx%d, 0x%x %d", (char*) indent, OP_NAMES[op], displayList, width, height, flags, level + 1); - needsInvalidate |= renderer.drawDisplayList(displayList, width, + drawGlStatus |= renderer.drawDisplayList(displayList, width, height, dirty, flags, level + 1); } break; @@ -1233,8 +1235,8 @@ bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t width, renderer.endMark(); DISPLAY_LIST_LOGD("%sDone (%p, %s), returning %d", (char*) indent + 2, this, mName.string(), - needsInvalidate); - return needsInvalidate; + drawGlStatus); + return drawGlStatus; } /////////////////////////////////////////////////////////////////////////////// @@ -1321,11 +1323,11 @@ void DisplayListRenderer::interrupt() { void DisplayListRenderer::resume() { } -bool DisplayListRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) { +status_t 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 + return DrawGlInfo::kStatusDone; // No invalidate needed at record-time } int DisplayListRenderer::save(int flags) { @@ -1415,7 +1417,7 @@ bool DisplayListRenderer::clipRect(float left, float top, float right, float bot return OpenGLRenderer::clipRect(left, top, right, bottom, op); } -bool DisplayListRenderer::drawDisplayList(DisplayList* displayList, +status_t DisplayListRenderer::drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height, Rect& dirty, int32_t flags, uint32_t level) { // dirty is an out parameter and should not be recorded, // it matters only when replaying the display list @@ -1437,7 +1439,7 @@ bool DisplayListRenderer::drawDisplayList(DisplayList* displayList, addSize(width, height); addInt(flags); addSkip(location); - return false; + return DrawGlInfo::kStatusDone; } void DisplayListRenderer::drawLayer(Layer* layer, float x, float y, SkPaint* paint) { diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h index 4bbb04f..2b32073 100644 --- a/libs/hwui/DisplayListRenderer.h +++ b/libs/hwui/DisplayListRenderer.h @@ -137,7 +137,7 @@ public: void initFromDisplayListRenderer(const DisplayListRenderer& recorder, bool reusing = false); - bool replay(OpenGLRenderer& renderer, uint32_t width, uint32_t height, + status_t replay(OpenGLRenderer& renderer, uint32_t width, uint32_t height, Rect& dirty, int32_t flags, uint32_t level = 0); void output(OpenGLRenderer& renderer, uint32_t level = 0); @@ -525,7 +525,7 @@ public: virtual void prepareDirty(float left, float top, float right, float bottom, bool opaque); virtual void finish(); - virtual bool callDrawGLFunction(Functor *functor, Rect& dirty); + virtual status_t callDrawGLFunction(Functor *functor, Rect& dirty); virtual void interrupt(); virtual void resume(); @@ -549,7 +549,7 @@ public: virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op); - virtual bool drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height, + virtual status_t drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height, Rect& dirty, int32_t flags, uint32_t level = 0); virtual void drawLayer(Layer* layer, float x, float y, SkPaint* paint); virtual void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint); diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp index 493dc1b..9e7fbb5 100644 --- a/libs/hwui/FontRenderer.cpp +++ b/libs/hwui/FontRenderer.cpp @@ -779,7 +779,7 @@ void FontRenderer::checkInit() { // We store a string with letters in a rough frequency of occurrence mLatinPrecache = String16("eisarntolcdugpmhbyfvkwzxjq "); mLatinPrecache += String16("EISARNTOLCDUGPMHBYFVKWZXJQ"); - mLatinPrecache += String16(",.?!()-+@;:`'"); + mLatinPrecache += String16(",.?!()-+@;:'"); mLatinPrecache += String16("0123456789"); mInitialized = true; diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 685fddc..a7c53ca 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -236,7 +236,7 @@ void OpenGLRenderer::resume() { glBlendEquation(GL_FUNC_ADD); } -bool OpenGLRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) { +status_t OpenGLRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) { interrupt(); if (mDirtyClip) { setScissorFromClip(); @@ -269,7 +269,7 @@ bool OpenGLRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) { } resume(); - return result != 0; + return result; } /////////////////////////////////////////////////////////////////////////////// @@ -1321,7 +1321,7 @@ void OpenGLRenderer::finishDrawTexture() { // Drawing /////////////////////////////////////////////////////////////////////////////// -bool OpenGLRenderer::drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height, +status_t OpenGLRenderer::drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height, Rect& dirty, int32_t flags, uint32_t level) { float top = 0; float left = 0; @@ -1345,7 +1345,7 @@ bool OpenGLRenderer::drawDisplayList(DisplayList* displayList, uint32_t width, u return displayList->replay(*this, width, height, dirty, flags, level); } - return false; + return DrawGlInfo::kStatusDone; } void OpenGLRenderer::outputDisplayList(DisplayList* displayList, uint32_t level) { diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index 4d7a491..3ba6202 100644 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -72,7 +72,7 @@ public: virtual void interrupt(); virtual void resume(); - virtual bool callDrawGLFunction(Functor *functor, Rect& dirty); + virtual status_t callDrawGLFunction(Functor *functor, Rect& dirty); ANDROID_API int getSaveCount() const; virtual int save(int flags); @@ -97,7 +97,7 @@ public: ANDROID_API bool quickReject(float left, float top, float right, float bottom); virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op); - virtual bool drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height, + virtual status_t drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height, Rect& dirty, int32_t flags, uint32_t level = 0); virtual void outputDisplayList(DisplayList* displayList, uint32_t level = 0); virtual void drawLayer(Layer* layer, float x, float y, SkPaint* paint); |