Chromium Code Reviews| Index: src/core/SkLinearBitmapPipeline.h |
| diff --git a/src/core/SkLinearBitmapPipeline.h b/src/core/SkLinearBitmapPipeline.h |
| index 91b573df5d8c5a95de93ff3b31a5c82741633c57..aa80b9c51774cafbea90e6398b688a37a7ac2b83 100644 |
| --- a/src/core/SkLinearBitmapPipeline.h |
| +++ b/src/core/SkLinearBitmapPipeline.h |
| @@ -78,17 +78,17 @@ public: |
| // the pipeline on a new sampler. |
| Base* cloneStageTo(Next* next, Stage* cloneToStage) const; |
| - Base* get() const { return reinterpret_cast<Base*>(&fSpace); } |
| + Base* get() const { return reinterpret_cast<Base*>(fSpace); } |
| Base* operator->() const { return this->get(); } |
| Base& operator*() const { return *(this->get()); } |
| private: |
| std::function<void (Next*, void*)> fStageCloner; |
| - struct SK_STRUCT_ALIGN(16) Space { |
| - char space[kSize]; |
| - }; |
| - bool fIsInitialized; |
| - mutable Space fSpace; |
| + // This could be implemented using std::aligned_storage, but MSVC does not implement this. Use the |
|
mtklein_C
2016/11/03 20:47:36
This code is clearer and less reinterpret_cast-y t
|
| + // work around from: |
| + // https://connect.microsoft.com/VisualStudio/feedback/details/1559873/std-aligned-storage-cannot-align-type-with-16-byte |
| + mutable alignas(16) char fSpace[kSize]; |
| + bool fIsInitialized; |
| }; |
| /////////////////////////////////////////////////////////////////////////////////////////////////// |
| @@ -111,16 +111,13 @@ public: |
| fIsInitialized = true; |
| } |
| - Base* get() const { return reinterpret_cast<Base*>(&fSpace); } |
| + Base* get() const { return reinterpret_cast<Base*>(fSpace); } |
| Base* operator->() const { return this->get(); } |
| Base& operator*() const { return *(this->get()); } |
| private: |
| - struct SK_STRUCT_ALIGN(16) Space { |
| - char space[kSize]; |
| - }; |
| - mutable Space fSpace; |
| - bool fIsInitialized; |
| + mutable alignas(16) char fSpace[kSize]; |
| + bool fIsInitialized; |
| }; |
| @@ -134,7 +131,7 @@ public: |
| using MatrixStage = Stage<PointProcessorInterface, 160, PointProcessorInterface>; |
| using TileStage = Stage<PointProcessorInterface, 160, SampleProcessorInterface>; |
| using SampleStage = Stage<SampleProcessorInterface, 160, BlendProcessorInterface>; |
| - using BlenderStage = Stage<BlendProcessorInterface, 40>; |
| + using BlenderStage = Stage<BlendProcessorInterface, 48>; |
| using Accessor = PolyMemory<PixelAccessorInterface, 64>; |
| private: |