diff options
author | 2017-08-23 20:36:02 +0000 | |
---|---|---|
committer | 2017-08-23 20:38:27 +0000 | |
commit | c3a863f1cfab0b58353612f9aeac40f0c4d62515 (patch) | |
tree | d70692bde0883681475a620e6cd9d11ef9ae6371 /src/core/SkRasterPipelineBlitter.cpp | |
parent | e46c8d08075010f1f35cec7263bd9d31b0820854 (diff) |
Revert "Consolidate SkRasterPipelineBlitter blendmode construction"
This reverts commit 19bf2b3a645c9e4129ee72e26541c4edea708393.
Reason for revert: not going to cover all cases
Original change's description:
> Consolidate SkRasterPipelineBlitter blendmode construction
>
> Only blitAntiH & blitMask/kA8 for now, but hopefully we can extend for
> blitRect & blitMask/kLCD16 also.
>
> Change-Id: I5e888d49c0c11f2f1fc595dbfb382044fc224edc
> Reviewed-on: https://skia-review.googlesource.com/37542
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Florin Malita <fmalita@chromium.org>
TBR=mtklein@google.com,fmalita@chromium.org
Change-Id: Ibd007bbc76f1bf8ec34998cc6ccb6b842792034c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/37860
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/core/SkRasterPipelineBlitter.cpp')
-rw-r--r-- | src/core/SkRasterPipelineBlitter.cpp | 64 |
1 files changed, 28 insertions, 36 deletions
diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp index 48a8319a75..fb15014a85 100644 --- a/src/core/SkRasterPipelineBlitter.cpp +++ b/src/core/SkRasterPipelineBlitter.cpp @@ -55,11 +55,6 @@ private: void maybe_clamp (SkRasterPipeline*) const; void append_store (SkRasterPipeline*) const; - std::function<void(size_t, size_t, size_t, size_t)> - build_blit_pipeline(SkRasterPipeline::StockStage scaleStage, - SkRasterPipeline::StockStage lerpStage, - void* ctx) const; - // If we have an burst context, use it to fill our shader buffer. void burst_shade(int x, int y, int w); @@ -301,29 +296,6 @@ void SkRasterPipelineBlitter::burst_shade(int x, int y, int w) { fShaderOutput = SkJumper_MemoryCtx{ fShaderBuffer.data() - x, 0 }; } -std::function<void(size_t, size_t, size_t, size_t)> -SkRasterPipelineBlitter::build_blit_pipeline(SkRasterPipeline::StockStage scale, - SkRasterPipeline::StockStage lerp, - void* ctx) const { - SkRasterPipeline p(fAlloc); - p.extend(fColorPipeline); - - const bool preScale = fBlend == SkBlendMode::kSrcOver; - - if (preScale) { - p.append(scale, ctx); - } - this->append_load_d(&p); - this->append_blend(&p); - if (!preScale) { - p.append(lerp, ctx); - } - this->maybe_clamp(&p); - this->append_store(&p); - - return p.compile(); -} - void SkRasterPipelineBlitter::blitH(int x, int y, int w) { this->blitRect(x,y,w,1); } @@ -343,7 +315,6 @@ void SkRasterPipelineBlitter::blitRect(int x, int y, int w, int h) { } if (!fBlitRect) { - // TODO: fold into build_blit_pipeline? SkRasterPipeline p(fAlloc); p.extend(fColorPipeline); if (fBlend == SkBlendMode::kSrcOver @@ -378,9 +349,20 @@ void SkRasterPipelineBlitter::blitRect(int x, int y, int w, int h) { void SkRasterPipelineBlitter::blitAntiH(int x, int y, const SkAlpha aa[], const int16_t runs[]) { if (!fBlitAntiH) { - fBlitAntiH = this->build_blit_pipeline(SkRasterPipeline::scale_1_float, - SkRasterPipeline::lerp_1_float, - &fCurrentCoverage); + SkRasterPipeline p(fAlloc); + p.extend(fColorPipeline); + if (fBlend == SkBlendMode::kSrcOver) { + p.append(SkRasterPipeline::scale_1_float, &fCurrentCoverage); + this->append_load_d(&p); + this->append_blend(&p); + } else { + this->append_load_d(&p); + this->append_blend(&p); + p.append(SkRasterPipeline::lerp_1_float, &fCurrentCoverage); + } + this->maybe_clamp(&p); + this->append_store(&p); + fBlitAntiH = p.compile(); } for (int16_t run = *runs; run > 0; run = *runs) { @@ -421,12 +403,22 @@ void SkRasterPipelineBlitter::blitMask(const SkMask& mask, const SkIRect& clip) // Lazily build whichever pipeline we need, specialized for each mask format. if (mask.fFormat == SkMask::kA8_Format && !fBlitMaskA8) { - fBlitMaskA8 = this->build_blit_pipeline(SkRasterPipeline::scale_u8, - SkRasterPipeline::lerp_u8, - &fMaskPtr); + SkRasterPipeline p(fAlloc); + p.extend(fColorPipeline); + if (fBlend == SkBlendMode::kSrcOver) { + p.append(SkRasterPipeline::scale_u8, &fMaskPtr); + this->append_load_d(&p); + this->append_blend(&p); + } else { + this->append_load_d(&p); + this->append_blend(&p); + p.append(SkRasterPipeline::lerp_u8, &fMaskPtr); + } + this->maybe_clamp(&p); + this->append_store(&p); + fBlitMaskA8 = p.compile(); } if (mask.fFormat == SkMask::kLCD16_Format && !fBlitMaskLCD16) { - // TODO: add prescale stage, fold into build_bllit_pipeline? SkRasterPipeline p(fAlloc); p.extend(fColorPipeline); this->append_load_d(&p); |