Loading libs/hwui/DisplayList.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -44,13 +44,14 @@ void DisplayList::outputLogBuffer(int fd) { } DisplayList::DisplayList(const DisplayListRenderer& recorder) : mTransformMatrix(NULL), mTransformCamera(NULL), mTransformMatrix3D(NULL), mDestroyed(false), mTransformMatrix(NULL), mTransformCamera(NULL), mTransformMatrix3D(NULL), mStaticMatrix(NULL), mAnimationMatrix(NULL) { initFromDisplayListRenderer(recorder); } DisplayList::~DisplayList() { mDestroyed = true; clearResources(); } Loading @@ -63,7 +64,6 @@ void DisplayList::destroyDisplayListDeferred(DisplayList* displayList) { void DisplayList::clearResources() { mDisplayListData = NULL; mSize = 0; // TODO: shouldn't be needed, WAR possible use after delete mClipRectOp = NULL; mSaveLayerOp = NULL; Loading Loading @@ -169,6 +169,10 @@ void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorde mSaveLayerOp = new (alloc) SaveLayerOp(); mSaveOp = new (alloc) SaveOp(); mRestoreToCountOp = new (alloc) RestoreToCountOp(); if (CC_UNLIKELY(!mSaveOp)) { // temporary debug logging ALOGW("Error: %s's SaveOp not allocated, size %d", getName(), mSize); CRASH(); } mFunctorCount = recorder.getFunctorCount(); Loading Loading @@ -480,7 +484,11 @@ void DisplayList::replay(ReplayStateStruct& replayStruct, const int level) { */ template <class T> void DisplayList::iterate(OpenGLRenderer& renderer, T& handler, const int level) { if (mSize == 0 || mAlpha <= 0 || CC_UNLIKELY(!mSaveOp)) { // TODO: shouldn't need mSaveOp check if (CC_UNLIKELY(mDestroyed)) { // temporary debug logging ALOGW("Error: %s is drawing after destruction, size %d", getName(), mSize); CRASH(); } if (mSize == 0 || mAlpha <= 0) { DISPLAY_LIST_LOGD("%*sEmpty display list (%p, %s)", level * 2, "", this, mName.string()); return; } Loading libs/hwui/DisplayList.h +5 −4 Original line number Diff line number Diff line Loading @@ -501,6 +501,7 @@ private: uint32_t mFunctorCount; String8 mName; bool mDestroyed; // used for debugging crash, TODO: remove once invalid state crash fixed // View properties bool mClipToBounds; Loading Loading @@ -530,11 +531,11 @@ private: * an alpha causes a SaveLayerAlpha to occur). These operations point into mDisplayListData's * allocation, or null if uninitialized. * * These are initialized (via friend constructors) when a displayList is issued in either replay * or deferred mode. If replaying, the ops are not used until the next frame. If deferring, the * ops may be stored in the DeferredDisplayList to be played back a second time. * These are initialized (via friend re-constructors) when a displayList is issued in either * replay or deferred mode. If replaying, the ops are not used until the next frame. If * deferring, the ops may be stored in the DeferredDisplayList to be played back a second time. * * They should be used at most once per frame (one call to iterate) * They should be used at most once per frame (one call to 'iterate') to avoid overwriting data */ ClipRectOp* mClipRectOp; SaveLayerOp* mSaveLayerOp; Loading Loading
libs/hwui/DisplayList.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -44,13 +44,14 @@ void DisplayList::outputLogBuffer(int fd) { } DisplayList::DisplayList(const DisplayListRenderer& recorder) : mTransformMatrix(NULL), mTransformCamera(NULL), mTransformMatrix3D(NULL), mDestroyed(false), mTransformMatrix(NULL), mTransformCamera(NULL), mTransformMatrix3D(NULL), mStaticMatrix(NULL), mAnimationMatrix(NULL) { initFromDisplayListRenderer(recorder); } DisplayList::~DisplayList() { mDestroyed = true; clearResources(); } Loading @@ -63,7 +64,6 @@ void DisplayList::destroyDisplayListDeferred(DisplayList* displayList) { void DisplayList::clearResources() { mDisplayListData = NULL; mSize = 0; // TODO: shouldn't be needed, WAR possible use after delete mClipRectOp = NULL; mSaveLayerOp = NULL; Loading Loading @@ -169,6 +169,10 @@ void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorde mSaveLayerOp = new (alloc) SaveLayerOp(); mSaveOp = new (alloc) SaveOp(); mRestoreToCountOp = new (alloc) RestoreToCountOp(); if (CC_UNLIKELY(!mSaveOp)) { // temporary debug logging ALOGW("Error: %s's SaveOp not allocated, size %d", getName(), mSize); CRASH(); } mFunctorCount = recorder.getFunctorCount(); Loading Loading @@ -480,7 +484,11 @@ void DisplayList::replay(ReplayStateStruct& replayStruct, const int level) { */ template <class T> void DisplayList::iterate(OpenGLRenderer& renderer, T& handler, const int level) { if (mSize == 0 || mAlpha <= 0 || CC_UNLIKELY(!mSaveOp)) { // TODO: shouldn't need mSaveOp check if (CC_UNLIKELY(mDestroyed)) { // temporary debug logging ALOGW("Error: %s is drawing after destruction, size %d", getName(), mSize); CRASH(); } if (mSize == 0 || mAlpha <= 0) { DISPLAY_LIST_LOGD("%*sEmpty display list (%p, %s)", level * 2, "", this, mName.string()); return; } Loading
libs/hwui/DisplayList.h +5 −4 Original line number Diff line number Diff line Loading @@ -501,6 +501,7 @@ private: uint32_t mFunctorCount; String8 mName; bool mDestroyed; // used for debugging crash, TODO: remove once invalid state crash fixed // View properties bool mClipToBounds; Loading Loading @@ -530,11 +531,11 @@ private: * an alpha causes a SaveLayerAlpha to occur). These operations point into mDisplayListData's * allocation, or null if uninitialized. * * These are initialized (via friend constructors) when a displayList is issued in either replay * or deferred mode. If replaying, the ops are not used until the next frame. If deferring, the * ops may be stored in the DeferredDisplayList to be played back a second time. * These are initialized (via friend re-constructors) when a displayList is issued in either * replay or deferred mode. If replaying, the ops are not used until the next frame. If * deferring, the ops may be stored in the DeferredDisplayList to be played back a second time. * * They should be used at most once per frame (one call to iterate) * They should be used at most once per frame (one call to 'iterate') to avoid overwriting data */ ClipRectOp* mClipRectOp; SaveLayerOp* mSaveLayerOp; Loading