aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2016-11-30 13:45:06 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-30 20:16:49 +0000
commitc789b61167dd98efc3c3bfcf9673eef24c2e57f4 (patch)
treeba3a28f33c7d3c5e8c323cacc40125def20c80b2 /src/core
parentc5d0147717e50acba106b76c6c345192274ddc06 (diff)
Bring back SkRasterPipeline::run() for one-off uses.
CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I308b6d75f2987a667eead9a55760a2ff6aec2984 Reviewed-on: https://skia-review.googlesource.com/5353 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkColorSpaceXform_A2B.cpp5
-rw-r--r--src/core/SkOpts.cpp1
-rw-r--r--src/core/SkOpts.h1
-rw-r--r--src/core/SkPM4fPriv.h2
-rw-r--r--src/core/SkRasterPipeline.cpp4
-rw-r--r--src/core/SkRasterPipeline.h3
-rw-r--r--src/core/SkRasterPipelineBlitter.cpp2
7 files changed, 12 insertions, 6 deletions
diff --git a/src/core/SkColorSpaceXform_A2B.cpp b/src/core/SkColorSpaceXform_A2B.cpp
index d10453cb67..f2f694349f 100644
--- a/src/core/SkColorSpaceXform_A2B.cpp
+++ b/src/core/SkColorSpaceXform_A2B.cpp
@@ -64,10 +64,7 @@ bool SkColorSpaceXform_A2B::onApply(ColorFormat dstFormat, void* dst, ColorForma
pipeline.append(SkRasterPipeline::store_f32, &dst);
break;
}
-
- auto p = pipeline.compile();
-
- p(0,0, count);
+ pipeline.run(0,0, count);
return true;
}
diff --git a/src/core/SkOpts.cpp b/src/core/SkOpts.cpp
index 6c13dd05e1..45fb2890f2 100644
--- a/src/core/SkOpts.cpp
+++ b/src/core/SkOpts.cpp
@@ -90,6 +90,7 @@ namespace SkOpts {
DEFINE_DEFAULT(hash_fn);
+ DEFINE_DEFAULT(run_pipeline);
DEFINE_DEFAULT(compile_pipeline);
DEFINE_DEFAULT(convolve_vertically);
diff --git a/src/core/SkOpts.h b/src/core/SkOpts.h
index 22be97c332..b09d8cfd9f 100644
--- a/src/core/SkOpts.h
+++ b/src/core/SkOpts.h
@@ -75,6 +75,7 @@ namespace SkOpts {
return hash_fn(data, bytes, seed);
}
+ extern void (*run_pipeline)(size_t, size_t, size_t, const SkRasterPipeline::Stage*, int);
extern std::function<void(size_t, size_t, size_t)>
(*compile_pipeline)(const SkRasterPipeline::Stage*, int);
diff --git a/src/core/SkPM4fPriv.h b/src/core/SkPM4fPriv.h
index 13c1fd9ab7..db8d478f13 100644
--- a/src/core/SkPM4fPriv.h
+++ b/src/core/SkPM4fPriv.h
@@ -126,7 +126,7 @@ static inline SkColor4f SkColor4f_from_SkColor(SkColor color, SkColorSpace* dst)
SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get(), dst);
p.append(SkRasterPipeline::store_f32, &color4f_ptr);
- p.compile()(0,0,1);
+ p.run(0,0,1);
} else {
// Linear gamma, dst gamut.
swizzle_rb(SkNx_cast<float>(Sk4b::Load(&color)) * (1/255.0f)).store(&color4f);
diff --git a/src/core/SkRasterPipeline.cpp b/src/core/SkRasterPipeline.cpp
index 7c4c95f480..27856fd576 100644
--- a/src/core/SkRasterPipeline.cpp
+++ b/src/core/SkRasterPipeline.cpp
@@ -27,6 +27,10 @@ void SkRasterPipeline::extend(const SkRasterPipeline& src) {
}
}
+void SkRasterPipeline::run(size_t x, size_t y, size_t n) const {
+ SkOpts::run_pipeline(x,y,n, fStages, fNum);
+}
+
std::function<void(size_t, size_t, size_t)> SkRasterPipeline::compile() const {
return SkOpts::compile_pipeline(fStages, fNum);
}
diff --git a/src/core/SkRasterPipeline.h b/src/core/SkRasterPipeline.h
index 0495ebc3e7..01b581f3bb 100644
--- a/src/core/SkRasterPipeline.h
+++ b/src/core/SkRasterPipeline.h
@@ -104,6 +104,9 @@ public:
void extend(const SkRasterPipeline&);
// Runs the pipeline walking x through [x,x+n), holding y constant.
+ void run(size_t x, size_t y, size_t n) const;
+
+ // If you're going to run() the pipeline more than once, it's best to compile it.
std::function<void(size_t x, size_t y, size_t n)> compile() const;
void dump() const;
diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp
index d1796f5766..075da1a754 100644
--- a/src/core/SkRasterPipelineBlitter.cpp
+++ b/src/core/SkRasterPipelineBlitter.cpp
@@ -140,7 +140,7 @@ SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst,
if (is_constant) {
pipeline->append(SkRasterPipeline::store_f32, &paintColor);
- pipeline->compile()(0,0, 1);
+ pipeline->run(0,0, 1);
*pipeline = SkRasterPipeline();
pipeline->append(SkRasterPipeline::constant_color, paintColor);