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>
This commit is contained in:
parent
c5d0147717
commit
c789b61167
@ -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;
|
||||
}
|
||||
|
@ -90,6 +90,7 @@ namespace SkOpts {
|
||||
|
||||
DEFINE_DEFAULT(hash_fn);
|
||||
|
||||
DEFINE_DEFAULT(run_pipeline);
|
||||
DEFINE_DEFAULT(compile_pipeline);
|
||||
|
||||
DEFINE_DEFAULT(convolve_vertically);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
namespace SkOpts {
|
||||
void Init_hsw() {
|
||||
run_pipeline = hsw::run_pipeline;
|
||||
compile_pipeline = hsw::compile_pipeline;
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ namespace SkOpts {
|
||||
box_blur_yx = sse41::box_blur_yx;
|
||||
srcover_srgb_srgb = sse41::srcover_srgb_srgb;
|
||||
blit_row_s32a_opaque = sse41::blit_row_s32a_opaque;
|
||||
run_pipeline = sse41::run_pipeline;
|
||||
compile_pipeline = sse41::compile_pipeline;
|
||||
}
|
||||
}
|
||||
|
@ -960,6 +960,11 @@ namespace SK_OPTS_NS {
|
||||
return fn;
|
||||
}
|
||||
|
||||
SI void run_pipeline(size_t x, size_t y, size_t n,
|
||||
const SkRasterPipeline::Stage* stages, int nstages) {
|
||||
compile_pipeline(stages, nstages)(x,y,n);
|
||||
}
|
||||
|
||||
} // namespace SK_OPTS_NS
|
||||
|
||||
#undef SI
|
||||
|
@ -25,7 +25,7 @@ DEF_TEST(SkRasterPipeline, r) {
|
||||
p.append(SkRasterPipeline::load_f16_d, &load_d_ctx);
|
||||
p.append(SkRasterPipeline::srcover);
|
||||
p.append(SkRasterPipeline::store_f16, &store_ctx);
|
||||
p.compile()(0,0, 1);
|
||||
p.run(0,0, 1);
|
||||
|
||||
// We should see half-intensity magenta.
|
||||
REPORTER_ASSERT(r, ((result >> 0) & 0xffff) == 0x3800);
|
||||
@ -37,7 +37,7 @@ DEF_TEST(SkRasterPipeline, r) {
|
||||
DEF_TEST(SkRasterPipeline_empty, r) {
|
||||
// No asserts... just a test that this is safe to run.
|
||||
SkRasterPipeline p;
|
||||
p.compile()(0,0, 20);
|
||||
p.run(0,0, 20);
|
||||
}
|
||||
|
||||
DEF_TEST(SkRasterPipeline_nonsense, r) {
|
||||
@ -45,5 +45,5 @@ DEF_TEST(SkRasterPipeline_nonsense, r) {
|
||||
// srcover() calls st->next(); this makes sure we've always got something there to call.
|
||||
SkRasterPipeline p;
|
||||
p.append(SkRasterPipeline::srcover);
|
||||
p.compile()(0,0, 20);
|
||||
p.run(0,0, 20);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user