aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2016-12-06 11:31:25 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-06 17:10:47 +0000
commit886cf53447a7f78a80476742d50424a5d45c3108 (patch)
treed425ae8e59747f2ff65994f5fc62a2c28d47f354 /src/image
parent0ce4f230eb2e95523557bf6c6a195f51bc88163f (diff)
Refactor bilerp a little.
1) rename to bilerp_xy, for x,y in {n[egative], p[ositive}; 2) pull out a save_xy stage to save off the original x,y; 3) also calculate the fractional x,y fx,fy once instead of 4 times. 1) is a pure refactor; 2) adds a stage but otherwise is nothing different; 3) changes images a little bit (fractional parts can vary a bit around powers of two). This extends naturally to naive bicubic using 16 bicubic_xy stages. CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I666de5c21e978abb4feb6e3225e5b5920ba6c5b9 Reviewed-on: https://skia-review.googlesource.com/5550 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'src/image')
-rw-r--r--src/image/SkImageShader.cpp26
-rw-r--r--src/image/SkImageShaderContext.h2
2 files changed, 12 insertions, 16 deletions
diff --git a/src/image/SkImageShader.cpp b/src/image/SkImageShader.cpp
index d2ddc95744..719bced4f5 100644
--- a/src/image/SkImageShader.cpp
+++ b/src/image/SkImageShader.cpp
@@ -358,26 +358,20 @@ bool SkImageShader::onAppendStages(SkRasterPipeline* p, SkColorSpace* dst, SkFal
}
};
- if (quality == kNone_SkFilterQuality) {
- append_tiling_and_gather();
-
- } else {
- p->append(SkRasterPipeline::top_left, ctx);
- append_tiling_and_gather();
- p->append(SkRasterPipeline::accumulate, ctx);
-
- p->append(SkRasterPipeline::top_right, ctx);
- append_tiling_and_gather();
- p->append(SkRasterPipeline::accumulate, ctx);
-
- p->append(SkRasterPipeline::bottom_left, ctx);
+ auto sample = [&](SkRasterPipeline::StockStage sampler) {
+ p->append(sampler, ctx);
append_tiling_and_gather();
p->append(SkRasterPipeline::accumulate, ctx);
+ };
- p->append(SkRasterPipeline::bottom_right, ctx);
+ if (quality == kNone_SkFilterQuality) {
append_tiling_and_gather();
- p->append(SkRasterPipeline::accumulate, ctx);
-
+ } else {
+ p->append(SkRasterPipeline::save_xy, ctx);
+ sample(SkRasterPipeline::bilinear_nn);
+ sample(SkRasterPipeline::bilinear_np);
+ sample(SkRasterPipeline::bilinear_pn);
+ sample(SkRasterPipeline::bilinear_pp);
p->append(SkRasterPipeline::move_dst_src);
}
diff --git a/src/image/SkImageShaderContext.h b/src/image/SkImageShaderContext.h
index 7e50286072..b0652900dd 100644
--- a/src/image/SkImageShaderContext.h
+++ b/src/image/SkImageShaderContext.h
@@ -28,6 +28,8 @@ struct SkImageShaderContext {
float matrix[9];
float x[8];
float y[8];
+ float fx[8];
+ float fy[8];
float scale[8];
};