Rename DisplayListData to DisplayList

Change-Id: I25f6bb88ffdf9baf7e8e4e2a294aa8c9d2a4605b
This commit is contained in:
Chris Craik
2015-10-16 10:24:55 -07:00
parent e4436e325c
commit 003cc3dec8
21 changed files with 205 additions and 205 deletions

View File

@@ -198,8 +198,8 @@ public class RenderNode {
* @see #isValid()
*/
public void end(DisplayListCanvas canvas) {
long renderNodeData = canvas.finishRecording();
nSetDisplayListData(mNativeRenderNode, renderNodeData);
long displayList = canvas.finishRecording();
nSetDisplayList(mNativeRenderNode, displayList);
canvas.recycle();
mValid = true;
}
@@ -209,10 +209,10 @@ public class RenderNode {
* during destruction of hardware resources, to ensure that we do not hold onto
* obsolete resources after related resources are gone.
*/
public void destroyDisplayListData() {
public void discardDisplayList() {
if (!mValid) return;
nSetDisplayListData(mNativeRenderNode, 0);
nSetDisplayList(mNativeRenderNode, 0);
mValid = false;
}
@@ -781,7 +781,7 @@ public class RenderNode {
private static native long nCreate(String name);
private static native void nDestroyRenderNode(long renderNode);
private static native void nSetDisplayListData(long renderNode, long newData);
private static native void nSetDisplayList(long renderNode, long newData);
// Matrix

View File

@@ -15385,11 +15385,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
private void resetDisplayList() {
if (mRenderNode.isValid()) {
mRenderNode.destroyDisplayListData();
mRenderNode.discardDisplayList();
}
if (mBackgroundRenderNode != null && mBackgroundRenderNode.isValid()) {
mBackgroundRenderNode.destroyDisplayListData();
mBackgroundRenderNode.discardDisplayList();
}
}

View File

@@ -392,7 +392,7 @@ public class Editor {
mTextView.removeCallbacks(mShowFloatingToolbar);
destroyDisplayListsData();
discardTextDisplayLists();
if (mSpellChecker != null) {
mSpellChecker.closeSession();
@@ -408,13 +408,13 @@ public class Editor {
mTemporaryDetach = false;
}
private void destroyDisplayListsData() {
private void discardTextDisplayLists() {
if (mTextRenderNodes != null) {
for (int i = 0; i < mTextRenderNodes.length; i++) {
RenderNode displayList = mTextRenderNodes[i] != null
? mTextRenderNodes[i].renderNode : null;
if (displayList != null && displayList.isValid()) {
displayList.destroyDisplayListData();
displayList.discardDisplayList();
}
}
}

View File

@@ -71,10 +71,10 @@ static void android_view_RenderNode_destroyRenderNode(JNIEnv* env,
renderNode->decStrong(0);
}
static void android_view_RenderNode_setDisplayListData(JNIEnv* env,
jobject clazz, jlong renderNodePtr, jlong newDataPtr) {
static void android_view_RenderNode_setDisplayList(JNIEnv* env,
jobject clazz, jlong renderNodePtr, jlong displayListPtr) {
RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr);
DisplayListData* newData = reinterpret_cast<DisplayListData*>(newDataPtr);
DisplayList* newData = reinterpret_cast<DisplayList*>(displayListPtr);
renderNode->setStagingDisplayList(newData);
}
@@ -468,11 +468,11 @@ static void android_view_RenderNode_endAllAnimators(JNIEnv* env, jobject clazz,
const char* const kClassPathName = "android/view/RenderNode";
static const JNINativeMethod gMethods[] = {
{ "nCreate", "(Ljava/lang/String;)J", (void*) android_view_RenderNode_create },
{ "nDestroyRenderNode", "(J)V", (void*) android_view_RenderNode_destroyRenderNode },
{ "nSetDisplayListData", "(JJ)V", (void*) android_view_RenderNode_setDisplayListData },
{ "nOutput", "(J)V", (void*) android_view_RenderNode_output },
{ "nGetDebugSize", "(J)I", (void*) android_view_RenderNode_getDebugSize },
{ "nCreate", "(Ljava/lang/String;)J", (void*) android_view_RenderNode_create },
{ "nDestroyRenderNode", "(J)V", (void*) android_view_RenderNode_destroyRenderNode },
{ "nSetDisplayList", "(JJ)V", (void*) android_view_RenderNode_setDisplayList },
{ "nOutput", "(J)V", (void*) android_view_RenderNode_output },
{ "nGetDebugSize", "(J)I", (void*) android_view_RenderNode_getDebugSize },
{ "nSetLayerType", "!(JI)Z", (void*) android_view_RenderNode_setLayerType },
{ "nSetLayerPaint", "!(JJ)Z", (void*) android_view_RenderNode_setLayerPaint },

View File

@@ -32,16 +32,16 @@
namespace android {
namespace uirenderer {
DisplayListData::DisplayListData()
DisplayList::DisplayList()
: projectionReceiveIndex(-1)
, hasDrawOps(false) {
}
DisplayListData::~DisplayListData() {
DisplayList::~DisplayList() {
cleanupResources();
}
void DisplayListData::cleanupResources() {
void DisplayList::cleanupResources() {
if (CC_UNLIKELY(patchResources.size())) {
ResourceCache& resourceCache = ResourceCache::getInstance();
resourceCache.lock();
@@ -67,7 +67,7 @@ void DisplayListData::cleanupResources() {
regions.clear();
}
size_t DisplayListData::addChild(NodeOpType* op) {
size_t DisplayList::addChild(NodeOpType* op) {
mReferenceHolders.push_back(op->renderNode);
size_t index = mChildren.size();
mChildren.push_back(op);

View File

@@ -112,16 +112,16 @@ struct ReplayStateStruct : public PlaybackStateStruct {
/**
* Data structure that holds the list of commands used in display list stream
*/
class DisplayListData {
class DisplayList {
friend class DisplayListCanvas;
friend class RecordingCanvas;
public:
struct Chunk {
// range of included ops in DLD::displayListOps
// range of included ops in DisplayList::ops()
size_t beginOpIndex;
size_t endOpIndex;
// range of included children in DLD::mChildren
// range of included children in DisplayList::children()
size_t beginChildIndex;
size_t endChildIndex;
@@ -129,8 +129,8 @@ public:
bool reorderChildren;
};
DisplayListData();
~DisplayListData();
DisplayList();
~DisplayList();
// pointers to all ops within display list, pointing into allocator data
std::vector<DisplayListOp*> displayListOps;

View File

@@ -34,7 +34,7 @@ namespace uirenderer {
DisplayListCanvas::DisplayListCanvas(int width, int height)
: mState(*this)
, mResourceCache(ResourceCache::getInstance())
, mDisplayListData(nullptr)
, mDisplayList(nullptr)
, mTranslateX(0.0f)
, mTranslateY(0.0f)
, mHasDeferredTranslate(false)
@@ -45,14 +45,14 @@ DisplayListCanvas::DisplayListCanvas(int width, int height)
}
DisplayListCanvas::~DisplayListCanvas() {
LOG_ALWAYS_FATAL_IF(mDisplayListData,
LOG_ALWAYS_FATAL_IF(mDisplayList,
"Destroyed a DisplayListCanvas during a record!");
}
void DisplayListCanvas::reset(int width, int height) {
LOG_ALWAYS_FATAL_IF(mDisplayListData,
LOG_ALWAYS_FATAL_IF(mDisplayList,
"prepareDirty called a second time during a recording!");
mDisplayListData = new DisplayListData();
mDisplayList = new DisplayList();
mState.initializeSaveStack(width, height,
0, 0, width, height, Vector3());
@@ -67,26 +67,26 @@ void DisplayListCanvas::reset(int width, int height) {
// Operations
///////////////////////////////////////////////////////////////////////////////
DisplayListData* DisplayListCanvas::finishRecording() {
DisplayList* DisplayListCanvas::finishRecording() {
flushRestoreToCount();
flushTranslate();
mPaintMap.clear();
mRegionMap.clear();
mPathMap.clear();
DisplayListData* data = mDisplayListData;
mDisplayListData = nullptr;
DisplayList* displayList = mDisplayList;
mDisplayList = nullptr;
mSkiaCanvasProxy.reset(nullptr);
return data;
return displayList;
}
void DisplayListCanvas::callDrawGLFunction(Functor *functor) {
addDrawOp(new (alloc()) DrawFunctorOp(functor));
mDisplayListData->functors.add(functor);
mDisplayList->functors.add(functor);
}
SkCanvas* DisplayListCanvas::asSkCanvas() {
LOG_ALWAYS_FATAL_IF(!mDisplayListData,
LOG_ALWAYS_FATAL_IF(!mDisplayList,
"attempting to get an SkCanvas when we are not recording!");
if (!mSkiaCanvasProxy) {
mSkiaCanvasProxy.reset(new SkiaCanvasProxy(this));
@@ -219,7 +219,7 @@ void DisplayListCanvas::drawRenderNode(RenderNode* renderNode) {
void DisplayListCanvas::drawLayer(DeferredLayerUpdater* layerHandle) {
// We ref the DeferredLayerUpdater due to its thread-safe ref-counting
// semantics.
mDisplayListData->ref(layerHandle);
mDisplayList->ref(layerHandle);
addDrawOp(new (alloc()) DrawLayerOp(layerHandle->backingLayer()));
}
@@ -354,13 +354,13 @@ void DisplayListCanvas::drawRoundRect(
CanvasPropertyPrimitive* right, CanvasPropertyPrimitive* bottom,
CanvasPropertyPrimitive* rx, CanvasPropertyPrimitive* ry,
CanvasPropertyPaint* paint) {
mDisplayListData->ref(left);
mDisplayListData->ref(top);
mDisplayListData->ref(right);
mDisplayListData->ref(bottom);
mDisplayListData->ref(rx);
mDisplayListData->ref(ry);
mDisplayListData->ref(paint);
mDisplayList->ref(left);
mDisplayList->ref(top);
mDisplayList->ref(right);
mDisplayList->ref(bottom);
mDisplayList->ref(rx);
mDisplayList->ref(ry);
mDisplayList->ref(paint);
refBitmapsInShader(paint->value.getShader());
addDrawOp(new (alloc()) DrawRoundRectPropsOp(&left->value, &top->value,
&right->value, &bottom->value, &rx->value, &ry->value, &paint->value));
@@ -372,10 +372,10 @@ void DisplayListCanvas::drawCircle(float x, float y, float radius, const SkPaint
void DisplayListCanvas::drawCircle(CanvasPropertyPrimitive* x, CanvasPropertyPrimitive* y,
CanvasPropertyPrimitive* radius, CanvasPropertyPaint* paint) {
mDisplayListData->ref(x);
mDisplayListData->ref(y);
mDisplayListData->ref(radius);
mDisplayListData->ref(paint);
mDisplayList->ref(x);
mDisplayList->ref(y);
mDisplayList->ref(radius);
mDisplayList->ref(paint);
refBitmapsInShader(paint->value.getShader());
addDrawOp(new (alloc()) DrawCirclePropsOp(&x->value, &y->value,
&radius->value, &paint->value));
@@ -514,26 +514,26 @@ void DisplayListCanvas::flushTranslate() {
}
size_t DisplayListCanvas::addOpAndUpdateChunk(DisplayListOp* op) {
int insertIndex = mDisplayListData->ops.size();
int insertIndex = mDisplayList->ops.size();
#if HWUI_NEW_OPS
LOG_ALWAYS_FATAL("unsupported");
#else
mDisplayListData->ops.push_back(op);
mDisplayList->ops.push_back(op);
#endif
if (mDeferredBarrierType != kBarrier_None) {
// op is first in new chunk
mDisplayListData->chunks.emplace_back();
DisplayListData::Chunk& newChunk = mDisplayListData->chunks.back();
mDisplayList->chunks.emplace_back();
DisplayList::Chunk& newChunk = mDisplayList->chunks.back();
newChunk.beginOpIndex = insertIndex;
newChunk.endOpIndex = insertIndex + 1;
newChunk.reorderChildren = (mDeferredBarrierType == kBarrier_OutOfOrder);
int nextChildIndex = mDisplayListData->children().size();
int nextChildIndex = mDisplayList->children().size();
newChunk.beginChildIndex = newChunk.endChildIndex = nextChildIndex;
mDeferredBarrierType = kBarrier_None;
} else {
// standard case - append to existing chunk
mDisplayListData->chunks.back().endOpIndex = insertIndex + 1;
mDisplayList->chunks.back().endOpIndex = insertIndex + 1;
}
return insertIndex;
}
@@ -556,22 +556,22 @@ size_t DisplayListCanvas::addDrawOp(DrawOp* op) {
op->setQuickRejected(rejected);
}
mDisplayListData->hasDrawOps = true;
mDisplayList->hasDrawOps = true;
return flushAndAddOp(op);
}
size_t DisplayListCanvas::addRenderNodeOp(DrawRenderNodeOp* op) {
int opIndex = addDrawOp(op);
#if !HWUI_NEW_OPS
int childIndex = mDisplayListData->addChild(op);
int childIndex = mDisplayList->addChild(op);
// update the chunk's child indices
DisplayListData::Chunk& chunk = mDisplayListData->chunks.back();
DisplayList::Chunk& chunk = mDisplayList->chunks.back();
chunk.endChildIndex = childIndex + 1;
if (op->renderNode->stagingProperties().isProjectionReceiver()) {
// use staging property, since recording on UI thread
mDisplayListData->projectionReceiveIndex = opIndex;
mDisplayList->projectionReceiveIndex = opIndex;
}
#endif
return opIndex;

View File

@@ -66,7 +66,7 @@ public:
virtual ~DisplayListCanvas();
void reset(int width, int height);
__attribute__((warn_unused_result)) DisplayListData* finishRecording();
__attribute__((warn_unused_result)) DisplayList* finishRecording();
// ----------------------------------------------------------------------------
// HWUI Canvas state operations
@@ -236,7 +236,7 @@ private:
void flushTranslate();
void flushReorderBarrier();
LinearAllocator& alloc() { return mDisplayListData->allocator; }
LinearAllocator& alloc() { return mDisplayList->allocator; }
// Each method returns final index of op
size_t addOpAndUpdateChunk(DisplayListOp* op);
@@ -253,7 +253,7 @@ private:
inline const T* refBuffer(const T* srcBuffer, int32_t count) {
if (!srcBuffer) return nullptr;
T* dstBuffer = (T*) mDisplayListData->allocator.alloc(count * sizeof(T));
T* dstBuffer = (T*) mDisplayList->allocator.alloc(count * sizeof(T));
memcpy(dstBuffer, srcBuffer, count * sizeof(T));
return dstBuffer;
}
@@ -268,7 +268,7 @@ private:
// The points/verbs within the path are refcounted so this copy operation
// is inexpensive and maintains the generationID of the original path.
const SkPath* cachedPath = new SkPath(*path);
mDisplayListData->pathResources.push_back(cachedPath);
mDisplayList->pathResources.push_back(cachedPath);
return cachedPath;
}
@@ -292,7 +292,7 @@ private:
if (cachedPaint == nullptr || *cachedPaint != *paint) {
cachedPaint = new SkPaint(*paint);
std::unique_ptr<const SkPaint> copy(cachedPaint);
mDisplayListData->paints.push_back(std::move(copy));
mDisplayList->paints.push_back(std::move(copy));
// replaceValueFor() performs an add if the entry doesn't exist
mPaintMap.replaceValueFor(key, cachedPaint);
@@ -312,7 +312,7 @@ private:
if (cachedRegion == nullptr) {
std::unique_ptr<const SkRegion> copy(new SkRegion(*region));
cachedRegion = copy.get();
mDisplayListData->regions.push_back(std::move(copy));
mDisplayList->regions.push_back(std::move(copy));
// replaceValueFor() performs an add if the entry doesn't exist
mRegionMap.replaceValueFor(region, cachedRegion);
@@ -328,12 +328,12 @@ private:
// which doesn't seem worth the extra cycles for this unlikely case.
SkBitmap* localBitmap = new (alloc()) SkBitmap(bitmap);
alloc().autoDestroy(localBitmap);
mDisplayListData->bitmapResources.push_back(localBitmap);
mDisplayList->bitmapResources.push_back(localBitmap);
return localBitmap;
}
inline const Res_png_9patch* refPatch(const Res_png_9patch* patch) {
mDisplayListData->patchResources.push_back(patch);
mDisplayList->patchResources.push_back(patch);
mResourceCache.incrementRefcount(patch);
return patch;
}
@@ -343,7 +343,7 @@ private:
DefaultKeyedVector<const SkRegion*, const SkRegion*> mRegionMap;
ResourceCache& mResourceCache;
DisplayListData* mDisplayListData;
DisplayList* mDisplayList;
float mTranslateX;
float mTranslateY;

View File

@@ -1396,7 +1396,7 @@ private:
class DrawRenderNodeOp : public DrawBoundedOp {
friend class RenderNode; // grant RenderNode access to info of child
friend class DisplayListData; // grant DisplayListData access to info of child
friend class DisplayList; // grant DisplayList access to info of child
friend class DisplayListCanvas;
public:
DrawRenderNodeOp(RenderNode* renderNode, const mat4& transformFromParent, bool clipIsSimple)

View File

@@ -224,15 +224,15 @@ void OpReorderer::defer(const SkRect& clip, int viewportWidth, int viewportHeigh
mCanvasState.save(SkCanvas::kClip_SaveFlag | SkCanvas::kMatrix_SaveFlag);
if (node->applyViewProperties(mCanvasState)) {
// not rejected do ops...
const DisplayListData& data = node->getDisplayListData();
deferImpl(data.getChunks(), data.getOps());
const DisplayList& displayList = node->getDisplayList();
deferImpl(displayList.getChunks(), displayList.getOps());
}
mCanvasState.restore();
}
}
void OpReorderer::defer(int viewportWidth, int viewportHeight,
const std::vector<DisplayListData::Chunk>& chunks, const std::vector<RecordedOp*>& ops) {
const std::vector<DisplayList::Chunk>& chunks, const std::vector<RecordedOp*>& ops) {
ATRACE_NAME("prepare drawing commands");
mCanvasState.initializeSaveStack(viewportWidth, viewportHeight,
0, 0, viewportWidth, viewportHeight, Vector3());
@@ -247,12 +247,12 @@ void OpReorderer::defer(int viewportWidth, int viewportHeight,
*/
#define OP_RECIEVER(Type) \
[](OpReorderer& reorderer, const RecordedOp& op) { reorderer.on##Type(static_cast<const Type&>(op)); },
void OpReorderer::deferImpl(const std::vector<DisplayListData::Chunk>& chunks,
void OpReorderer::deferImpl(const std::vector<DisplayList::Chunk>& chunks,
const std::vector<RecordedOp*>& ops) {
static std::function<void(OpReorderer& reorderer, const RecordedOp&)> receivers[] = {
MAP_OPS(OP_RECIEVER)
};
for (const DisplayListData::Chunk& chunk : chunks) {
for (const DisplayList::Chunk& chunk : chunks) {
for (size_t opIndex = chunk.beginOpIndex; opIndex < chunk.endOpIndex; opIndex++) {
const RecordedOp* op = ops[opIndex];
receivers[op->opId](*this, *op);
@@ -288,8 +288,8 @@ void OpReorderer::onRenderNodeOp(const RenderNodeOp& op) {
// apply RenderProperties state
if (op.renderNode->applyViewProperties(mCanvasState)) {
// not rejected do ops...
const DisplayListData& data = op.renderNode->getDisplayListData();
deferImpl(data.getChunks(), data.getOps());
const DisplayList& displayList = op.renderNode->getDisplayList();
deferImpl(displayList.getChunks(), displayList.getOps());
}
mCanvasState.restore();
}

View File

@@ -63,7 +63,7 @@ public:
const std::vector< sp<RenderNode> >& nodes);
void defer(int viewportWidth, int viewportHeight,
const std::vector<DisplayListData::Chunk>& chunks, const std::vector<RecordedOp*>& ops);
const std::vector<DisplayList::Chunk>& chunks, const std::vector<RecordedOp*>& ops);
typedef std::function<void(void*, const RecordedOp&, const BakedOpState&)> BakedOpReceiver;
/**
@@ -92,7 +92,7 @@ public:
private:
BakedOpState* bakeOpState(const RecordedOp& recordedOp);
void deferImpl(const std::vector<DisplayListData::Chunk>& chunks,
void deferImpl(const std::vector<DisplayList::Chunk>& chunks,
const std::vector<RecordedOp*>& ops);
void replayBakedOpsImpl(void* arg, BakedOpReceiver* receivers);

View File

@@ -29,14 +29,14 @@ RecordingCanvas::RecordingCanvas(size_t width, size_t height)
}
RecordingCanvas::~RecordingCanvas() {
LOG_ALWAYS_FATAL_IF(mDisplayListData,
LOG_ALWAYS_FATAL_IF(mDisplayList,
"Destroyed a RecordingCanvas during a record!");
}
void RecordingCanvas::reset(int width, int height) {
LOG_ALWAYS_FATAL_IF(mDisplayListData,
LOG_ALWAYS_FATAL_IF(mDisplayList,
"prepareDirty called a second time during a recording!");
mDisplayListData = new DisplayListData();
mDisplayList = new DisplayList();
mState.initializeSaveStack(width, height, 0, 0, width, height, Vector3());
@@ -45,18 +45,18 @@ void RecordingCanvas::reset(int width, int height) {
mRestoreSaveCount = -1;
}
DisplayListData* RecordingCanvas::finishRecording() {
DisplayList* RecordingCanvas::finishRecording() {
mPaintMap.clear();
mRegionMap.clear();
mPathMap.clear();
DisplayListData* data = mDisplayListData;
mDisplayListData = nullptr;
DisplayList* displayList = mDisplayList;
mDisplayList = nullptr;
mSkiaCanvasProxy.reset(nullptr);
return data;
return displayList;
}
SkCanvas* RecordingCanvas::asSkCanvas() {
LOG_ALWAYS_FATAL_IF(!mDisplayListData,
LOG_ALWAYS_FATAL_IF(!mDisplayList,
"attempting to get an SkCanvas when we are not recording!");
if (!mSkiaCanvasProxy) {
mSkiaCanvasProxy.reset(new SkiaCanvasProxy(this));
@@ -187,7 +187,7 @@ void RecordingCanvas::drawRect(float left, float top, float right, float bottom,
void RecordingCanvas::drawSimpleRects(const float* rects, int vertexCount, const SkPaint* paint) {
if (rects == nullptr) return;
Vertex* rectData = (Vertex*) mDisplayListData->allocator.alloc(vertexCount * sizeof(Vertex));
Vertex* rectData = (Vertex*) mDisplayList->allocator.alloc(vertexCount * sizeof(Vertex));
Vertex* vertex = rectData;
float left = FLT_MAX;
@@ -345,36 +345,36 @@ void RecordingCanvas::drawRenderNode(RenderNode* renderNode) {
mState.getRenderTargetClipBounds(),
renderNode);
int opIndex = addOp(op);
int childIndex = mDisplayListData->addChild(op);
int childIndex = mDisplayList->addChild(op);
// update the chunk's child indices
DisplayListData::Chunk& chunk = mDisplayListData->chunks.back();
DisplayList::Chunk& chunk = mDisplayList->chunks.back();
chunk.endChildIndex = childIndex + 1;
if (renderNode->stagingProperties().isProjectionReceiver()) {
// use staging property, since recording on UI thread
mDisplayListData->projectionReceiveIndex = opIndex;
mDisplayList->projectionReceiveIndex = opIndex;
}
}
size_t RecordingCanvas::addOp(RecordedOp* op) {
// TODO: validate if "addDrawOp" quickrejection logic is useful before adding
int insertIndex = mDisplayListData->ops.size();
mDisplayListData->ops.push_back(op);
int insertIndex = mDisplayList->ops.size();
mDisplayList->ops.push_back(op);
if (mDeferredBarrierType != kBarrier_None) {
// op is first in new chunk
mDisplayListData->chunks.emplace_back();
DisplayListData::Chunk& newChunk = mDisplayListData->chunks.back();
mDisplayList->chunks.emplace_back();
DisplayList::Chunk& newChunk = mDisplayList->chunks.back();
newChunk.beginOpIndex = insertIndex;
newChunk.endOpIndex = insertIndex + 1;
newChunk.reorderChildren = (mDeferredBarrierType == kBarrier_OutOfOrder);
int nextChildIndex = mDisplayListData->children().size();
int nextChildIndex = mDisplayList->children().size();
newChunk.beginChildIndex = newChunk.endChildIndex = nextChildIndex;
mDeferredBarrierType = kBarrier_None;
} else {
// standard case - append to existing chunk
mDisplayListData->chunks.back().endOpIndex = insertIndex + 1;
mDisplayList->chunks.back().endOpIndex = insertIndex + 1;
}
return insertIndex;
}

View File

@@ -41,7 +41,7 @@ public:
virtual ~RecordingCanvas();
void reset(int width, int height);
__attribute__((warn_unused_result)) DisplayListData* finishRecording();
__attribute__((warn_unused_result)) DisplayList* finishRecording();
// ----------------------------------------------------------------------------
// MISC HWUI OPERATIONS - TODO: CATEGORIZE
@@ -187,7 +187,7 @@ private:
// ----------------------------------------------------------------------------
// lazy object copy
// ----------------------------------------------------------------------------
LinearAllocator& alloc() { return mDisplayListData->allocator; }
LinearAllocator& alloc() { return mDisplayList->allocator; }
void refBitmapsInShader(const SkShader* shader);
@@ -195,7 +195,7 @@ private:
inline const T* refBuffer(const T* srcBuffer, int32_t count) {
if (!srcBuffer) return nullptr;
T* dstBuffer = (T*) mDisplayListData->allocator.alloc(count * sizeof(T));
T* dstBuffer = (T*) mDisplayList->allocator.alloc(count * sizeof(T));
memcpy(dstBuffer, srcBuffer, count * sizeof(T));
return dstBuffer;
}
@@ -210,7 +210,7 @@ private:
// The points/verbs within the path are refcounted so this copy operation
// is inexpensive and maintains the generationID of the original path.
const SkPath* cachedPath = new SkPath(*path);
mDisplayListData->pathResources.push_back(cachedPath);
mDisplayList->pathResources.push_back(cachedPath);
return cachedPath;
}
@@ -234,7 +234,7 @@ private:
if (cachedPaint == nullptr || *cachedPaint != *paint) {
cachedPaint = new SkPaint(*paint);
std::unique_ptr<const SkPaint> copy(cachedPaint);
mDisplayListData->paints.push_back(std::move(copy));
mDisplayList->paints.push_back(std::move(copy));
// replaceValueFor() performs an add if the entry doesn't exist
mPaintMap.replaceValueFor(key, cachedPaint);
@@ -254,7 +254,7 @@ private:
if (cachedRegion == nullptr) {
std::unique_ptr<const SkRegion> copy(new SkRegion(*region));
cachedRegion = copy.get();
mDisplayListData->regions.push_back(std::move(copy));
mDisplayList->regions.push_back(std::move(copy));
// replaceValueFor() performs an add if the entry doesn't exist
mRegionMap.replaceValueFor(region, cachedRegion);
@@ -270,12 +270,12 @@ private:
// which doesn't seem worth the extra cycles for this unlikely case.
SkBitmap* localBitmap = new (alloc()) SkBitmap(bitmap);
alloc().autoDestroy(localBitmap);
mDisplayListData->bitmapResources.push_back(localBitmap);
mDisplayList->bitmapResources.push_back(localBitmap);
return localBitmap;
}
inline const Res_png_9patch* refPatch(const Res_png_9patch* patch) {
mDisplayListData->patchResources.push_back(patch);
mDisplayList->patchResources.push_back(patch);
mResourceCache.incrementRefcount(patch);
return patch;
}
@@ -288,7 +288,7 @@ private:
std::unique_ptr<SkiaCanvasProxy> mSkiaCanvasProxy;
ResourceCache& mResourceCache;
DeferredBarrierType mDeferredBarrierType = kBarrier_None;
DisplayListData* mDisplayListData = nullptr;
DisplayList* mDisplayList = nullptr;
bool mHighContrastText = false;
SkAutoTUnref<SkDrawFilter> mDrawFilter;
int mRestoreSaveCount = -1;

View File

@@ -48,8 +48,8 @@ void RenderNode::debugDumpLayers(const char* prefix) {
prefix, this, getName(), mLayer, mLayer->getFbo(),
mLayer->wasBuildLayered ? "true" : "false");
}
if (mDisplayListData) {
for (auto&& child : mDisplayListData->children()) {
if (mDisplayList) {
for (auto&& child : mDisplayList->children()) {
child->renderNode->debugDumpLayers(prefix);
}
}
@@ -57,17 +57,17 @@ void RenderNode::debugDumpLayers(const char* prefix) {
RenderNode::RenderNode()
: mDirtyPropertyFields(0)
, mNeedsDisplayListDataSync(false)
, mDisplayListData(nullptr)
, mStagingDisplayListData(nullptr)
, mNeedsDisplayListSync(false)
, mDisplayList(nullptr)
, mStagingDisplayList(nullptr)
, mAnimatorManager(*this)
, mLayer(nullptr)
, mParentCount(0) {
}
RenderNode::~RenderNode() {
deleteDisplayListData();
delete mStagingDisplayListData;
deleteDisplayList();
delete mStagingDisplayList;
if (mLayer) {
ALOGW("Memory Warning: Layer %p missed its detachment, held on to for far too long!", mLayer);
mLayer->postDecStrong();
@@ -75,10 +75,10 @@ RenderNode::~RenderNode() {
}
}
void RenderNode::setStagingDisplayList(DisplayListData* data) {
mNeedsDisplayListDataSync = true;
delete mStagingDisplayListData;
mStagingDisplayListData = data;
void RenderNode::setStagingDisplayList(DisplayList* displayList) {
mNeedsDisplayListSync = true;
delete mStagingDisplayList;
mStagingDisplayList = displayList;
}
/**
@@ -98,12 +98,12 @@ void RenderNode::output(uint32_t level) {
properties().debugOutputProperties(level);
if (mDisplayListData) {
if (mDisplayList) {
#if HWUI_NEW_OPS
LOG_ALWAYS_FATAL("op dumping unsupported");
#else
// TODO: consider printing the chunk boundaries here
for (auto&& op : mDisplayListData->getOps()) {
for (auto&& op : mDisplayList->getOps()) {
op->output(level, DisplayListOp::kOpLogFlag_Recurse);
}
#endif
@@ -177,8 +177,8 @@ void RenderNode::copyTo(proto::RenderNode *pnode) {
}
pnode->clear_children();
if (mDisplayListData) {
for (auto&& child : mDisplayListData->children()) {
if (mDisplayList) {
for (auto&& child : mDisplayList->children()) {
child->renderNode->copyTo(pnode->add_children());
}
}
@@ -186,11 +186,11 @@ void RenderNode::copyTo(proto::RenderNode *pnode) {
int RenderNode::getDebugSize() {
int size = sizeof(RenderNode);
if (mStagingDisplayListData) {
size += mStagingDisplayListData->getUsedSize();
if (mStagingDisplayList) {
size += mStagingDisplayList->getUsedSize();
}
if (mDisplayListData && mDisplayListData != mStagingDisplayListData) {
size += mDisplayListData->getUsedSize();
if (mDisplayList && mDisplayList != mStagingDisplayList) {
size += mDisplayList->getUsedSize();
}
return size;
}
@@ -321,10 +321,10 @@ void RenderNode::prepareTreeImpl(TreeInfo& info, bool functorsNeedLayer) {
}
bool willHaveFunctor = false;
if (info.mode == TreeInfo::MODE_FULL && mStagingDisplayListData) {
willHaveFunctor = !mStagingDisplayListData->functors.isEmpty();
} else if (mDisplayListData) {
willHaveFunctor = !mDisplayListData->functors.isEmpty();
if (info.mode == TreeInfo::MODE_FULL && mStagingDisplayList) {
willHaveFunctor = !mStagingDisplayList->functors.isEmpty();
} else if (mDisplayList) {
willHaveFunctor = !mDisplayList->functors.isEmpty();
}
bool childFunctorsNeedLayer = mProperties.prepareForFunctorPresence(
willHaveFunctor, functorsNeedLayer);
@@ -333,7 +333,7 @@ void RenderNode::prepareTreeImpl(TreeInfo& info, bool functorsNeedLayer) {
if (info.mode == TreeInfo::MODE_FULL) {
pushStagingDisplayListChanges(info);
}
prepareSubTree(info, childFunctorsNeedLayer, mDisplayListData);
prepareSubTree(info, childFunctorsNeedLayer, mDisplayList);
pushLayerUpdate(info);
info.damageAccumulator->popTransform();
@@ -378,24 +378,24 @@ void RenderNode::applyLayerPropertiesToLayer(TreeInfo& info) {
void RenderNode::syncDisplayList() {
// Make sure we inc first so that we don't fluctuate between 0 and 1,
// which would thrash the layer cache
if (mStagingDisplayListData) {
for (auto&& child : mStagingDisplayListData->children()) {
if (mStagingDisplayList) {
for (auto&& child : mStagingDisplayList->children()) {
child->renderNode->incParentRefCount();
}
}
deleteDisplayListData();
mDisplayListData = mStagingDisplayListData;
mStagingDisplayListData = nullptr;
if (mDisplayListData) {
for (size_t i = 0; i < mDisplayListData->functors.size(); i++) {
(*mDisplayListData->functors[i])(DrawGlInfo::kModeSync, nullptr);
deleteDisplayList();
mDisplayList = mStagingDisplayList;
mStagingDisplayList = nullptr;
if (mDisplayList) {
for (size_t i = 0; i < mDisplayList->functors.size(); i++) {
(*mDisplayList->functors[i])(DrawGlInfo::kModeSync, nullptr);
}
}
}
void RenderNode::pushStagingDisplayListChanges(TreeInfo& info) {
if (mNeedsDisplayListDataSync) {
mNeedsDisplayListDataSync = false;
if (mNeedsDisplayListSync) {
mNeedsDisplayListSync = false;
// Damage with the old display list first then the new one to catch any
// changes in isRenderable or, in the future, bounds
damageSelf(info);
@@ -404,17 +404,17 @@ void RenderNode::pushStagingDisplayListChanges(TreeInfo& info) {
}
}
void RenderNode::deleteDisplayListData() {
if (mDisplayListData) {
for (auto&& child : mDisplayListData->children()) {
void RenderNode::deleteDisplayList() {
if (mDisplayList) {
for (auto&& child : mDisplayList->children()) {
child->renderNode->decParentRefCount();
}
}
delete mDisplayListData;
mDisplayListData = nullptr;
delete mDisplayList;
mDisplayList = nullptr;
}
void RenderNode::prepareSubTree(TreeInfo& info, bool functorsNeedLayer, DisplayListData* subtree) {
void RenderNode::prepareSubTree(TreeInfo& info, bool functorsNeedLayer, DisplayList* subtree) {
if (subtree) {
TextureCache& cache = Caches::getInstance().textureCache;
info.out.hasFunctors |= subtree->functors.size();
@@ -444,14 +444,14 @@ void RenderNode::destroyHardwareResources() {
LayerRenderer::destroyLayer(mLayer);
mLayer = nullptr;
}
if (mDisplayListData) {
for (auto&& child : mDisplayListData->children()) {
if (mDisplayList) {
for (auto&& child : mDisplayList->children()) {
child->renderNode->destroyHardwareResources();
}
if (mNeedsDisplayListDataSync) {
if (mNeedsDisplayListSync) {
// Next prepare tree we are going to push a new display list, so we can
// drop our current one now
deleteDisplayListData();
deleteDisplayList();
}
}
}
@@ -633,9 +633,9 @@ void RenderNode::computeOrdering() {
// TODO: create temporary DDLOp and call computeOrderingImpl on top DisplayList so that
// transform properties are applied correctly to top level children
if (mDisplayListData == nullptr) return;
for (unsigned int i = 0; i < mDisplayListData->children().size(); i++) {
DrawRenderNodeOp* childOp = mDisplayListData->children()[i];
if (mDisplayList == nullptr) return;
for (unsigned int i = 0; i < mDisplayList->children().size(); i++) {
DrawRenderNodeOp* childOp = mDisplayList->children()[i];
childOp->renderNode->computeOrderingImpl(childOp, &mProjectedNodes, &mat4::identity());
}
#endif
@@ -647,7 +647,7 @@ void RenderNode::computeOrderingImpl(
const mat4* transformFromProjectionSurface) {
#if !HWUI_NEW_OPS
mProjectedNodes.clear();
if (mDisplayListData == nullptr || mDisplayListData->isEmpty()) return;
if (mDisplayList == nullptr || mDisplayList->isEmpty()) return;
// TODO: should avoid this calculation in most cases
// TODO: just calculate single matrix, down to all leaf composited elements
@@ -664,11 +664,11 @@ void RenderNode::computeOrderingImpl(
opState->mSkipInOrderDraw = false;
}
if (mDisplayListData->children().size() > 0) {
const bool isProjectionReceiver = mDisplayListData->projectionReceiveIndex >= 0;
if (mDisplayList->children().size() > 0) {
const bool isProjectionReceiver = mDisplayList->projectionReceiveIndex >= 0;
bool haveAppliedPropertiesToProjection = false;
for (unsigned int i = 0; i < mDisplayListData->children().size(); i++) {
DrawRenderNodeOp* childOp = mDisplayListData->children()[i];
for (unsigned int i = 0; i < mDisplayList->children().size(); i++) {
DrawRenderNodeOp* childOp = mDisplayList->children()[i];
RenderNode* child = childOp->renderNode;
std::vector<DrawRenderNodeOp*>* projectionChildren = nullptr;
@@ -750,13 +750,13 @@ void RenderNode::replay(ReplayStateStruct& replayStruct, const int level) {
issueOperations<ReplayOperationHandler>(replayStruct.mRenderer, handler);
}
void RenderNode::buildZSortedChildList(const DisplayListData::Chunk& chunk,
void RenderNode::buildZSortedChildList(const DisplayList::Chunk& chunk,
std::vector<ZDrawRenderNodeOpPair>& zTranslatedNodes) {
#if !HWUI_NEW_OPS
if (chunk.beginChildIndex == chunk.endChildIndex) return;
for (unsigned int i = chunk.beginChildIndex; i < chunk.endChildIndex; i++) {
DrawRenderNodeOp* childOp = mDisplayListData->children()[i];
DrawRenderNodeOp* childOp = mDisplayList->children()[i];
RenderNode* child = childOp->renderNode;
float childZ = child->properties().getZ();
@@ -924,7 +924,7 @@ void RenderNode::issueOperationsOfProjectedChildren(OpenGLRenderer& renderer, T&
nullptr;
LOG_ALWAYS_FATAL("unsupported");
#else
(mDisplayListData->getOps()[mDisplayListData->projectionReceiveIndex]);
(mDisplayList->getOps()[mDisplayList->projectionReceiveIndex]);
#endif
const DrawRenderNodeOp* backgroundOp = reinterpret_cast<const DrawRenderNodeOp*>(op);
const RenderProperties& backgroundProps = backgroundOp->renderNode->properties();
@@ -962,7 +962,7 @@ void RenderNode::issueOperationsOfProjectedChildren(OpenGLRenderer& renderer, T&
*/
template <class T>
void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) {
if (mDisplayListData->isEmpty()) {
if (mDisplayList->isEmpty()) {
DISPLAY_LIST_LOGD("%*sEmpty display list (%p, %s)", handler.level() * 2, "",
this, getName());
return;
@@ -1020,9 +1020,9 @@ void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) {
renderer.getSaveCount() - 1, properties().getClipToBounds());
} else {
const int saveCountOffset = renderer.getSaveCount() - 1;
const int projectionReceiveIndex = mDisplayListData->projectionReceiveIndex;
for (size_t chunkIndex = 0; chunkIndex < mDisplayListData->getChunks().size(); chunkIndex++) {
const DisplayListData::Chunk& chunk = mDisplayListData->getChunks()[chunkIndex];
const int projectionReceiveIndex = mDisplayList->projectionReceiveIndex;
for (size_t chunkIndex = 0; chunkIndex < mDisplayList->getChunks().size(); chunkIndex++) {
const DisplayList::Chunk& chunk = mDisplayList->getChunks()[chunkIndex];
std::vector<ZDrawRenderNodeOpPair> zTranslatedNodes;
buildZSortedChildList(chunk, zTranslatedNodes);
@@ -1031,7 +1031,7 @@ void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) {
initialTransform, zTranslatedNodes, renderer, handler);
for (size_t opIndex = chunk.beginOpIndex; opIndex < chunk.endOpIndex; opIndex++) {
DisplayListOp *op = mDisplayListData->getOps()[opIndex];
DisplayListOp *op = mDisplayList->getOps()[opIndex];
#if DEBUG_DISPLAY_LIST
op->output(handler.level() + 1);
#endif

View File

@@ -66,12 +66,12 @@ class RenderNode;
* 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 DisplayListCanvas (which manages the recording), DisplayListData
* functionality is split between DisplayListCanvas (which manages the recording), DisplayList
* (which holds the actual data), and DisplayList (which holds properties and performs playback onto
* a renderer).
*
* Note that DisplayListData is swapped out from beneath an individual DisplayList when a view's
* recorded stream of canvas operations is refreshed. The DisplayList (and its properties) stay
* Note that DisplayList is swapped out from beneath an individual RenderNode when a view's
* recorded stream of canvas operations is refreshed. The RenderNode (and its properties) stay
* attached.
*/
class RenderNode : public VirtualLightRefBase {
@@ -104,7 +104,7 @@ public:
void debugDumpLayers(const char* prefix);
ANDROID_API void setStagingDisplayList(DisplayListData* newData);
ANDROID_API void setStagingDisplayList(DisplayList* newData);
void computeOrdering();
@@ -116,11 +116,11 @@ public:
void copyTo(proto::RenderNode* node);
bool isRenderable() const {
return mDisplayListData && !mDisplayListData->isEmpty();
return mDisplayList && !mDisplayList->isEmpty();
}
bool hasProjectionReceiver() const {
return mDisplayListData && mDisplayListData->projectionReceiveIndex >= 0;
return mDisplayList && mDisplayList->projectionReceiveIndex >= 0;
}
const char* getName() const {
@@ -185,16 +185,16 @@ public:
bool nothingToDraw() const {
const Outline& outline = properties().getOutline();
return mDisplayListData == nullptr
return mDisplayList == nullptr
|| properties().getAlpha() <= 0
|| (outline.getShouldClip() && outline.isEmpty())
|| properties().getScaleX() == 0
|| properties().getScaleY() == 0;
}
// Only call if RenderNode has DisplayListData...
const DisplayListData& getDisplayListData() const {
return *mDisplayListData;
// Only call if RenderNode has DisplayList...
const DisplayList& getDisplayList() const {
return *mDisplayList;
}
private:
@@ -219,7 +219,7 @@ private:
template <class T>
inline void setViewProperties(OpenGLRenderer& renderer, T& handler);
void buildZSortedChildList(const DisplayListData::Chunk& chunk,
void buildZSortedChildList(const DisplayList::Chunk& chunk,
std::vector<ZDrawRenderNodeOpPair>& zTranslatedNodes);
template<class T>
@@ -261,11 +261,11 @@ private:
void prepareTreeImpl(TreeInfo& info, bool functorsNeedLayer);
void pushStagingPropertiesChanges(TreeInfo& info);
void pushStagingDisplayListChanges(TreeInfo& info);
void prepareSubTree(TreeInfo& info, bool functorsNeedLayer, DisplayListData* subtree);
void prepareSubTree(TreeInfo& info, bool functorsNeedLayer, DisplayList* subtree);
void applyLayerPropertiesToLayer(TreeInfo& info);
void prepareLayer(TreeInfo& info, uint32_t dirtyMask);
void pushLayerUpdate(TreeInfo& info);
void deleteDisplayListData();
void deleteDisplayList();
void damageSelf(TreeInfo& info);
void incParentRefCount() { mParentCount++; }
@@ -277,10 +277,10 @@ private:
RenderProperties mProperties;
RenderProperties mStagingProperties;
bool mNeedsDisplayListDataSync;
// WARNING: Do not delete this directly, you must go through deleteDisplayListData()!
DisplayListData* mDisplayListData;
DisplayListData* mStagingDisplayListData;
bool mNeedsDisplayListSync;
// WARNING: Do not delete this directly, you must go through deleteDisplayList()!
DisplayList* mDisplayList;
DisplayList* mStagingDisplayList;
friend class AnimatorManager;
AnimatorManager mAnimatorManager;
@@ -301,7 +301,7 @@ private:
// When this hits 0 we are no longer in the tree, so any hardware resources
// (specifically Layers) should be released.
// This is *NOT* thread-safe, and should therefore only be tracking
// mDisplayListData, not mStagingDisplayListData.
// mDisplayList, not mStagingDisplayList.
uint32_t mParentCount;
}; // class RenderNode

View File

@@ -33,24 +33,24 @@ typedef RecordingCanvas TestCanvas;
typedef DisplayListCanvas TestCanvas;
#endif
BENCHMARK_NO_ARG(BM_DisplayListData_alloc);
void BM_DisplayListData_alloc::Run(int iters) {
BENCHMARK_NO_ARG(BM_DisplayList_alloc);
void BM_DisplayList_alloc::Run(int iters) {
StartBenchmarkTiming();
for (int i = 0; i < iters; ++i) {
auto data = new DisplayListData();
MicroBench::DoNotOptimize(data);
delete data;
auto displayList = new DisplayList();
MicroBench::DoNotOptimize(displayList);
delete displayList;
}
StopBenchmarkTiming();
}
BENCHMARK_NO_ARG(BM_DisplayListData_alloc_theoretical);
void BM_DisplayListData_alloc_theoretical::Run(int iters) {
BENCHMARK_NO_ARG(BM_DisplayList_alloc_theoretical);
void BM_DisplayList_alloc_theoretical::Run(int iters) {
StartBenchmarkTiming();
for (int i = 0; i < iters; ++i) {
auto data = new char[sizeof(DisplayListData)];
MicroBench::DoNotOptimize(data);
delete[] data;
auto displayList = new char[sizeof(DisplayList)];
MicroBench::DoNotOptimize(displayList);
delete[] displayList;
}
StopBenchmarkTiming();
}

View File

@@ -32,7 +32,7 @@ namespace android {
namespace uirenderer {
class DeferredLayerUpdater;
class DisplayListData;
class DisplayList;
class RenderNode;
namespace renderthread {
@@ -48,7 +48,7 @@ enum SyncResult {
/*
* This is a special Super Task. It is re-used multiple times by RenderProxy,
* and contains state (such as layer updaters & new DisplayListDatas) that is
* and contains state (such as layer updaters & new DisplayLists) that is
* tracked across many frames not just a single frame.
* It is the sync-state task, and will kick off the post-sync draw
*/

View File

@@ -38,7 +38,7 @@ namespace uirenderer {
class DeferredLayerUpdater;
class RenderNode;
class DisplayListData;
class DisplayList;
class Layer;
class Rect;

View File

@@ -49,7 +49,7 @@ public:
static void endFrame(Info& info) {}
};
TEST(OpReorderer, simple) {
auto dld = TestUtils::createDLD<RecordingCanvas>(100, 200, [](RecordingCanvas& canvas) {
auto dld = TestUtils::createDisplayList<RecordingCanvas>(100, 200, [](RecordingCanvas& canvas) {
SkBitmap bitmap = TestUtils::createSkBitmap(25, 25);
canvas.drawRect(0, 0, 100, 200, SkPaint());
canvas.drawBitmap(bitmap, 10, 10, nullptr);
@@ -78,7 +78,7 @@ public:
static void endFrame(Info& info) {}
};
TEST(OpReorderer, simpleBatching) {
auto dld = TestUtils::createDLD<RecordingCanvas>(200, 200, [](RecordingCanvas& canvas) {
auto dld = TestUtils::createDisplayList<RecordingCanvas>(200, 200, [](RecordingCanvas& canvas) {
SkBitmap bitmap = TestUtils::createSkBitmap(10, 10);
// Alternate between drawing rects and bitmaps, with bitmaps overlapping rects.

View File

@@ -23,9 +23,9 @@
namespace android {
namespace uirenderer {
static void playbackOps(const std::vector<DisplayListData::Chunk>& chunks,
static void playbackOps(const std::vector<DisplayList::Chunk>& chunks,
const std::vector<RecordedOp*>& ops, std::function<void(const RecordedOp&)> opReciever) {
for (const DisplayListData::Chunk& chunk : chunks) {
for (const DisplayList::Chunk& chunk : chunks) {
for (size_t opIndex = chunk.beginOpIndex; opIndex < chunk.endOpIndex; opIndex++) {
opReciever(*ops[opIndex]);
}
@@ -33,7 +33,7 @@ static void playbackOps(const std::vector<DisplayListData::Chunk>& chunks,
}
TEST(RecordingCanvas, emptyPlayback) {
auto dld = TestUtils::createDLD<RecordingCanvas>(100, 200, [](RecordingCanvas& canvas) {
auto dld = TestUtils::createDisplayList<RecordingCanvas>(100, 200, [](RecordingCanvas& canvas) {
canvas.save(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag);
canvas.restore();
});
@@ -41,7 +41,7 @@ TEST(RecordingCanvas, emptyPlayback) {
}
TEST(RecordingCanvas, testSimpleRectRecord) {
auto dld = TestUtils::createDLD<RecordingCanvas>(100, 200, [](RecordingCanvas& canvas) {
auto dld = TestUtils::createDisplayList<RecordingCanvas>(100, 200, [](RecordingCanvas& canvas) {
canvas.drawRect(10, 20, 90, 180, SkPaint());
});
@@ -56,7 +56,7 @@ TEST(RecordingCanvas, testSimpleRectRecord) {
}
TEST(RecordingCanvas, backgroundAndImage) {
auto dld = TestUtils::createDLD<RecordingCanvas>(100, 200, [](RecordingCanvas& canvas) {
auto dld = TestUtils::createDisplayList<RecordingCanvas>(100, 200, [](RecordingCanvas& canvas) {
SkBitmap bitmap;
bitmap.setInfo(SkImageInfo::MakeUnknown(25, 25));
SkPaint paint;

View File

@@ -53,11 +53,11 @@ public:
}
template<class CanvasType>
static std::unique_ptr<DisplayListData> createDLD(int width, int height,
static std::unique_ptr<DisplayList> createDisplayList(int width, int height,
std::function<void(CanvasType& canvas)> canvasCallback) {
CanvasType canvas(width, height);
canvasCallback(canvas);
return std::unique_ptr<DisplayListData>(canvas.finishRecording());
return std::unique_ptr<DisplayList>(canvas.finishRecording());
}
template<class CanvasType>