aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--bench/SkRasterPipelineBench.cpp2
-rw-r--r--src/core/SkColorSpaceXform_A2B.cpp2
-rw-r--r--src/core/SkOpts.h4
-rw-r--r--src/core/SkPM4fPriv.h2
-rw-r--r--src/core/SkRasterPipeline.cpp2
-rw-r--r--src/core/SkRasterPipeline.h4
-rw-r--r--src/core/SkRasterPipelineBlitter.cpp18
-rw-r--r--src/opts/SkRasterPipeline_opts.h22
-rw-r--r--tests/SkRasterPipelineTest.cpp6
9 files changed, 34 insertions, 28 deletions
diff --git a/bench/SkRasterPipelineBench.cpp b/bench/SkRasterPipelineBench.cpp
index 624b7951de..15576c41d1 100644
--- a/bench/SkRasterPipelineBench.cpp
+++ b/bench/SkRasterPipelineBench.cpp
@@ -47,7 +47,7 @@ public:
auto compiled = p.compile();
while (loops --> 0) {
- compiled(0, N);
+ compiled(0,0, N);
}
}
};
diff --git a/src/core/SkColorSpaceXform_A2B.cpp b/src/core/SkColorSpaceXform_A2B.cpp
index 04ecf7707f..e54cb27840 100644
--- a/src/core/SkColorSpaceXform_A2B.cpp
+++ b/src/core/SkColorSpaceXform_A2B.cpp
@@ -113,7 +113,7 @@ bool SkColorSpaceXform_A2B::onApply(ColorFormat dstFormat, void* dst, ColorForma
auto p = pipeline.compile();
- p(0, count);
+ p(0,0, count);
return true;
}
diff --git a/src/core/SkOpts.h b/src/core/SkOpts.h
index 76ca68a2bd..ccd38acc5f 100644
--- a/src/core/SkOpts.h
+++ b/src/core/SkOpts.h
@@ -74,8 +74,8 @@ namespace SkOpts {
return hash_fn(data, bytes, seed);
}
- extern
- std::function<void(size_t, size_t)> (*compile_pipeline)(const SkRasterPipeline::Stage*, int);
+ extern std::function<void(size_t, size_t, size_t)>
+ (*compile_pipeline)(const SkRasterPipeline::Stage*, int);
}
#endif//SkOpts_DEFINED
diff --git a/src/core/SkPM4fPriv.h b/src/core/SkPM4fPriv.h
index 304a49ffdd..aedb0ad20f 100644
--- a/src/core/SkPM4fPriv.h
+++ b/src/core/SkPM4fPriv.h
@@ -126,7 +126,7 @@ static inline SkPM4f SkPM4f_from_SkColor(SkColor color, SkColorSpace* dst) {
SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get(), dst);
p.append(SkRasterPipeline::store_f32, &color4f_ptr);
- p.compile()(0,1);
+ p.compile()(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 54de6793b0..c768f1ce6f 100644
--- a/src/core/SkRasterPipeline.cpp
+++ b/src/core/SkRasterPipeline.cpp
@@ -22,6 +22,6 @@ void SkRasterPipeline::extend(const SkRasterPipeline& src) {
}
}
-std::function<void(size_t, size_t)> SkRasterPipeline::compile() const {
+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 361793b5d6..13d4e28941 100644
--- a/src/core/SkRasterPipeline.h
+++ b/src/core/SkRasterPipeline.h
@@ -91,8 +91,8 @@ public:
// Append all stages to this pipeline.
void extend(const SkRasterPipeline&);
- // Runs the pipeline walking x through [x,x+n).
- std::function<void(size_t x, size_t n)> compile() const;
+ // Runs the pipeline walking x through [x,x+n), holding y constant.
+ std::function<void(size_t x, size_t y, size_t n)> compile() const;
struct Stage {
StockStage stage;
diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp
index 5a7ee67c9b..71267a8f21 100644
--- a/src/core/SkRasterPipelineBlitter.cpp
+++ b/src/core/SkRasterPipelineBlitter.cpp
@@ -50,10 +50,10 @@ private:
SkRasterPipeline fShader;
// These functions are compiled lazily when first used.
- std::function<void(size_t, size_t)> fBlitH = nullptr,
- fBlitAntiH = nullptr,
- fBlitMaskA8 = nullptr,
- fBlitMaskLCD16 = nullptr;
+ std::function<void(size_t, size_t, size_t)> fBlitH = nullptr,
+ fBlitAntiH = nullptr,
+ fBlitMaskA8 = nullptr,
+ fBlitMaskLCD16 = nullptr;
// These values are pointed to by the compiled blit functions
// above, which allows us to adjust them from call to call.
@@ -131,7 +131,7 @@ SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst,
if (is_constant) {
pipeline->append(SkRasterPipeline::store_f32, &paintColor);
- pipeline->compile()(0,1);
+ pipeline->compile()(0,0, 1);
*pipeline = SkRasterPipeline();
pipeline->append(SkRasterPipeline::constant_color, paintColor);
@@ -206,7 +206,7 @@ void SkRasterPipelineBlitter::blitH(int x, int y, int w) {
}
fDstPtr = fDst.writable_addr(0,y);
- fBlitH(x,w);
+ fBlitH(x,y, w);
}
void SkRasterPipelineBlitter::blitAntiH(int x, int y, const SkAlpha aa[], const int16_t runs[]) {
@@ -234,7 +234,7 @@ void SkRasterPipelineBlitter::blitAntiH(int x, int y, const SkAlpha aa[], const
case 0xff: this->blitH(x,y,run); break;
default:
fConstantCoverage = *aa * (1/255.0f);
- fBlitAntiH(x, run);
+ fBlitAntiH(x,y, run);
}
x += run;
runs += run;
@@ -283,11 +283,11 @@ void SkRasterPipelineBlitter::blitMask(const SkMask& mask, const SkIRect& clip)
switch (mask.fFormat) {
case SkMask::kA8_Format:
fMaskPtr = mask.getAddr8(x,y)-x;
- fBlitMaskA8(x, clip.width());
+ fBlitMaskA8(x,y, clip.width());
break;
case SkMask::kLCD16_Format:
fMaskPtr = mask.getAddrLCD16(x,y)-x;
- fBlitMaskLCD16(x, clip.width());
+ fBlitMaskLCD16(x,y, clip.width());
break;
default:
// TODO
diff --git a/src/opts/SkRasterPipeline_opts.h b/src/opts/SkRasterPipeline_opts.h
index a687627cde..dbdd00d498 100644
--- a/src/opts/SkRasterPipeline_opts.h
+++ b/src/opts/SkRasterPipeline_opts.h
@@ -626,23 +626,23 @@ namespace SK_OPTS_NS {
struct Memset16 {
uint16_t** dst;
uint16_t val;
- void operator()(size_t x, size_t n) { sk_memset16(*dst + x, val, n); }
+ void operator()(size_t x, size_t, size_t n) { sk_memset16(*dst + x, val, n); }
};
struct Memset32 {
uint32_t** dst;
uint32_t val;
- void operator()(size_t x, size_t n) { sk_memset32(*dst + x, val, n); }
+ void operator()(size_t x, size_t, size_t n) { sk_memset32(*dst + x, val, n); }
};
struct Memset64 {
uint64_t** dst;
uint64_t val;
- void operator()(size_t x, size_t n) { sk_memset64(*dst + x, val, n); }
+ void operator()(size_t x, size_t, size_t n) { sk_memset64(*dst + x, val, n); }
};
- SI std::function<void(size_t, size_t)> compile_pipeline(const SkRasterPipeline::Stage* stages,
- int nstages) {
+ SI std::function<void(size_t, size_t, size_t)>
+ compile_pipeline(const SkRasterPipeline::Stage* stages, int nstages) {
if (nstages == 2 && stages[0].stage == SkRasterPipeline::constant_color) {
SkPM4f src = *(const SkPM4f*)stages[0].ctx;
void* dst = stages[1].ctx;
@@ -679,16 +679,22 @@ namespace SK_OPTS_NS {
fBody[nstages-1].ctx = fTail[nstages-1].ctx = stages[nstages-1].ctx;
}
- void operator()(size_t x, size_t n) {
+ void operator()(size_t x, size_t y, size_t n) {
SkNf v; // Fastest to start uninitialized.
+ float dx[] = { 0,1,2,3,4,5,6,7 };
+ SkNf X = SkNf(x),
+ Y = SkNf(y),
+ DX = SkNf::Load(dx);
+
while (n >= N) {
- fBodyStart(fBody, x, v,v,v,v, v,v,v,v);
+ fBodyStart(fBody, x, v,v,v,v, X,Y,v,v);
+ X += DX;
x += N;
n -= N;
}
if (n) {
- fTailStart(fTail, x,n, v,v,v,v, v,v,v,v);
+ fTailStart(fTail, x,n, v,v,v,v, X,Y,v,v);
}
}
diff --git a/tests/SkRasterPipelineTest.cpp b/tests/SkRasterPipelineTest.cpp
index 96798fcd52..e3f2ca291a 100644
--- a/tests/SkRasterPipelineTest.cpp
+++ b/tests/SkRasterPipelineTest.cpp
@@ -25,7 +25,7 @@ DEF_TEST(SkRasterPipeline, r) {
p.append(SkRasterPipeline::load_d_f16, &load_d_ctx);
p.append(SkRasterPipeline::srcover);
p.append(SkRasterPipeline::store_f16, &store_ctx);
- p.compile()(0, 1);
+ p.compile()(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,20);
+ p.compile()(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, 20);
+ p.compile()(0,0, 20);
}