diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkRasterPipeline.cpp | 11 | ||||
-rw-r--r-- | src/core/SkRasterPipeline.h | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/core/SkRasterPipeline.cpp b/src/core/SkRasterPipeline.cpp index 45d081bec5..6f5ae8c435 100644 --- a/src/core/SkRasterPipeline.cpp +++ b/src/core/SkRasterPipeline.cpp @@ -82,3 +82,14 @@ void SkRasterPipeline::append_from_srgb_dst(SkAlphaType at) { this->append(SkRasterPipeline::clamp_a_dst); } } + +void SkRasterPipeline::append_matrix(SkArenaAlloc* alloc, const SkMatrix& matrix) { + float* storage = alloc->makeArray<float>(9); + // TODO: consider adding special stages for scale+translate and possibly just translate. + if (matrix.asAffine(storage)) { + this->append(SkRasterPipeline::matrix_2x3, storage); + } else { + matrix.get9(storage); + this->append(SkRasterPipeline::matrix_perspective, storage); + } +} diff --git a/src/core/SkRasterPipeline.h b/src/core/SkRasterPipeline.h index a4175c65a8..9a467a5024 100644 --- a/src/core/SkRasterPipeline.h +++ b/src/core/SkRasterPipeline.h @@ -127,6 +127,10 @@ public: void append_from_srgb(SkAlphaType); void append_from_srgb_dst(SkAlphaType); + // Appends a stage for the specified matrix. Tries to optimize the stage by analyzing + // the type of matrix. + void append_matrix(SkArenaAlloc*, const SkMatrix&); + bool empty() const { return fStages == nullptr; } private: |