| Index: src/core/SkLinearBitmapPipeline.h
|
| diff --git a/src/core/SkLinearBitmapPipeline.h b/src/core/SkLinearBitmapPipeline.h
|
| index 853e56fd1b2f9b4d4439085eaa36fad01d4f7774..dce537aa6e6aa90f27f52667e468ee27a712a91a 100644
|
| --- a/src/core/SkLinearBitmapPipeline.h
|
| +++ b/src/core/SkLinearBitmapPipeline.h
|
| @@ -13,6 +13,13 @@
|
| #include "SkMatrix.h"
|
| #include "SkShader.h"
|
|
|
| +class SkEmbeddableLinearPipeline;
|
| +
|
| +///////////////////////////////////////////////////////////////////////////////////////////////////
|
| +// SkLinearBitmapPipeline - encapsulates all the machinery for doing floating point pixel
|
| +// processing in a linear color space.
|
| +// Note: this class has unusual alignment requirements due to its use of SIMD instructions. The
|
| +// class SkEmbeddableLinearPipeline below manages these requirements.
|
| class SkLinearBitmapPipeline {
|
| public:
|
| SkLinearBitmapPipeline(
|
| @@ -22,10 +29,14 @@ public:
|
| SkColor paintColor,
|
| const SkPixmap& srcPixmap);
|
|
|
| -
|
| + SkLinearBitmapPipeline(
|
| + const SkLinearBitmapPipeline& pipeline,
|
| + const SkPixmap& srcPixmap,
|
| + SkXfermode::Mode xferMode,
|
| + const SkImageInfo& dstInfo);
|
|
|
| static bool ClonePipelineForBlitting(
|
| - void* blitterStorage,
|
| + SkEmbeddableLinearPipeline* pipelineStorage,
|
| const SkLinearBitmapPipeline& pipeline,
|
| SkMatrix::TypeMask matrixMask,
|
| SkShader::TileMode xTileMode,
|
| @@ -87,12 +98,6 @@ public:
|
| using BlenderStage = Stage<BlendProcessorInterface, 40>;
|
|
|
| private:
|
| - SkLinearBitmapPipeline(
|
| - const SkLinearBitmapPipeline& pipeline,
|
| - const SkPixmap& srcPixmap,
|
| - SkXfermode::Mode xferMode,
|
| - const SkImageInfo& dstInfo);
|
| -
|
| PointProcessorInterface* fFirstStage;
|
| MatrixStage fMatrixStage;
|
| TileStage fTileStage;
|
| @@ -101,4 +106,35 @@ private:
|
| DestinationInterface* fLastStage;
|
| };
|
|
|
| +////////////////////////////////////////////////////////////////////////////////////////////////////
|
| +// SkEmbeddableLinearPipeline - manage stricter alignment needs for SkLinearBitmapPipeline.
|
| +class SkEmbeddableLinearPipeline {
|
| +public:
|
| + SkEmbeddableLinearPipeline() { }
|
| + ~SkEmbeddableLinearPipeline() {
|
| + if (get() != nullptr) {
|
| + 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)...};
|
| + }
|
| +
|
| + SkLinearBitmapPipeline* get() const { return fPipeline; }
|
| + 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};
|
| +};
|
| +
|
| #endif // SkLinearBitmapPipeline_DEFINED
|
|
|