SkRasterPipeline in SkArenaAlloc
Bug: skia:6673
Change-Id: Ia2bae4f6a9039a007a10b6b45bcf2f0854bf6e5c
Reviewed-on: https://skia-review.googlesource.com/17794
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp
index 82a202b..e5c5325 100644
--- a/src/core/SkRasterPipelineBlitter.cpp
+++ b/src/core/SkRasterPipelineBlitter.cpp
@@ -34,6 +34,7 @@
: fDst(dst)
, fBlend(blend)
, fAlloc(alloc)
+ , fColorPipeline(alloc)
{}
void blitH (int x, int y, int w) override;
@@ -100,8 +101,8 @@
const SkMatrix& ctm) {
auto paintColor = alloc->make<SkPM4f>(SkPM4f_from_SkColor(paint.getColor(),
dst.colorSpace()));
+ SkRasterPipeline_<256> shaderPipeline;
if (auto shader = paint.getShader()) {
- SkRasterPipeline shaderPipeline;
if (!shader->appendStages(&shaderPipeline, dst.colorSpace(), alloc, ctm, paint)) {
// When a shader fails to append stages, it means it has vetoed drawing entirely.
return alloc->make<SkNullBlitter>();
@@ -118,7 +119,6 @@
return Create(dst, paint, alloc, shaderPipeline, is_opaque, is_constant, wants_dither);
}
- SkRasterPipeline shaderPipeline;
shaderPipeline.append(SkRasterPipeline::constant_color, paintColor);
bool is_opaque = paintColor->a() == 1.0f,
is_constant = true,
@@ -173,7 +173,7 @@
auto constantColor = alloc->make<SkPM4f>();
colorPipeline->append(SkRasterPipeline::store_f32, &constantColor);
colorPipeline->run(0,1);
- *colorPipeline = SkRasterPipeline();
+ colorPipeline->reset();
colorPipeline->append(SkRasterPipeline::constant_color, constantColor);
is_opaque = constantColor->a() == 1.0f;
@@ -189,7 +189,7 @@
if (is_constant && blitter->fBlend == SkBlendMode::kSrc) {
// Run our color pipeline all the way through to produce what we'd memset when we can.
// Not all blits can memset, so we need to keep colorPipeline too.
- SkRasterPipeline p;
+ SkRasterPipeline_<256> p;
p.extend(*colorPipeline);
blitter->fDstPtr = &blitter->fMemsetColor;
blitter->append_store(&p);
@@ -268,7 +268,7 @@
}
if (!fBlitH) {
- SkRasterPipeline p;
+ SkRasterPipeline p(fAlloc);
p.extend(fColorPipeline);
if (fBlend != SkBlendMode::kSrc) {
this->append_load_d(&p);
@@ -276,14 +276,14 @@
this->maybe_clamp(&p);
}
this->append_store(&p);
- fBlitH = p.compile(fAlloc);
+ fBlitH = p.compile();
}
fBlitH(x,w);
}
void SkRasterPipelineBlitter::blitAntiH(int x, int y, const SkAlpha aa[], const int16_t runs[]) {
if (!fBlitAntiH) {
- SkRasterPipeline p;
+ SkRasterPipeline p(fAlloc);
p.extend(fColorPipeline);
if (fBlend == SkBlendMode::kSrcOver) {
p.append(SkRasterPipeline::scale_1_float, &fCurrentCoverage);
@@ -296,7 +296,7 @@
}
this->maybe_clamp(&p);
this->append_store(&p);
- fBlitAntiH = p.compile(fAlloc);
+ fBlitAntiH = p.compile();
}
fDstPtr = fDst.writable_addr(0,y);
@@ -322,7 +322,7 @@
}
if (mask.fFormat == SkMask::kA8_Format && !fBlitMaskA8) {
- SkRasterPipeline p;
+ SkRasterPipeline p(fAlloc);
p.extend(fColorPipeline);
if (fBlend == SkBlendMode::kSrcOver) {
p.append(SkRasterPipeline::scale_u8, &fMaskPtr);
@@ -335,18 +335,18 @@
}
this->maybe_clamp(&p);
this->append_store(&p);
- fBlitMaskA8 = p.compile(fAlloc);
+ fBlitMaskA8 = p.compile();
}
if (mask.fFormat == SkMask::kLCD16_Format && !fBlitMaskLCD16) {
- SkRasterPipeline p;
+ SkRasterPipeline p(fAlloc);
p.extend(fColorPipeline);
this->append_load_d(&p);
this->append_blend(&p);
p.append(SkRasterPipeline::lerp_565, &fMaskPtr);
this->maybe_clamp(&p);
this->append_store(&p);
- fBlitMaskLCD16 = p.compile(fAlloc);
+ fBlitMaskLCD16 = p.compile();
}
int x = clip.left();