plumb y through to SkJumper
There'll still be a little more refactoring after this, but this is the
main thing we want to do.
This makes y available in a general-purpose register in pipeline stages,
just like x. Stages that need y (seed_shader and dither) can just use
it rather than pulling it off a context pointer. seed_shader loses its
context pointer, and dither's gets simpler.
Change-Id: Ic2d1e13b03fb45b73e308b38aafbb3a14c29cf7f
Reviewed-on: https://skia-review.googlesource.com/18383
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp
index 2f28eec..59fb172 100644
--- a/src/core/SkRasterPipelineBlitter.cpp
+++ b/src/core/SkRasterPipelineBlitter.cpp
@@ -78,8 +78,7 @@
void* fDstPtr = nullptr;
const void* fMaskPtr = nullptr;
float fCurrentCoverage = 0.0f;
- int fCurrentY = 0;
- SkJumper_DitherCtx fDitherCtx = { &fCurrentY, 0.0f };
+ float fDitherRate = 0.0f;
std::vector<SkPM4f> fShaderBuffer;
@@ -180,7 +179,7 @@
} else {
// If the shader's not constant, it'll need seeding with x,y.
if (!is_constant) {
- colorPipeline->append(SkRasterPipeline::seed_shader, &blitter->fCurrentY);
+ colorPipeline->append(SkRasterPipeline::seed_shader);
}
colorPipeline->extend(shaderPipeline);
}
@@ -197,13 +196,13 @@
if (wants_dither ||
(paint.isDither() && dst.info().colorType() == kRGB_565_SkColorType)) {
switch (dst.info().colorType()) {
- default: blitter->fDitherCtx.rate = 0.0f; break;
- case kRGB_565_SkColorType: blitter->fDitherCtx.rate = 1/63.0f; break;
+ default: blitter->fDitherRate = 0.0f; break;
+ case kRGB_565_SkColorType: blitter->fDitherRate = 1/63.0f; break;
case kRGBA_8888_SkColorType:
- case kBGRA_8888_SkColorType: blitter->fDitherCtx.rate = 1/255.0f; break;
+ case kBGRA_8888_SkColorType: blitter->fDitherRate = 1/255.0f; break;
}
}
- is_constant = is_constant && (blitter->fDitherCtx.rate == 0.0f);
+ is_constant = is_constant && (blitter->fDitherRate == 0.0f);
// We're logically done here. The code between here and return blitter is all optimization.
@@ -263,10 +262,10 @@
if (fDst.info().gammaCloseToSRGB()) {
p->append(SkRasterPipeline::to_srgb);
}
- if (fDitherCtx.rate > 0.0f) {
+ if (fDitherRate > 0.0f) {
// We dither after any sRGB transfer function to make sure our 1/255.0f is sensible
// over the whole range. If we did it before, 1/255.0f is too big a rate near zero.
- p->append(SkRasterPipeline::dither, &fDitherCtx);
+ p->append(SkRasterPipeline::dither, &fDitherRate);
}
if (fDst.info().colorType() == kBGRA_8888_SkColorType) {
@@ -305,7 +304,6 @@
void SkRasterPipelineBlitter::blitH(int x, int y, int w) {
fDstPtr = fDst.writable_addr(0,y);
- fCurrentY = y;
if (fCanMemsetInBlitH) {
switch (fDst.shiftPerPixel()) {
@@ -323,7 +321,7 @@
if (fBlend == SkBlendMode::kSrcOver
&& fDst.info().colorType() == kRGBA_8888_SkColorType
&& !fDst.colorSpace()
- && fDitherCtx.rate == 0.0f) {
+ && fDitherRate == 0.0f) {
p.append(SkRasterPipeline::srcover_rgba_8888, &fDstPtr);
} else {
if (fBlend != SkBlendMode::kSrc) {
@@ -358,7 +356,6 @@
}
fDstPtr = fDst.writable_addr(0,y);
- fCurrentY = y;
for (int16_t run = *runs; run > 0; run = *runs) {
switch (*aa) {
case 0x00: break;
@@ -411,7 +408,6 @@
int x = clip.left();
for (int y = clip.top(); y < clip.bottom(); y++) {
fDstPtr = fDst.writable_addr(0,y);
- fCurrentY = y;
this->maybe_shade(x,y,clip.width());
switch (mask.fFormat) {