Loading libs/hwui/BakedOpState.h +6 −8 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 = new (allocator) BakedOpState( BakedOpState* bakedState = allocator.create_trivial<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 = new (allocator) BakedOpState( BakedOpState* bakedState = allocator.create_trivial<BakedOpState>( allocator, snapshot, recordedOp, expandForStroke); if (bakedState->computedState.clippedBounds.isEmpty()) { // bounds are empty, so op is rejected Loading @@ -140,16 +140,12 @@ public: if (CC_UNLIKELY(snapshot.getRenderTargetClip().isEmpty())) return nullptr; // clip isn't empty, so construct the op return new (allocator) BakedOpState(allocator, snapshot, shadowOpPtr); return allocator.create_trivial<BakedOpState>(allocator, snapshot, shadowOpPtr); } static BakedOpState* directConstruct(LinearAllocator& allocator, const ClipRect* clip, const Rect& dstRect, const RecordedOp& recordedOp) { return new (allocator) BakedOpState(clip, dstRect, recordedOp); } static void* operator new(size_t size, LinearAllocator& allocator) { return allocator.alloc(size); return allocator.create_trivial<BakedOpState>(clip, dstRect, recordedOp); } // computed state: Loading @@ -162,6 +158,8 @@ 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 = (DirtyStack*) mAllocator.alloc(sizeof(DirtyStack)); mHead = mAllocator.create_trivial<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 = (DirtyStack*) mAllocator.alloc(sizeof(DirtyStack)); DirtyStack* nextFrame = mAllocator.create_trivial<DirtyStack>(); nextFrame->next = nullptr; nextFrame->prev = mHead; mHead->next = nextFrame; Loading libs/hwui/DeferredDisplayList.h +1 −6 Original line number Diff line number Diff line Loading @@ -49,11 +49,6 @@ 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 @@ -124,7 +119,7 @@ private: DeferredDisplayList(const DeferredDisplayList& other); // disallow copy DeferredDisplayState* createState() { return new (mAllocator) DeferredDisplayState(); return mAllocator.create_trivial<DeferredDisplayState>(); } void tryRecycleState(DeferredDisplayState* state) { Loading libs/hwui/DisplayListCanvas.h +2 −3 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(count * sizeof(T)); T* dstBuffer = (T*) mDisplayList->allocator.alloc<T>(count * sizeof(T)); memcpy(dstBuffer, srcBuffer, count * sizeof(T)); return dstBuffer; } Loading Loading @@ -320,8 +320,7 @@ 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 = new (alloc()) SkBitmap(bitmap); alloc().autoDestroy(localBitmap); SkBitmap* localBitmap = alloc().create<SkBitmap>(bitmap); mDisplayList->bitmapResources.push_back(localBitmap); return localBitmap; } Loading libs/hwui/DisplayListOp.h +3 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,9 @@ 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) { return allocator.alloc(size); // 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); } enum OpLogFlag { Loading Loading
libs/hwui/BakedOpState.h +6 −8 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 = new (allocator) BakedOpState( BakedOpState* bakedState = allocator.create_trivial<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 = new (allocator) BakedOpState( BakedOpState* bakedState = allocator.create_trivial<BakedOpState>( allocator, snapshot, recordedOp, expandForStroke); if (bakedState->computedState.clippedBounds.isEmpty()) { // bounds are empty, so op is rejected Loading @@ -140,16 +140,12 @@ public: if (CC_UNLIKELY(snapshot.getRenderTargetClip().isEmpty())) return nullptr; // clip isn't empty, so construct the op return new (allocator) BakedOpState(allocator, snapshot, shadowOpPtr); return allocator.create_trivial<BakedOpState>(allocator, snapshot, shadowOpPtr); } static BakedOpState* directConstruct(LinearAllocator& allocator, const ClipRect* clip, const Rect& dstRect, const RecordedOp& recordedOp) { return new (allocator) BakedOpState(clip, dstRect, recordedOp); } static void* operator new(size_t size, LinearAllocator& allocator) { return allocator.alloc(size); return allocator.create_trivial<BakedOpState>(clip, dstRect, recordedOp); } // computed state: Loading @@ -162,6 +158,8 @@ 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 = (DirtyStack*) mAllocator.alloc(sizeof(DirtyStack)); mHead = mAllocator.create_trivial<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 = (DirtyStack*) mAllocator.alloc(sizeof(DirtyStack)); DirtyStack* nextFrame = mAllocator.create_trivial<DirtyStack>(); nextFrame->next = nullptr; nextFrame->prev = mHead; mHead->next = nextFrame; Loading
libs/hwui/DeferredDisplayList.h +1 −6 Original line number Diff line number Diff line Loading @@ -49,11 +49,6 @@ 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 @@ -124,7 +119,7 @@ private: DeferredDisplayList(const DeferredDisplayList& other); // disallow copy DeferredDisplayState* createState() { return new (mAllocator) DeferredDisplayState(); return mAllocator.create_trivial<DeferredDisplayState>(); } void tryRecycleState(DeferredDisplayState* state) { Loading
libs/hwui/DisplayListCanvas.h +2 −3 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(count * sizeof(T)); T* dstBuffer = (T*) mDisplayList->allocator.alloc<T>(count * sizeof(T)); memcpy(dstBuffer, srcBuffer, count * sizeof(T)); return dstBuffer; } Loading Loading @@ -320,8 +320,7 @@ 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 = new (alloc()) SkBitmap(bitmap); alloc().autoDestroy(localBitmap); SkBitmap* localBitmap = alloc().create<SkBitmap>(bitmap); mDisplayList->bitmapResources.push_back(localBitmap); return localBitmap; } Loading
libs/hwui/DisplayListOp.h +3 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,9 @@ 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) { return allocator.alloc(size); // 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); } enum OpLogFlag { Loading