Use typedefs to differentiate between flavors of DisplayLists

Change-Id: Id3b0a5aa045f2343fb046ca0889b375a7d00e03f
This commit is contained in:
Chris Craik
2015-10-15 10:55:15 -07:00
parent 2eb4ca6114
commit 10ed692118
4 changed files with 38 additions and 34 deletions

View File

@@ -67,13 +67,8 @@ void DisplayListData::cleanupResources() {
regions.clear();
}
#if HWUI_NEW_OPS
size_t DisplayListData::addChild(RenderNodeOp* op) {
size_t DisplayListData::addChild(NodeOpType* op) {
mReferenceHolders.push_back(op->renderNode);
#else
size_t DisplayListData::addChild(DrawRenderNodeOp* op) {
mReferenceHolders.push_back(op->renderNode);
#endif
size_t index = mChildren.size();
mChildren.push_back(op);
return index;

View File

@@ -58,8 +58,14 @@ class Layer;
#if HWUI_NEW_OPS
struct RecordedOp;
struct RenderNodeOp;
typedef RecordedOp BaseOpType;
typedef RenderNodeOp NodeOpType;
#else
class DrawRenderNodeOp;
typedef DisplayListOp BaseOpType;
typedef DrawRenderNodeOp NodeOpType;
#endif
/**
@@ -143,19 +149,12 @@ public:
const std::vector<Chunk>& getChunks() const {
return chunks;
}
#if HWUI_NEW_OPS
const std::vector<RecordedOp*>& getOps() const {
const std::vector<BaseOpType*>& getOps() const {
return ops;
}
#endif
#if HWUI_NEW_OPS
size_t addChild(RenderNodeOp* childOp);
const std::vector<RenderNodeOp*>& children() { return mChildren; }
#else
size_t addChild(DrawRenderNodeOp* childOp);
const std::vector<DrawRenderNodeOp*>& children() { return mChildren; }
#endif
size_t addChild(NodeOpType* childOp);
const std::vector<NodeOpType*>& children() { return mChildren; }
void ref(VirtualLightRefBase* prop) {
mReferenceHolders.push_back(prop);
@@ -169,18 +168,12 @@ public:
}
private:
#if HWUI_NEW_OPS
std::vector<RecordedOp*> ops;
#endif
std::vector<BaseOpType*> ops;
std::vector< sp<VirtualLightRefBase> > mReferenceHolders;
#if HWUI_NEW_OPS
std::vector<RenderNodeOp*> mChildren;
#else
// list of children display lists for quick, non-drawing traversal
std::vector<DrawRenderNodeOp*> mChildren;
#endif
std::vector<NodeOpType*> mChildren;
std::vector<Chunk> chunks;

View File

@@ -514,8 +514,12 @@ void DisplayListCanvas::flushTranslate() {
}
size_t DisplayListCanvas::addOpAndUpdateChunk(DisplayListOp* op) {
int insertIndex = mDisplayListData->displayListOps.size();
mDisplayListData->displayListOps.push_back(op);
int insertIndex = mDisplayListData->ops.size();
#if HWUI_NEW_OPS
LOG_ALWAYS_FATAL("unsupported");
#else
mDisplayListData->ops.push_back(op);
#endif
if (mDeferredBarrierType != kBarrier_None) {
// op is first in new chunk
mDisplayListData->chunks.emplace_back();

View File

@@ -49,8 +49,8 @@ void RenderNode::debugDumpLayers(const char* prefix) {
mLayer->wasBuildLayered ? "true" : "false");
}
if (mDisplayListData) {
for (size_t i = 0; i < mDisplayListData->children().size(); i++) {
mDisplayListData->children()[i]->renderNode->debugDumpLayers(prefix);
for (auto&& child : mDisplayListData->children()) {
child->renderNode->debugDumpLayers(prefix);
}
}
}
@@ -97,12 +97,16 @@ void RenderNode::output(uint32_t level) {
SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag);
properties().debugOutputProperties(level);
int flags = DisplayListOp::kOpLogFlag_Recurse;
if (mDisplayListData) {
#if HWUI_NEW_OPS
LOG_ALWAYS_FATAL("op dumping unsupported");
#else
// TODO: consider printing the chunk boundaries here
for (unsigned int i = 0; i < mDisplayListData->displayListOps.size(); i++) {
mDisplayListData->displayListOps[i]->output(level, flags);
for (auto&& op : mDisplayListData->getOps()) {
op->output(level, DisplayListOp::kOpLogFlag_Recurse);
}
#endif
}
ALOGD("%*sDone (%p, %s)", (level - 1) * 2, "", this, getName());
@@ -916,7 +920,12 @@ void RenderNode::issueOperationsOfProjectedChildren(OpenGLRenderer& renderer, T&
// Transform renderer to match background we're projecting onto
// (by offsetting canvas by translationX/Y of background rendernode, since only those are set)
const DisplayListOp* op =
(mDisplayListData->displayListOps[mDisplayListData->projectionReceiveIndex]);
#if HWUI_NEW_OPS
nullptr;
LOG_ALWAYS_FATAL("unsupported");
#else
(mDisplayListData->getOps()[mDisplayListData->projectionReceiveIndex]);
#endif
const DrawRenderNodeOp* backgroundOp = reinterpret_cast<const DrawRenderNodeOp*>(op);
const RenderProperties& backgroundProps = backgroundOp->renderNode->properties();
renderer.translate(backgroundProps.getTranslationX(), backgroundProps.getTranslationY());
@@ -997,6 +1006,9 @@ void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) {
setViewProperties<T>(renderer, handler);
}
#if HWUI_NEW_OPS
LOG_ALWAYS_FATAL("legacy op traversal not supported");
#else
bool quickRejected = properties().getClipToBounds()
&& renderer.quickRejectConservative(0, 0, properties().getWidth(), properties().getHeight());
if (!quickRejected) {
@@ -1018,9 +1030,8 @@ void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) {
issueOperationsOf3dChildren(ChildrenSelectMode::NegativeZChildren,
initialTransform, zTranslatedNodes, renderer, handler);
for (size_t opIndex = chunk.beginOpIndex; opIndex < chunk.endOpIndex; opIndex++) {
DisplayListOp *op = mDisplayListData->displayListOps[opIndex];
DisplayListOp *op = mDisplayListData->getOps()[opIndex];
#if DEBUG_DISPLAY_LIST
op->output(handler.level() + 1);
#endif
@@ -1037,6 +1048,7 @@ void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) {
}
}
}
#endif
DISPLAY_LIST_LOGD("%*sRestoreToCount %d", (handler.level() + 1) * 2, "", restoreTo);
handler(new (alloc) RestoreToCountOp(restoreTo),