diff options
author | Chris Craik <ccraik@google.com> | 2015-04-21 16:30:07 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-04-21 16:30:08 +0000 |
commit | 2099ee8ab574181627b9dac81e1ec4f3f80bce05 (patch) | |
tree | 02fc5c9e8e03552737a2b72707da153ec1c9a8db /libs/hwui | |
parent | b55b838c17396b8bb13424e8ca2c81f4efb5d037 (diff) | |
parent | db663fe83f976107fd8fd9307d871b37d9e47370 (diff) | |
download | frameworks_base-2099ee8ab574181627b9dac81e1ec4f3f80bce05.zip frameworks_base-2099ee8ab574181627b9dac81e1ec4f3f80bce05.tar.gz frameworks_base-2099ee8ab574181627b9dac81e1ec4f3f80bce05.tar.bz2 |
Merge "Rename native DisplayListRenderer to DisplayListCanvas"
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/Android.common.mk | 2 | ||||
-rw-r--r-- | libs/hwui/Caches.cpp | 1 | ||||
-rw-r--r-- | libs/hwui/CanvasState.h | 11 | ||||
-rw-r--r-- | libs/hwui/DisplayList.h | 4 | ||||
-rw-r--r-- | libs/hwui/DisplayListCanvas.cpp (renamed from libs/hwui/DisplayListRenderer.cpp) | 131 | ||||
-rw-r--r-- | libs/hwui/DisplayListCanvas.h (renamed from libs/hwui/DisplayListRenderer.h) | 14 | ||||
-rw-r--r-- | libs/hwui/DisplayListOp.h | 2 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 1 | ||||
-rw-r--r-- | libs/hwui/RenderNode.h | 4 | ||||
-rw-r--r-- | libs/hwui/tests/main.cpp | 24 |
10 files changed, 95 insertions, 99 deletions
diff --git a/libs/hwui/Android.common.mk b/libs/hwui/Android.common.mk index ecb625b..5fca8ec 100644 --- a/libs/hwui/Android.common.mk +++ b/libs/hwui/Android.common.mk @@ -37,7 +37,7 @@ LOCAL_SRC_FILES := \ DeferredDisplayList.cpp \ DeferredLayerUpdater.cpp \ DisplayList.cpp \ - DisplayListRenderer.cpp \ + DisplayListCanvas.cpp \ Dither.cpp \ DrawProfiler.cpp \ Extensions.cpp \ diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp index e5489a8..fd5a2ce 100644 --- a/libs/hwui/Caches.cpp +++ b/libs/hwui/Caches.cpp @@ -18,7 +18,6 @@ #include "Caches.h" -#include "DisplayListRenderer.h" #include "GammaFontRenderer.h" #include "LayerRenderer.h" #include "Properties.h" diff --git a/libs/hwui/CanvasState.h b/libs/hwui/CanvasState.h index 4db5ed2..8e4a4d3 100644 --- a/libs/hwui/CanvasState.h +++ b/libs/hwui/CanvasState.h @@ -62,12 +62,13 @@ public: * Renderer interface. Drawing and recording classes that include a CanvasState will have * different use cases: * - * Drawing subclasses (i.e. OpenGLRenderer) can query attributes (such as transform) or hook into - * changes (e.g. save/restore) with minimal surface area for manipulating the stack itself. + * Drawing code maintaining canvas state (i.e. OpenGLRenderer) can query attributes (such as + * transform) or hook into changes (e.g. save/restore) with minimal surface area for manipulating + * the stack itself. * - * Recording subclasses (i.e. DisplayListRenderer) can both record and pass through state operations - * to CanvasState, so that not only will querying operations work (getClip/Matrix), but so - * that quickRejection can also be used. + * Recording code maintaining canvas state (i.e. DisplayListCanvas) can both record and pass + * through state operations to CanvasState, so that not only will querying operations work + * (getClip/Matrix), but so that quickRejection can also be used. */ class ANDROID_API CanvasState { diff --git a/libs/hwui/DisplayList.h b/libs/hwui/DisplayList.h index 3178584..7fbda1f 100644 --- a/libs/hwui/DisplayList.h +++ b/libs/hwui/DisplayList.h @@ -53,7 +53,7 @@ namespace uirenderer { class DeferredDisplayList; class DisplayListOp; -class DisplayListRenderer; +class DisplayListCanvas; class OpenGLRenderer; class Rect; class Layer; @@ -109,7 +109,7 @@ struct ReplayStateStruct : public PlaybackStateStruct { * Data structure that holds the list of commands used in display list stream */ class DisplayListData { - friend class DisplayListRenderer; + friend class DisplayListCanvas; public: struct Chunk { // range of included ops in DLD::displayListOps diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListCanvas.cpp index 8757e15..6b86030 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListCanvas.cpp @@ -14,25 +14,24 @@ * limitations under the License. */ -#define LOG_TAG "OpenGLRenderer" - -#include <SkCamera.h> -#include <SkCanvas.h> - -#include <private/hwui/DrawGlInfo.h> +#include "DisplayListCanvas.h" #include "ResourceCache.h" #include "DeferredDisplayList.h" #include "DeferredLayerUpdater.h" #include "DisplayListOp.h" -#include "DisplayListRenderer.h" #include "RenderNode.h" #include "utils/PaintUtils.h" +#include <SkCamera.h> +#include <SkCanvas.h> + +#include <private/hwui/DrawGlInfo.h> + namespace android { namespace uirenderer { -DisplayListRenderer::DisplayListRenderer() +DisplayListCanvas::DisplayListCanvas() : mState(*this) , mResourceCache(ResourceCache::getInstance()) , mDisplayListData(nullptr) @@ -44,16 +43,16 @@ DisplayListRenderer::DisplayListRenderer() , mRestoreSaveCount(-1) { } -DisplayListRenderer::~DisplayListRenderer() { +DisplayListCanvas::~DisplayListCanvas() { LOG_ALWAYS_FATAL_IF(mDisplayListData, - "Destroyed a DisplayListRenderer during a record!"); + "Destroyed a DisplayListCanvas during a record!"); } /////////////////////////////////////////////////////////////////////////////// // Operations /////////////////////////////////////////////////////////////////////////////// -DisplayListData* DisplayListRenderer::finishRecording() { +DisplayListData* DisplayListCanvas::finishRecording() { mPaintMap.clear(); mRegionMap.clear(); mPathMap.clear(); @@ -63,7 +62,7 @@ DisplayListData* DisplayListRenderer::finishRecording() { return data; } -void DisplayListRenderer::prepareDirty(float left, float top, +void DisplayListCanvas::prepareDirty(float left, float top, float right, float bottom) { LOG_ALWAYS_FATAL_IF(mDisplayListData, @@ -77,25 +76,25 @@ void DisplayListRenderer::prepareDirty(float left, float top, mRestoreSaveCount = -1; } -bool DisplayListRenderer::finish() { +bool DisplayListCanvas::finish() { flushRestoreToCount(); flushTranslate(); return false; } -void DisplayListRenderer::interrupt() { +void DisplayListCanvas::interrupt() { } -void DisplayListRenderer::resume() { +void DisplayListCanvas::resume() { } -void DisplayListRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) { +void DisplayListCanvas::callDrawGLFunction(Functor *functor, Rect& dirty) { // Ignore dirty during recording, it matters only when we replay addDrawOp(new (alloc()) DrawFunctorOp(functor)); mDisplayListData->functors.add(functor); } -SkCanvas* DisplayListRenderer::asSkCanvas() { +SkCanvas* DisplayListCanvas::asSkCanvas() { LOG_ALWAYS_FATAL_IF(!mDisplayListData, "attempting to get an SkCanvas when we are not recording!"); if (!mSkiaCanvasProxy) { @@ -104,12 +103,12 @@ SkCanvas* DisplayListRenderer::asSkCanvas() { return mSkiaCanvasProxy.get(); } -int DisplayListRenderer::save(SkCanvas::SaveFlags flags) { +int DisplayListCanvas::save(SkCanvas::SaveFlags flags) { addStateOp(new (alloc()) SaveOp((int) flags)); return mState.save((int) flags); } -void DisplayListRenderer::restore() { +void DisplayListCanvas::restore() { if (mRestoreSaveCount < 0) { restoreToCount(getSaveCount() - 1); return; @@ -120,13 +119,13 @@ void DisplayListRenderer::restore() { mState.restore(); } -void DisplayListRenderer::restoreToCount(int saveCount) { +void DisplayListCanvas::restoreToCount(int saveCount) { mRestoreSaveCount = saveCount; flushTranslate(); mState.restoreToCount(saveCount); } -int DisplayListRenderer::saveLayer(float left, float top, float right, float bottom, +int DisplayListCanvas::saveLayer(float left, float top, float right, float bottom, const SkPaint* paint, SkCanvas::SaveFlags flags) { // force matrix/clip isolation for layer flags |= SkCanvas::kClip_SaveFlag | SkCanvas::kMatrix_SaveFlag; @@ -136,7 +135,7 @@ int DisplayListRenderer::saveLayer(float left, float top, float right, float bot return mState.save((int) flags); } -void DisplayListRenderer::translate(float dx, float dy) { +void DisplayListCanvas::translate(float dx, float dy) { mHasDeferredTranslate = true; mTranslateX += dx; mTranslateY += dy; @@ -144,66 +143,66 @@ void DisplayListRenderer::translate(float dx, float dy) { mState.translate(dx, dy, 0.0f); } -void DisplayListRenderer::rotate(float degrees) { +void DisplayListCanvas::rotate(float degrees) { addStateOp(new (alloc()) RotateOp(degrees)); mState.rotate(degrees); } -void DisplayListRenderer::scale(float sx, float sy) { +void DisplayListCanvas::scale(float sx, float sy) { addStateOp(new (alloc()) ScaleOp(sx, sy)); mState.scale(sx, sy); } -void DisplayListRenderer::skew(float sx, float sy) { +void DisplayListCanvas::skew(float sx, float sy) { addStateOp(new (alloc()) SkewOp(sx, sy)); mState.skew(sx, sy); } -void DisplayListRenderer::setMatrix(const SkMatrix& matrix) { +void DisplayListCanvas::setMatrix(const SkMatrix& matrix) { addStateOp(new (alloc()) SetMatrixOp(matrix)); mState.setMatrix(matrix); } -void DisplayListRenderer::concat(const SkMatrix& matrix) { +void DisplayListCanvas::concat(const SkMatrix& matrix) { addStateOp(new (alloc()) ConcatMatrixOp(matrix)); mState.concatMatrix(matrix); } -bool DisplayListRenderer::getClipBounds(SkRect* outRect) const { +bool DisplayListCanvas::getClipBounds(SkRect* outRect) const { Rect bounds = mState.getLocalClipBounds(); *outRect = SkRect::MakeLTRB(bounds.left, bounds.top, bounds.right, bounds.bottom); return !(outRect->isEmpty()); } -bool DisplayListRenderer::quickRejectRect(float left, float top, float right, float bottom) const { +bool DisplayListCanvas::quickRejectRect(float left, float top, float right, float bottom) const { return mState.quickRejectConservative(left, top, right, bottom); } -bool DisplayListRenderer::quickRejectPath(const SkPath& path) const { +bool DisplayListCanvas::quickRejectPath(const SkPath& path) const { SkRect bounds = path.getBounds(); return mState.quickRejectConservative(bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom); } -bool DisplayListRenderer::clipRect(float left, float top, float right, float bottom, +bool DisplayListCanvas::clipRect(float left, float top, float right, float bottom, SkRegion::Op op) { addStateOp(new (alloc()) ClipRectOp(left, top, right, bottom, op)); return mState.clipRect(left, top, right, bottom, op); } -bool DisplayListRenderer::clipPath(const SkPath* path, SkRegion::Op op) { +bool DisplayListCanvas::clipPath(const SkPath* path, SkRegion::Op op) { path = refPath(path); addStateOp(new (alloc()) ClipPathOp(path, op)); return mState.clipPath(path, op); } -bool DisplayListRenderer::clipRegion(const SkRegion* region, SkRegion::Op op) { +bool DisplayListCanvas::clipRegion(const SkRegion* region, SkRegion::Op op) { region = refRegion(region); addStateOp(new (alloc()) ClipRegionOp(region, op)); return mState.clipRegion(region, op); } -void DisplayListRenderer::drawRenderNode(RenderNode* renderNode, Rect& dirty, int32_t flags) { +void DisplayListCanvas::drawRenderNode(RenderNode* renderNode, Rect& dirty, int32_t flags) { LOG_ALWAYS_FATAL_IF(!renderNode, "missing rendernode"); // dirty is an out parameter and should not be recorded, @@ -212,21 +211,21 @@ void DisplayListRenderer::drawRenderNode(RenderNode* renderNode, Rect& dirty, in addRenderNodeOp(op); } -void DisplayListRenderer::drawLayer(DeferredLayerUpdater* layerHandle, float x, float y) { +void DisplayListCanvas::drawLayer(DeferredLayerUpdater* layerHandle, float x, float y) { // We ref the DeferredLayerUpdater due to its thread-safe ref-counting // semantics. mDisplayListData->ref(layerHandle); addDrawOp(new (alloc()) DrawLayerOp(layerHandle->backingLayer(), x, y)); } -void DisplayListRenderer::drawBitmap(const SkBitmap* bitmap, const SkPaint* paint) { +void DisplayListCanvas::drawBitmap(const SkBitmap* bitmap, const SkPaint* paint) { bitmap = refBitmap(bitmap); paint = refPaint(paint); addDrawOp(new (alloc()) DrawBitmapOp(bitmap, paint)); } -void DisplayListRenderer::drawBitmap(const SkBitmap& bitmap, float left, float top, +void DisplayListCanvas::drawBitmap(const SkBitmap& bitmap, float left, float top, const SkPaint* paint) { save(SkCanvas::kMatrix_SaveFlag); translate(left, top); @@ -234,7 +233,7 @@ void DisplayListRenderer::drawBitmap(const SkBitmap& bitmap, float left, float t restore(); } -void DisplayListRenderer::drawBitmap(const SkBitmap& bitmap, const SkMatrix& matrix, +void DisplayListCanvas::drawBitmap(const SkBitmap& bitmap, const SkMatrix& matrix, const SkPaint* paint) { if (matrix.isIdentity()) { drawBitmap(&bitmap, paint); @@ -254,7 +253,7 @@ void DisplayListRenderer::drawBitmap(const SkBitmap& bitmap, const SkMatrix& mat } } -void DisplayListRenderer::drawBitmap(const SkBitmap& bitmap, float srcLeft, float srcTop, +void DisplayListCanvas::drawBitmap(const SkBitmap& bitmap, float srcLeft, float srcTop, float srcRight, float srcBottom, float dstLeft, float dstTop, float dstRight, float dstBottom, const SkPaint* paint) { if (srcLeft == 0 && srcTop == 0 @@ -300,7 +299,7 @@ void DisplayListRenderer::drawBitmap(const SkBitmap& bitmap, float srcLeft, floa } } -void DisplayListRenderer::drawBitmapMesh(const SkBitmap& bitmap, int meshWidth, int meshHeight, +void DisplayListCanvas::drawBitmapMesh(const SkBitmap& bitmap, int meshWidth, int meshHeight, const float* vertices, const int* colors, const SkPaint* paint) { int vertexCount = (meshWidth + 1) * (meshHeight + 1); vertices = refBuffer<float>(vertices, vertexCount * 2); // 2 floats per vertex @@ -311,7 +310,7 @@ void DisplayListRenderer::drawBitmapMesh(const SkBitmap& bitmap, int meshWidth, vertices, colors, paint)); } -void DisplayListRenderer::drawPatch(const SkBitmap* bitmap, const Res_png_9patch* patch, +void DisplayListCanvas::drawPatch(const SkBitmap* bitmap, const Res_png_9patch* patch, float left, float top, float right, float bottom, const SkPaint* paint) { bitmap = refBitmap(bitmap); patch = refPatch(patch); @@ -320,11 +319,11 @@ void DisplayListRenderer::drawPatch(const SkBitmap* bitmap, const Res_png_9patch addDrawOp(new (alloc()) DrawPatchOp(bitmap, patch, left, top, right, bottom, paint)); } -void DisplayListRenderer::drawColor(int color, SkXfermode::Mode mode) { +void DisplayListCanvas::drawColor(int color, SkXfermode::Mode mode) { addDrawOp(new (alloc()) DrawColorOp(color, mode)); } -void DisplayListRenderer::drawPaint(const SkPaint& paint) { +void DisplayListCanvas::drawPaint(const SkPaint& paint) { SkRect bounds; if (getClipBounds(&bounds)) { drawRect(bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom, paint); @@ -332,17 +331,17 @@ void DisplayListRenderer::drawPaint(const SkPaint& paint) { } -void DisplayListRenderer::drawRect(float left, float top, float right, float bottom, +void DisplayListCanvas::drawRect(float left, float top, float right, float bottom, const SkPaint& paint) { addDrawOp(new (alloc()) DrawRectOp(left, top, right, bottom, refPaint(&paint))); } -void DisplayListRenderer::drawRoundRect(float left, float top, float right, float bottom, +void DisplayListCanvas::drawRoundRect(float left, float top, float right, float bottom, float rx, float ry, const SkPaint& paint) { addDrawOp(new (alloc()) DrawRoundRectOp(left, top, right, bottom, rx, ry, refPaint(&paint))); } -void DisplayListRenderer::drawRoundRect( +void DisplayListCanvas::drawRoundRect( CanvasPropertyPrimitive* left, CanvasPropertyPrimitive* top, CanvasPropertyPrimitive* right, CanvasPropertyPrimitive* bottom, CanvasPropertyPrimitive* rx, CanvasPropertyPrimitive* ry, @@ -358,11 +357,11 @@ void DisplayListRenderer::drawRoundRect( &right->value, &bottom->value, &rx->value, &ry->value, &paint->value)); } -void DisplayListRenderer::drawCircle(float x, float y, float radius, const SkPaint& paint) { +void DisplayListCanvas::drawCircle(float x, float y, float radius, const SkPaint& paint) { addDrawOp(new (alloc()) DrawCircleOp(x, y, radius, refPaint(&paint))); } -void DisplayListRenderer::drawCircle(CanvasPropertyPrimitive* x, CanvasPropertyPrimitive* y, +void DisplayListCanvas::drawCircle(CanvasPropertyPrimitive* x, CanvasPropertyPrimitive* y, CanvasPropertyPrimitive* radius, CanvasPropertyPaint* paint) { mDisplayListData->ref(x); mDisplayListData->ref(y); @@ -372,12 +371,12 @@ void DisplayListRenderer::drawCircle(CanvasPropertyPrimitive* x, CanvasPropertyP &radius->value, &paint->value)); } -void DisplayListRenderer::drawOval(float left, float top, float right, float bottom, +void DisplayListCanvas::drawOval(float left, float top, float right, float bottom, const SkPaint& paint) { addDrawOp(new (alloc()) DrawOvalOp(left, top, right, bottom, refPaint(&paint))); } -void DisplayListRenderer::drawArc(float left, float top, float right, float bottom, +void DisplayListCanvas::drawArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle, bool useCenter, const SkPaint& paint) { if (fabs(sweepAngle) >= 360.0f) { drawOval(left, top, right, bottom, paint); @@ -387,23 +386,23 @@ void DisplayListRenderer::drawArc(float left, float top, float right, float bott } } -void DisplayListRenderer::drawPath(const SkPath& path, const SkPaint& paint) { +void DisplayListCanvas::drawPath(const SkPath& path, const SkPaint& paint) { addDrawOp(new (alloc()) DrawPathOp(refPath(&path), refPaint(&paint))); } -void DisplayListRenderer::drawLines(const float* points, int count, const SkPaint& paint) { +void DisplayListCanvas::drawLines(const float* points, int count, const SkPaint& paint) { points = refBuffer<float>(points, count); addDrawOp(new (alloc()) DrawLinesOp(points, count, refPaint(&paint))); } -void DisplayListRenderer::drawPoints(const float* points, int count, const SkPaint& paint) { +void DisplayListCanvas::drawPoints(const float* points, int count, const SkPaint& paint) { points = refBuffer<float>(points, count); addDrawOp(new (alloc()) DrawPointsOp(points, count, refPaint(&paint))); } -void DisplayListRenderer::drawTextOnPath(const uint16_t* glyphs, int count, +void DisplayListCanvas::drawTextOnPath(const uint16_t* glyphs, int count, const SkPath& path, float hOffset, float vOffset, const SkPaint& paint) { if (!glyphs || count <= 0) return; @@ -414,7 +413,7 @@ void DisplayListRenderer::drawTextOnPath(const uint16_t* glyphs, int count, addDrawOp(op); } -void DisplayListRenderer::drawPosText(const uint16_t* text, const float* positions, +void DisplayListCanvas::drawPosText(const uint16_t* text, const float* positions, int count, int posCount, const SkPaint& paint) { if (!text || count <= 0) return; @@ -436,7 +435,7 @@ static void simplifyPaint(int color, SkPaint* paint) { paint->setLooper(nullptr); } -void DisplayListRenderer::drawText(const uint16_t* glyphs, const float* positions, +void DisplayListCanvas::drawText(const uint16_t* glyphs, const float* positions, int count, const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop, float boundsRight, float boundsBottom, float totalAdvance) { @@ -475,7 +474,7 @@ void DisplayListRenderer::drawText(const uint16_t* glyphs, const float* position } } -void DisplayListRenderer::drawRects(const float* rects, int count, const SkPaint* paint) { +void DisplayListCanvas::drawRects(const float* rects, int count, const SkPaint* paint) { if (count <= 0) return; rects = refBuffer<float>(rects, count); @@ -483,24 +482,24 @@ void DisplayListRenderer::drawRects(const float* rects, int count, const SkPaint addDrawOp(new (alloc()) DrawRectsOp(rects, count, paint)); } -void DisplayListRenderer::setDrawFilter(SkDrawFilter* filter) { +void DisplayListCanvas::setDrawFilter(SkDrawFilter* filter) { mDrawFilter.reset(SkSafeRef(filter)); } -void DisplayListRenderer::insertReorderBarrier(bool enableReorder) { +void DisplayListCanvas::insertReorderBarrier(bool enableReorder) { flushRestoreToCount(); flushTranslate(); mDeferredBarrierType = enableReorder ? kBarrier_OutOfOrder : kBarrier_InOrder; } -void DisplayListRenderer::flushRestoreToCount() { +void DisplayListCanvas::flushRestoreToCount() { if (mRestoreSaveCount >= 0) { addOpAndUpdateChunk(new (alloc()) RestoreToCountOp(mRestoreSaveCount)); mRestoreSaveCount = -1; } } -void DisplayListRenderer::flushTranslate() { +void DisplayListCanvas::flushTranslate() { if (mHasDeferredTranslate) { if (mTranslateX != 0.0f || mTranslateY != 0.0f) { addOpAndUpdateChunk(new (alloc()) TranslateOp(mTranslateX, mTranslateY)); @@ -510,7 +509,7 @@ void DisplayListRenderer::flushTranslate() { } } -size_t DisplayListRenderer::addOpAndUpdateChunk(DisplayListOp* op) { +size_t DisplayListCanvas::addOpAndUpdateChunk(DisplayListOp* op) { int insertIndex = mDisplayListData->displayListOps.add(op); if (mDeferredBarrierType != kBarrier_None) { // op is first in new chunk @@ -530,17 +529,17 @@ size_t DisplayListRenderer::addOpAndUpdateChunk(DisplayListOp* op) { return insertIndex; } -size_t DisplayListRenderer::flushAndAddOp(DisplayListOp* op) { +size_t DisplayListCanvas::flushAndAddOp(DisplayListOp* op) { flushRestoreToCount(); flushTranslate(); return addOpAndUpdateChunk(op); } -size_t DisplayListRenderer::addStateOp(StateOp* op) { +size_t DisplayListCanvas::addStateOp(StateOp* op) { return flushAndAddOp(op); } -size_t DisplayListRenderer::addDrawOp(DrawOp* op) { +size_t DisplayListCanvas::addDrawOp(DrawOp* op) { Rect localBounds; if (op->getLocalBounds(localBounds)) { bool rejected = quickRejectRect(localBounds.left, localBounds.top, @@ -552,7 +551,7 @@ size_t DisplayListRenderer::addDrawOp(DrawOp* op) { return flushAndAddOp(op); } -size_t DisplayListRenderer::addRenderNodeOp(DrawRenderNodeOp* op) { +size_t DisplayListCanvas::addRenderNodeOp(DrawRenderNodeOp* op) { int opIndex = addDrawOp(op); int childIndex = mDisplayListData->addChild(op); diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListCanvas.h index 53fd1ad..a9ac57d 100644 --- a/libs/hwui/DisplayListRenderer.h +++ b/libs/hwui/DisplayListCanvas.h @@ -52,9 +52,7 @@ namespace uirenderer { class DeferredDisplayList; class DeferredLayerUpdater; -class DisplayListRenderer; class DisplayListOp; -class DisplayListRenderer; class DrawOp; class RenderNode; class StateOp; @@ -62,10 +60,10 @@ class StateOp; /** * Records drawing commands in a display list for later playback into an OpenGLRenderer. */ -class ANDROID_API DisplayListRenderer: public Canvas, public CanvasStateClient { +class ANDROID_API DisplayListCanvas: public Canvas, public CanvasStateClient { public: - DisplayListRenderer(); - virtual ~DisplayListRenderer(); + DisplayListCanvas(); + virtual ~DisplayListCanvas(); void insertReorderBarrier(bool enableReorder); @@ -139,7 +137,7 @@ public: virtual SkCanvas* asSkCanvas() override; virtual void setBitmap(SkBitmap* bitmap, bool copyState) override { - LOG_ALWAYS_FATAL("DisplayListRenderer is not backed by a bitmap."); + LOG_ALWAYS_FATAL("DisplayListCanvas is not backed by a bitmap."); } virtual bool isOpaque() override { return false; } @@ -216,7 +214,7 @@ public: virtual void drawVertices(SkCanvas::VertexMode vertexMode, int vertexCount, const float* verts, const float* tex, const int* colors, const uint16_t* indices, int indexCount, const SkPaint& paint) override - { /* DisplayListRenderer does not support drawVertices(); ignore */ } + { /* DisplayListCanvas does not support drawVertices(); ignore */ } // Bitmap-based virtual void drawBitmap(const SkBitmap& bitmap, float left, float top, const SkPaint* paint) override; @@ -382,7 +380,7 @@ private: friend class RenderNode; -}; // class DisplayListRenderer +}; // class DisplayListCanvas }; // namespace uirenderer }; // namespace android diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h index 1963475..b5801fc 100644 --- a/libs/hwui/DisplayListOp.h +++ b/libs/hwui/DisplayListOp.h @@ -20,7 +20,7 @@ #include "OpenGLRenderer.h" #include "AssetAtlas.h" #include "DeferredDisplayList.h" -#include "DisplayListRenderer.h" +#include "DisplayListCanvas.h" #include "GammaFontRenderer.h" #include "Patch.h" #include "RenderNode.h" diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index d06534e..30935d5 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -17,7 +17,6 @@ #include "OpenGLRenderer.h" #include "DeferredDisplayList.h" -#include "DisplayListRenderer.h" #include "GammaFontRenderer.h" #include "Glop.h" #include "GlopBuilder.h" diff --git a/libs/hwui/RenderNode.h b/libs/hwui/RenderNode.h index bbe53ff..d0d81d9 100644 --- a/libs/hwui/RenderNode.h +++ b/libs/hwui/RenderNode.h @@ -47,7 +47,7 @@ namespace android { namespace uirenderer { class DisplayListOp; -class DisplayListRenderer; +class DisplayListCanvas; class OpenGLRenderer; class Rect; class Layer; @@ -64,7 +64,7 @@ class TreeInfo; * Primary class for storing recorded canvas commands, as well as per-View/ViewGroup display properties. * * Recording of canvas commands is somewhat similar to SkPicture, except the canvas-recording - * functionality is split between DisplayListRenderer (which manages the recording), DisplayListData + * functionality is split between DisplayListCanvas (which manages the recording), DisplayListData * (which holds the actual data), and DisplayList (which holds properties and performs playback onto * a renderer). * diff --git a/libs/hwui/tests/main.cpp b/libs/hwui/tests/main.cpp index 805989b..61ad082 100644 --- a/libs/hwui/tests/main.cpp +++ b/libs/hwui/tests/main.cpp @@ -21,7 +21,7 @@ #include <ui/PixelFormat.h> #include <AnimationContext.h> -#include <DisplayListRenderer.h> +#include <DisplayListCanvas.h> #include <RenderNode.h> #include <renderthread/RenderProxy.h> #include <renderthread/RenderTask.h> @@ -40,15 +40,15 @@ public: } }; -static DisplayListRenderer* startRecording(RenderNode* node) { - DisplayListRenderer* renderer = new DisplayListRenderer(); +static DisplayListCanvas* startRecording(RenderNode* node) { + DisplayListCanvas* renderer = new DisplayListCanvas(); renderer->setViewport(node->stagingProperties().getWidth(), node->stagingProperties().getHeight()); renderer->prepare(); return renderer; } -static void endRecording(DisplayListRenderer* renderer, RenderNode* node) { +static void endRecording(DisplayListCanvas* renderer, RenderNode* node) { renderer->finish(); node->setStagingDisplayList(renderer->finishRecording()); delete renderer; @@ -58,7 +58,7 @@ class TreeContentAnimation { public: virtual ~TreeContentAnimation() {} virtual int getFrameCount() { return 150; } - virtual void createContent(int width, int height, DisplayListRenderer* renderer) = 0; + virtual void createContent(int width, int height, DisplayListCanvas* renderer) = 0; virtual void doFrame(int frameNr) = 0; template <class T> @@ -89,7 +89,7 @@ public: android::uirenderer::Rect DUMMY; - DisplayListRenderer* renderer = startRecording(rootNode); + DisplayListCanvas* renderer = startRecording(rootNode); animation.createContent(width, height, renderer); endRecording(renderer, rootNode); @@ -110,7 +110,7 @@ public: class ShadowGridAnimation : public TreeContentAnimation { public: std::vector< sp<RenderNode> > cards; - void createContent(int width, int height, DisplayListRenderer* renderer) override { + void createContent(int width, int height, DisplayListCanvas* renderer) override { android::uirenderer::Rect DUMMY; renderer->drawColor(0xFFFFFFFF, SkXfermode::kSrcOver_Mode); @@ -142,7 +142,7 @@ private: node->mutateStagingProperties().mutableOutline().setShouldClip(true); node->setPropertyFieldsDirty(RenderNode::X | RenderNode::Y | RenderNode::Z); - DisplayListRenderer* renderer = startRecording(node.get()); + DisplayListCanvas* renderer = startRecording(node.get()); renderer->drawColor(0xFFEEEEEE, SkXfermode::kSrcOver_Mode); endRecording(renderer, node.get()); return node; @@ -152,7 +152,7 @@ private: class RectGridAnimation : public TreeContentAnimation { public: sp<RenderNode> card; - void createContent(int width, int height, DisplayListRenderer* renderer) override { + void createContent(int width, int height, DisplayListCanvas* renderer) override { android::uirenderer::Rect DUMMY; renderer->drawColor(0xFFFFFFFF, SkXfermode::kSrcOver_Mode); @@ -174,7 +174,7 @@ private: node->mutateStagingProperties().setLeftTopRightBottom(x, y, x + width, y + height); node->setPropertyFieldsDirty(RenderNode::X | RenderNode::Y); - DisplayListRenderer* renderer = startRecording(node.get()); + DisplayListCanvas* renderer = startRecording(node.get()); renderer->drawColor(0xFFFF00FF, SkXfermode::kSrcOver_Mode); float rects[width * height]; @@ -201,7 +201,7 @@ private: class OvalAnimation : public TreeContentAnimation { public: sp<RenderNode> card; - void createContent(int width, int height, DisplayListRenderer* renderer) override { + void createContent(int width, int height, DisplayListCanvas* renderer) override { android::uirenderer::Rect DUMMY; renderer->drawColor(0xFFFFFFFF, SkXfermode::kSrcOver_Mode); @@ -224,7 +224,7 @@ private: node->mutateStagingProperties().setLeftTopRightBottom(x, y, x + width, y + height); node->setPropertyFieldsDirty(RenderNode::X | RenderNode::Y); - DisplayListRenderer* renderer = startRecording(node.get()); + DisplayListCanvas* renderer = startRecording(node.get()); SkPaint paint; paint.setAntiAlias(true); |