Index: src/core/SkLinearBitmapPipeline.h |
diff --git a/src/core/SkLinearBitmapPipeline.h b/src/core/SkLinearBitmapPipeline.h |
index 3abdb8014aa134503d7694c7c9ba25705572d42e..776f8d86039ca65e9d1629bcc03d1d69da025f69 100644 |
--- a/src/core/SkLinearBitmapPipeline.h |
+++ b/src/core/SkLinearBitmapPipeline.h |
@@ -84,7 +84,7 @@ public: |
private: |
std::function<void (Next*, void*)> fStageCloner; |
- alignas(16) mutable char fSpace[kSize]; |
+ mutable char fSpace[kSize]; |
bool fIsInitialized; |
}; |
@@ -113,8 +113,8 @@ public: |
Base& operator*() const { return *(this->get()); } |
private: |
- alignas(16) mutable char fSpace[kSize]; |
- bool fIsInitialized; |
+ mutable char fSpace[kSize]; |
+ bool fIsInitialized; |
}; |
@@ -125,8 +125,8 @@ public: |
class PixelAccessorInterface; |
// These values were generated by the assert above in Stage::init{Sink|Stage}. |
- using MatrixStage = Stage<PointProcessorInterface, 160, PointProcessorInterface>; |
- using TileStage = Stage<PointProcessorInterface, 160, SampleProcessorInterface>; |
+ using MatrixStage = Stage<PointProcessorInterface, 56, PointProcessorInterface>; |
+ using TileStage = Stage<PointProcessorInterface, 48, SampleProcessorInterface>; |
using SampleStage = Stage<SampleProcessorInterface, 160, BlendProcessorInterface>; |
using BlenderStage = Stage<BlendProcessorInterface, 48>; |
using Accessor = PolyMemory<PixelAccessorInterface, 64>; |
@@ -147,29 +147,26 @@ class SkEmbeddableLinearPipeline { |
public: |
SkEmbeddableLinearPipeline() { } |
~SkEmbeddableLinearPipeline() { |
- if (get() != nullptr) { |
+ if (fInitialized) { |
get()->~SkLinearBitmapPipeline(); |
} |
} |
template <typename... Args> |
void init(Args&&... args) { |
- // Ensure that our pipeline is created at a 16 byte aligned address. |
- fPipeline = (SkLinearBitmapPipeline*)SkAlign16((intptr_t)fPipelineStorage); |
- new (fPipeline) SkLinearBitmapPipeline{std::forward<Args>(args)...}; |
+ new (fPipelineStorage) SkLinearBitmapPipeline{std::forward<Args>(args)...}; |
+ fInitialized = true; |
} |
- SkLinearBitmapPipeline* get() const { return fPipeline; } |
+ SkLinearBitmapPipeline* get() const { |
+ return reinterpret_cast<SkLinearBitmapPipeline*>(fPipelineStorage); |
+ } |
SkLinearBitmapPipeline& operator*() const { return *this->get(); } |
SkLinearBitmapPipeline* operator->() const { return this->get(); } |
private: |
- enum { |
- kActualSize = sizeof(SkLinearBitmapPipeline), |
- kPaddedSize = SkAlignPtr(kActualSize + 12), |
- }; |
- void* fPipelineStorage[kPaddedSize / sizeof(void*)]; |
- SkLinearBitmapPipeline* fPipeline{nullptr}; |
+ alignas(SkLinearBitmapPipeline) mutable char fPipelineStorage[sizeof(SkLinearBitmapPipeline)]; |
+ bool fInitialized {false}; |
}; |
#endif // SkLinearBitmapPipeline_DEFINED |