diff options
Diffstat (limited to 'libs/hwui/DisplayListRenderer.cpp')
| -rw-r--r-- | libs/hwui/DisplayListRenderer.cpp | 81 |
1 files changed, 26 insertions, 55 deletions
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index 118608d..3a3f8a5 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" @@ -104,7 +106,7 @@ DisplayList::~DisplayList() { void DisplayList::initProperties() { mLeft = 0; mTop = 0; - mTop = 0; + mRight = 0; mBottom = 0; mApplicationScale = -1; mClipChildren = true; @@ -119,6 +121,7 @@ void DisplayList::initProperties() { mScaleY = 1; mPivotX = 0; mPivotY = 0; + mCameraDistance = 0; mMatrixDirty = false; mMatrixFlags = 0; mPrevWidth = -1; @@ -684,7 +687,7 @@ void DisplayList::outputViewProperties(OpenGLRenderer& renderer, char* indent) { mTransformMatrix->get(8)); } } - if (mAlpha < 1) { + if (mAlpha < 1 && !mCaching) { // TODO: should be able to store the size of a DL at record time and not // have to pass it into this call. In fact, this information might be in the // location/size info that we store with the new native transform data. @@ -763,42 +766,14 @@ void DisplayList::setViewProperties(OpenGLRenderer& renderer, uint32_t width, ui } } -void DisplayList::transformRect(float left, float top, float right, float bottom, Rect& result) { - result.left = left + mLeft; - result.top = top + mTop; - result.right = right + mLeft; - result.bottom = bottom + mTop; - if (mMatrixFlags != 0) { - if (mMatrixFlags == TRANSLATION) { - result.left += mTranslationX; - result.top += mTranslationY; - result.right += mTranslationX; - result.bottom += mTranslationY; - } else { - updateMatrix(); - SkRect r; - r.fLeft = result.left; - r.fTop = result.top; - r.fRight = result.right; - r.fBottom = result.bottom; - mTransformMatrix->mapRect(&r); - result.left = r.fLeft; - result.top = r.fTop; - result.right = r.fRight; - result.bottom = r.fBottom; - } - } -} - - /** * Changes to replay(), specifically those involving opcode or parameter changes, should be mimicked * 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(); @@ -820,6 +795,12 @@ bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t width, restoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag); } setViewProperties(renderer, width, height, level); + if (USE_DISPLAY_LIST_PROPERTIES && renderer.quickReject(0, 0, width, height)) { + DISPLAY_LIST_LOGD("%s%s %d", (char*) indent, "RestoreToCount", restoreTo); + renderer.restoreToCount(restoreTo); + renderer.endMark(); + return false; + } DisplayListLogBuffer& logBuffer = DisplayListLogBuffer::getInstance(); int saveCount = renderer.getSaveCount() - 1; @@ -843,7 +824,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 +931,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; @@ -972,6 +953,9 @@ bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t width, float x = getFloat(); float y = getFloat(); SkPaint* paint = getPaint(renderer); + if (mCaching && mMultipliedAlpha < 255) { + paint->setAlpha(mMultipliedAlpha); + } DISPLAY_LIST_LOGD("%s%s %p, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op], bitmap, x, y, paint); renderer.drawBitmap(bitmap, x, y, paint); @@ -1233,8 +1217,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 +1305,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,29 +1399,16 @@ 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 - float top = 0; - float left = 0; - float right = width; - float bottom = height; - if (USE_DISPLAY_LIST_PROPERTIES) { - Rect transformedRect; - displayList->transformRect(left, top, right, bottom, transformedRect); - left = transformedRect.left; - top = transformedRect.top; - right = transformedRect.right; - bottom = transformedRect.bottom; - } - const bool reject = quickReject(left, top, right, bottom); - uint32_t* location = addOp(DisplayList::DrawDisplayList, reject); + + addOp(DisplayList::DrawDisplayList); addDisplayList(displayList); addSize(width, height); addInt(flags); - addSkip(location); - return false; + return DrawGlInfo::kStatusDone; } void DisplayListRenderer::drawLayer(Layer* layer, float x, float y, SkPaint* paint) { |
