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>
diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp
index 48a8319..fb15014 100644
--- a/src/core/SkRasterPipelineBlitter.cpp
+++ b/src/core/SkRasterPipelineBlitter.cpp
@@ -55,11 +55,6 @@
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 @@
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 @@
}
if (!fBlitRect) {
- // TODO: fold into build_blit_pipeline?
SkRasterPipeline p(fAlloc);
p.extend(fColorPipeline);
if (fBlend == SkBlendMode::kSrcOver
@@ -378,9 +349,20 @@
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 @@
// 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);