Loading libs/hwui/BakedOpState.h +8 −6 Original line number Diff line number Diff line Loading @@ -100,7 +100,7 @@ public: static BakedOpState* tryConstruct(LinearAllocator& allocator, Snapshot& snapshot, const RecordedOp& recordedOp) { if (CC_UNLIKELY(snapshot.getRenderTargetClip().isEmpty())) return nullptr; BakedOpState* bakedState = allocator.create_trivial<BakedOpState>( BakedOpState* bakedState = new (allocator) BakedOpState( allocator, snapshot, recordedOp, false); if (bakedState->computedState.clippedBounds.isEmpty()) { // bounds are empty, so op is rejected Loading @@ -124,7 +124,7 @@ public: ? (recordedOp.paint && recordedOp.paint->getStyle() != SkPaint::kFill_Style) : true; BakedOpState* bakedState = allocator.create_trivial<BakedOpState>( BakedOpState* bakedState = new (allocator) BakedOpState( allocator, snapshot, recordedOp, expandForStroke); if (bakedState->computedState.clippedBounds.isEmpty()) { // bounds are empty, so op is rejected Loading @@ -140,12 +140,16 @@ public: if (CC_UNLIKELY(snapshot.getRenderTargetClip().isEmpty())) return nullptr; // clip isn't empty, so construct the op return allocator.create_trivial<BakedOpState>(allocator, snapshot, shadowOpPtr); return new (allocator) BakedOpState(allocator, snapshot, shadowOpPtr); } static BakedOpState* directConstruct(LinearAllocator& allocator, const ClipRect* clip, const Rect& dstRect, const RecordedOp& recordedOp) { return allocator.create_trivial<BakedOpState>(clip, dstRect, recordedOp); return new (allocator) BakedOpState(clip, dstRect, recordedOp); } static void* operator new(size_t size, LinearAllocator& allocator) { return allocator.alloc(size); } // computed state: Loading @@ -158,8 +162,6 @@ public: const RecordedOp* op; private: friend class LinearAllocator; BakedOpState(LinearAllocator& allocator, Snapshot& snapshot, const RecordedOp& recordedOp, bool expandForStroke) : computedState(allocator, snapshot, recordedOp, expandForStroke) Loading libs/hwui/DamageAccumulator.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ struct DirtyStack { }; DamageAccumulator::DamageAccumulator() { mHead = mAllocator.create_trivial<DirtyStack>(); mHead = (DirtyStack*) mAllocator.alloc(sizeof(DirtyStack)); memset(mHead, 0, sizeof(DirtyStack)); // Create a root that we will not pop off mHead->prev = mHead; Loading Loading @@ -78,7 +78,7 @@ void DamageAccumulator::computeCurrentTransform(Matrix4* outMatrix) const { void DamageAccumulator::pushCommon() { if (!mHead->next) { DirtyStack* nextFrame = mAllocator.create_trivial<DirtyStack>(); DirtyStack* nextFrame = (DirtyStack*) mAllocator.alloc(sizeof(DirtyStack)); nextFrame->next = nullptr; nextFrame->prev = mHead; mHead->next = nextFrame; Loading libs/hwui/DeferredDisplayList.h +4 −1 Original line number Diff line number Diff line Loading @@ -50,6 +50,9 @@ typedef const void* mergeid_t; class DeferredDisplayState { public: static void* operator new(size_t size) = delete; static void* operator new(size_t size, LinearAllocator& allocator) { return allocator.alloc(size); } // global op bounds, mapped by mMatrix to be in screen space coordinates, clipped Rect mBounds; Loading Loading @@ -121,7 +124,7 @@ private: DeferredDisplayList(const DeferredDisplayList& other); // disallow copy DeferredDisplayState* createState() { return mAllocator.create_trivial<DeferredDisplayState>(); return new (mAllocator) DeferredDisplayState(); } void tryRecycleState(DeferredDisplayState* state) { Loading libs/hwui/DisplayListCanvas.h +3 −2 Original line number Diff line number Diff line Loading @@ -251,7 +251,7 @@ private: inline const T* refBuffer(const T* srcBuffer, int32_t count) { if (!srcBuffer) return nullptr; T* dstBuffer = (T*) mDisplayList->allocator.alloc<T>(count * sizeof(T)); T* dstBuffer = (T*) mDisplayList->allocator.alloc(count * sizeof(T)); memcpy(dstBuffer, srcBuffer, count * sizeof(T)); return dstBuffer; } Loading Loading @@ -320,7 +320,8 @@ private: // correctly, such as creating the bitmap from scratch, drawing with it, changing its // contents, and drawing again. The only fix would be to always copy it the first time, // which doesn't seem worth the extra cycles for this unlikely case. SkBitmap* localBitmap = alloc().create<SkBitmap>(bitmap); SkBitmap* localBitmap = new (alloc()) SkBitmap(bitmap); alloc().autoDestroy(localBitmap); mDisplayList->bitmapResources.push_back(localBitmap); return localBitmap; } Loading libs/hwui/DisplayListOp.h +1 −3 Original line number Diff line number Diff line Loading @@ -64,9 +64,7 @@ public: static void operator delete(void* ptr) { LOG_ALWAYS_FATAL("delete not supported"); } static void* operator new(size_t size) = delete; /** PURPOSELY OMITTED **/ static void* operator new(size_t size, LinearAllocator& allocator) { // FIXME: Quick hack to keep old pipeline working, delete this when // we no longer need to support HWUI_NEWOPS := false return allocator.alloc<char>(size); return allocator.alloc(size); } enum OpLogFlag { Loading Loading
libs/hwui/BakedOpState.h +8 −6 Original line number Diff line number Diff line Loading @@ -100,7 +100,7 @@ public: static BakedOpState* tryConstruct(LinearAllocator& allocator, Snapshot& snapshot, const RecordedOp& recordedOp) { if (CC_UNLIKELY(snapshot.getRenderTargetClip().isEmpty())) return nullptr; BakedOpState* bakedState = allocator.create_trivial<BakedOpState>( BakedOpState* bakedState = new (allocator) BakedOpState( allocator, snapshot, recordedOp, false); if (bakedState->computedState.clippedBounds.isEmpty()) { // bounds are empty, so op is rejected Loading @@ -124,7 +124,7 @@ public: ? (recordedOp.paint && recordedOp.paint->getStyle() != SkPaint::kFill_Style) : true; BakedOpState* bakedState = allocator.create_trivial<BakedOpState>( BakedOpState* bakedState = new (allocator) BakedOpState( allocator, snapshot, recordedOp, expandForStroke); if (bakedState->computedState.clippedBounds.isEmpty()) { // bounds are empty, so op is rejected Loading @@ -140,12 +140,16 @@ public: if (CC_UNLIKELY(snapshot.getRenderTargetClip().isEmpty())) return nullptr; // clip isn't empty, so construct the op return allocator.create_trivial<BakedOpState>(allocator, snapshot, shadowOpPtr); return new (allocator) BakedOpState(allocator, snapshot, shadowOpPtr); } static BakedOpState* directConstruct(LinearAllocator& allocator, const ClipRect* clip, const Rect& dstRect, const RecordedOp& recordedOp) { return allocator.create_trivial<BakedOpState>(clip, dstRect, recordedOp); return new (allocator) BakedOpState(clip, dstRect, recordedOp); } static void* operator new(size_t size, LinearAllocator& allocator) { return allocator.alloc(size); } // computed state: Loading @@ -158,8 +162,6 @@ public: const RecordedOp* op; private: friend class LinearAllocator; BakedOpState(LinearAllocator& allocator, Snapshot& snapshot, const RecordedOp& recordedOp, bool expandForStroke) : computedState(allocator, snapshot, recordedOp, expandForStroke) Loading
libs/hwui/DamageAccumulator.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ struct DirtyStack { }; DamageAccumulator::DamageAccumulator() { mHead = mAllocator.create_trivial<DirtyStack>(); mHead = (DirtyStack*) mAllocator.alloc(sizeof(DirtyStack)); memset(mHead, 0, sizeof(DirtyStack)); // Create a root that we will not pop off mHead->prev = mHead; Loading Loading @@ -78,7 +78,7 @@ void DamageAccumulator::computeCurrentTransform(Matrix4* outMatrix) const { void DamageAccumulator::pushCommon() { if (!mHead->next) { DirtyStack* nextFrame = mAllocator.create_trivial<DirtyStack>(); DirtyStack* nextFrame = (DirtyStack*) mAllocator.alloc(sizeof(DirtyStack)); nextFrame->next = nullptr; nextFrame->prev = mHead; mHead->next = nextFrame; Loading
libs/hwui/DeferredDisplayList.h +4 −1 Original line number Diff line number Diff line Loading @@ -50,6 +50,9 @@ typedef const void* mergeid_t; class DeferredDisplayState { public: static void* operator new(size_t size) = delete; static void* operator new(size_t size, LinearAllocator& allocator) { return allocator.alloc(size); } // global op bounds, mapped by mMatrix to be in screen space coordinates, clipped Rect mBounds; Loading Loading @@ -121,7 +124,7 @@ private: DeferredDisplayList(const DeferredDisplayList& other); // disallow copy DeferredDisplayState* createState() { return mAllocator.create_trivial<DeferredDisplayState>(); return new (mAllocator) DeferredDisplayState(); } void tryRecycleState(DeferredDisplayState* state) { Loading
libs/hwui/DisplayListCanvas.h +3 −2 Original line number Diff line number Diff line Loading @@ -251,7 +251,7 @@ private: inline const T* refBuffer(const T* srcBuffer, int32_t count) { if (!srcBuffer) return nullptr; T* dstBuffer = (T*) mDisplayList->allocator.alloc<T>(count * sizeof(T)); T* dstBuffer = (T*) mDisplayList->allocator.alloc(count * sizeof(T)); memcpy(dstBuffer, srcBuffer, count * sizeof(T)); return dstBuffer; } Loading Loading @@ -320,7 +320,8 @@ private: // correctly, such as creating the bitmap from scratch, drawing with it, changing its // contents, and drawing again. The only fix would be to always copy it the first time, // which doesn't seem worth the extra cycles for this unlikely case. SkBitmap* localBitmap = alloc().create<SkBitmap>(bitmap); SkBitmap* localBitmap = new (alloc()) SkBitmap(bitmap); alloc().autoDestroy(localBitmap); mDisplayList->bitmapResources.push_back(localBitmap); return localBitmap; } Loading
libs/hwui/DisplayListOp.h +1 −3 Original line number Diff line number Diff line Loading @@ -64,9 +64,7 @@ public: static void operator delete(void* ptr) { LOG_ALWAYS_FATAL("delete not supported"); } static void* operator new(size_t size) = delete; /** PURPOSELY OMITTED **/ static void* operator new(size_t size, LinearAllocator& allocator) { // FIXME: Quick hack to keep old pipeline working, delete this when // we no longer need to support HWUI_NEWOPS := false return allocator.alloc<char>(size); return allocator.alloc(size); } enum OpLogFlag { Loading