aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkConvertPixels.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-06-01 13:11:16 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-01 18:08:25 +0000
commit9b10f8ff0d163d5d076e7028a1a173f9c1f3b714 (patch)
treebeec177f1320b93b8a4d48afe929a7c510f31963 /src/core/SkConvertPixels.cpp
parent97b10ac4847fba563834911f35235aaf0299d0c8 (diff)
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>
Diffstat (limited to 'src/core/SkConvertPixels.cpp')
-rw-r--r--src/core/SkConvertPixels.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/core/SkConvertPixels.cpp b/src/core/SkConvertPixels.cpp
index 2ada61f14e..b3a6a06974 100644
--- a/src/core/SkConvertPixels.cpp
+++ b/src/core/SkConvertPixels.cpp
@@ -359,17 +359,16 @@ static void convert_with_pipeline(const SkImageInfo& dstInfo, void* dstRow, size
SkASSERT(premulState == dat || kOpaque_SkAlphaType == srcInfo.alphaType());
// We'll dither if we're decreasing precision below 32-bit.
- int y;
- SkJumper_DitherCtx dither = {&y, 0.0f};
+ float dither_rate = 0.0f;
if (srcInfo.bytesPerPixel() > dstInfo.bytesPerPixel()) {
switch (dstInfo.colorType()) {
- case kRGB_565_SkColorType: dither.rate = 1/63.0f; break;
- case kARGB_4444_SkColorType: dither.rate = 1/15.0f; break;
- default: dither.rate = 0.0f; break;
+ case kRGB_565_SkColorType: dither_rate = 1/63.0f; break;
+ case kARGB_4444_SkColorType: dither_rate = 1/15.0f; break;
+ default: dither_rate = 0.0f; break;
}
}
- if (dither.rate > 0) {
- pipeline.append(SkRasterPipeline::dither, &dither);
+ if (dither_rate > 0) {
+ pipeline.append(SkRasterPipeline::dither, &dither_rate);
}
switch (dstInfo.colorType()) {
@@ -395,8 +394,7 @@ static void convert_with_pipeline(const SkImageInfo& dstInfo, void* dstRow, size
}
auto run = pipeline.compile();
- // This y is declared above when handling dither (which needs to know y).
- for (y = 0; y < srcInfo.height(); ++y) {
+ for (int y = 0; y < srcInfo.height(); ++y) {
run(0,y, srcInfo.width());
// The pipeline has pointers to srcRow and dstRow, so we just need to update them in the
// loop to move between rows of src/dst.