update SkRasterPipeline::run() to also take y

y isn't used yet.  This is just a warmup that updates the callers.

Change-Id: I78f4f44e2b82f72b3a39fa8a8bdadef1d1b8a99e
Reviewed-on: https://skia-review.googlesource.com/18381
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2017-06-01 12:37:08 -04:00 committed by Skia Commit-Bot
parent d16084ffdc
commit 761d27c4d7
17 changed files with 48 additions and 48 deletions

View File

@ -59,7 +59,7 @@ public:
}
while (loops --> 0) {
p.run(0,N);
p.run(0,0,N);
}
}
};
@ -89,11 +89,11 @@ public:
if (fCompile) {
auto fn = p.compile();
while (loops --> 0) {
fn(0,N);
fn(0,0,N);
}
} else {
while (loops --> 0) {
p.run(0,N);
p.run(0,0,N);
}
}
}
@ -132,7 +132,7 @@ public:
p.append(SkRasterPipeline::parametric_b, & to_2dot2);
while (loops --> 0) {
p.run(0,N);
p.run(0,0,N);
}
}
};
@ -150,7 +150,7 @@ public:
p.append(SkRasterPipeline::to_srgb);
while (loops --> 0) {
p.run(0,N);
p.run(0,0,N);
}
}
};

View File

@ -333,7 +333,7 @@ static void premultiply_if_necessary(SkBitmap& bitmap) {
p.append(SkRasterPipeline::load_f16, &row);
p.append(SkRasterPipeline::premul);
p.append(SkRasterPipeline::store_f16, &row);
p.run(0, bitmap.width());
p.run(0,y, bitmap.width());
}
break;
case kN32_SkColorType:

View File

@ -377,7 +377,7 @@ static void blend_line(SkColorType dstCT, void* dst,
}
p.append(store_dst, dst);
p.run(0, width);
p.run(0,0, width);
}
SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst, size_t rowBytes,

View File

@ -65,7 +65,7 @@ SkColor4f SkColorFilter::filterColor4f(const SkColor4f& c) const {
this->onAppendStages(&pipeline, nullptr, &alloc, c.fA == 1);
SkPM4f* dstPtr = &dst;
pipeline.append(SkRasterPipeline::store_f32, &dstPtr);
pipeline.run(0,1);
pipeline.run(0,0, 1);
return dst.unpremul();
}

View File

@ -1313,7 +1313,7 @@ bool SkColorSpaceXform_XYZ<kCSM>
return false;
}
pipeline.run(0, len);
pipeline.run(0,0, len);
return true;
}

View File

@ -75,7 +75,7 @@ bool SkColorSpaceXform_A2B::onApply(ColorFormat dstFormat, void* dst, ColorForma
default:
return false;
}
pipeline.run(0,count);
pipeline.run(0,0, count);
return true;
}

View File

@ -397,7 +397,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) {
run(0,srcInfo.width());
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.
dstRow = SkTAddOffset<void>(dstRow, dstRB);

View File

@ -157,7 +157,7 @@ static inline SkColor4f to_colorspace(const SkColor4f& c, SkColorSpace* src, SkC
append_gamut_transform(&p, scratch_matrix_3x4, src, dst, kUnpremul_SkAlphaType);
p.append(SkRasterPipeline::store_f32, &color4f_ptr);
p.run(0,1);
p.run(0,0,1);
}
return color4f;
}

View File

@ -135,10 +135,10 @@ public:
void extend(const SkRasterPipeline&);
// Runs the pipeline walking x through [x,x+n).
void run(size_t x, size_t n) const;
void run(size_t x, size_t y, size_t n) const;
// Allocates a thunk which amortizes run() setup cost in alloc.
std::function<void(size_t, size_t)> compile() const;
std::function<void(size_t, size_t, size_t)> compile() const;
void dump() const;

View File

@ -67,7 +67,7 @@ private:
uint64_t fMemsetColor = 0; // Big enough for largest dst format, F16.
// Built lazily on first use.
std::function<void(size_t, size_t)> fBlitH,
std::function<void(size_t, size_t, size_t)> fBlitH,
fBlitAntiH,
fBlitMaskA8,
fBlitMaskLCD16;
@ -211,7 +211,7 @@ SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst,
if (is_constant) {
auto constantColor = alloc->make<SkPM4f>();
colorPipeline->append(SkRasterPipeline::store_f32, &constantColor);
colorPipeline->run(0,1);
colorPipeline->run(0,0,1);
colorPipeline->reset();
colorPipeline->append(SkRasterPipeline::constant_color, constantColor);
@ -232,7 +232,7 @@ SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst,
p.extend(*colorPipeline);
blitter->fDstPtr = &blitter->fMemsetColor;
blitter->append_store(&p);
p.run(0,1);
p.run(0,0,1);
blitter->fCanMemsetInBlitH = true;
}
@ -336,7 +336,7 @@ void SkRasterPipelineBlitter::blitH(int x, int y, int w) {
fBlitH = p.compile();
}
this->maybe_shade(x,y,w);
fBlitH(x,w);
fBlitH(x,y,w);
}
void SkRasterPipelineBlitter::blitAntiH(int x, int y, const SkAlpha aa[], const int16_t runs[]) {
@ -366,7 +366,7 @@ void SkRasterPipelineBlitter::blitAntiH(int x, int y, const SkAlpha aa[], const
default:
this->maybe_shade(x,y,run);
fCurrentCoverage = *aa * (1/255.0f);
fBlitAntiH(x,run);
fBlitAntiH(x,y,run);
}
x += run;
runs += run;
@ -417,11 +417,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

View File

@ -162,7 +162,7 @@ static inline void transform_scanline_unpremultiply_sRGB(void* dst, const void*
p.append(SkRasterPipeline::unpremul);
p.append(SkRasterPipeline::to_srgb);
p.append(SkRasterPipeline::store_8888, &dst);
p.run(0, width);
p.run(0,0, width);
}
/**
@ -186,7 +186,7 @@ static inline void transform_scanline_to_premul_linear(char* SK_RESTRICT dst,
p.append(SkRasterPipeline::premul);
p.append(SkRasterPipeline::to_srgb);
p.append(SkRasterPipeline::store_8888, (void**) &dst);
p.run(0, width);
p.run(0,0, width);
}
/**
@ -258,7 +258,7 @@ static inline void transform_scanline_F16(char* SK_RESTRICT dst, const char* SK_
p.append(SkRasterPipeline::load_f16, (const void**) &src);
p.append(SkRasterPipeline::to_srgb);
p.append(SkRasterPipeline::store_u16_be, (void**) &dst);
p.run(0, width);
p.run(0,0, width);
}
/**
@ -271,7 +271,7 @@ static inline void transform_scanline_F16_premul(char* SK_RESTRICT dst, const ch
p.append(SkRasterPipeline::unpremul);
p.append(SkRasterPipeline::to_srgb);
p.append(SkRasterPipeline::store_u16_be, (void**) &dst);
p.run(0, width);
p.run(0,0, width);
}
/**
@ -284,7 +284,7 @@ static inline void transform_scanline_F16_to_8888(char* SK_RESTRICT dst,
p.append(SkRasterPipeline::load_f16, (const void**) &src);
p.append(SkRasterPipeline::to_srgb);
p.append(SkRasterPipeline::store_8888, (void**) &dst);
p.run(0, width);
p.run(0,0, width);
}
/**
@ -298,7 +298,7 @@ static inline void transform_scanline_F16_premul_to_8888(char* SK_RESTRICT dst,
p.append(SkRasterPipeline::unpremul);
p.append(SkRasterPipeline::to_srgb);
p.append(SkRasterPipeline::store_8888, (void**) &dst);
p.run(0, width);
p.run(0,0, width);
}
/**
@ -311,7 +311,7 @@ static inline void transform_scanline_F16_to_premul_8888(char* SK_RESTRICT dst,
p.append(SkRasterPipeline::premul);
p.append(SkRasterPipeline::to_srgb);
p.append(SkRasterPipeline::store_8888, (void**) &dst);
p.run(0, width);
p.run(0,0, width);
}
static inline sk_sp<SkData> icc_from_color_space(const SkColorSpace& cs) {

View File

@ -184,7 +184,7 @@ void SkRasterPipeline::BuildPipeline(const StageList* st,
}
}
void SkRasterPipeline::run(size_t x, size_t n) const {
void SkRasterPipeline::run(size_t x, size_t y, size_t n) const {
if (this->empty()) {
return;
}
@ -198,16 +198,16 @@ void SkRasterPipeline::run(size_t x, size_t n) const {
gEngine.start_pipeline(x, program.get(), &kConstants, limit);
}
std::function<void(size_t, size_t)> SkRasterPipeline::compile() const {
std::function<void(size_t, size_t, size_t)> SkRasterPipeline::compile() const {
if (this->empty()) {
return [](size_t, size_t) {};
return [](size_t, size_t, size_t) {};
}
gChooseEngineOnce([]{ gEngine = choose_engine(); });
void** program = fAlloc->makeArray<void*>(fSlotsNeeded);
BuildPipeline(fStages, gEngine, program + fSlotsNeeded);
return [=](size_t x, size_t n) {
return [=](size_t x, size_t y, size_t n) {
const size_t limit = x+n;
gEngine.start_pipeline(x, program, &kConstants, limit);
};

View File

@ -110,7 +110,7 @@ void SkColorFilterShader::FilterShaderContext::shadeSpan4f(int x, int y, SkPM4f
filterShader.fFilter->appendStages(&pipeline, nullptr, &alloc, filterShader.isOpaque());
SkPM4f* dst = result;
pipeline.append(SkRasterPipeline::store_f32, &dst);
pipeline.run(0, count);
pipeline.run(0,y, count);
}
#if SK_SUPPORT_GPU

View File

@ -25,7 +25,7 @@ DEF_TEST(F16Stages, r) {
SkRasterPipeline_<256> p;
p.append(SkRasterPipeline:: load_f32, &f32);
p.append(SkRasterPipeline::store_f16, &f16);
p.run(0,16/4);
p.run(0,0,16/4);
}
REPORTER_ASSERT(r, f16[0] == 0x0000);
REPORTER_ASSERT(r, f16[1] == 0x3400);
@ -40,7 +40,7 @@ DEF_TEST(F16Stages, r) {
SkRasterPipeline_<256> p;
p.append(SkRasterPipeline:: load_f16, &f16);
p.append(SkRasterPipeline::store_f32, &f32);
p.run(0,16/4);
p.run(0,0,16/4);
}
REPORTER_ASSERT(r, f32[0] == 0.00f);
REPORTER_ASSERT(r, f32[1] == 0.25f);

View File

@ -27,7 +27,7 @@ static void check_error(skiatest::Reporter* r, float limit, SkColorSpaceTransfer
p.append(SkRasterPipeline::parametric_a, &fn);
p.append(SkRasterPipeline::store_f32, &op);
p.run(0, 256/4);
p.run(0,0, 256/4);
for (int i = 0; i < 256; i++) {

View File

@ -54,7 +54,7 @@ DEF_TEST(sk_pipeline_srgb_roundtrip, r) {
p.append(SkRasterPipeline::to_srgb);
p.append(SkRasterPipeline::store_8888, &ptr);
p.run(0,256);
p.run(0,0,256);
for (int i = 0; i < 256; i++) {
if (reds[i] != (uint32_t)i) {
@ -73,7 +73,7 @@ DEF_TEST(sk_pipeline_srgb_edge_cases, r) {
p.append(SkRasterPipeline::constant_color, &color);
p.append(SkRasterPipeline::to_srgb);
p.append(SkRasterPipeline::store_f32, &dst);
p.run(0,4);
p.run(0,0,4);
if (color.r() != 0.0f) {
ERRORF(r, "expected to_srgb() to map 0.0f to 0.0f, got %f", color.r());

View File

@ -27,7 +27,7 @@ DEF_TEST(SkRasterPipeline, r) {
p.append(SkRasterPipeline::swap);
p.append(SkRasterPipeline::srcover);
p.append(SkRasterPipeline::store_f16, &store_ctx);
p.run(0,1);
p.run(0,0,1);
// We should see half-intensity magenta.
REPORTER_ASSERT(r, ((result >> 0) & 0xffff) == 0x3800);
@ -39,7 +39,7 @@ DEF_TEST(SkRasterPipeline, r) {
DEF_TEST(SkRasterPipeline_empty, r) {
// No asserts... just a test that this is safe to run.
SkRasterPipeline_<256> p;
p.run(0,20);
p.run(0,0,20);
}
DEF_TEST(SkRasterPipeline_nonsense, r) {
@ -47,7 +47,7 @@ DEF_TEST(SkRasterPipeline_nonsense, r) {
// srcover() calls st->next(); this makes sure we've always got something there to call.
SkRasterPipeline_<256> p;
p.append(SkRasterPipeline::srcover);
p.run(0,20);
p.run(0,0,20);
}
DEF_TEST(SkRasterPipeline_JIT, r) {
@ -69,7 +69,7 @@ DEF_TEST(SkRasterPipeline_JIT, r) {
SkRasterPipeline_<256> p;
p.append(SkRasterPipeline:: load_8888, &src);
p.append(SkRasterPipeline::store_8888, &dst);
p.run(15, 20);
p.run(15,0, 20);
for (int i = 0; i < 36; i++) {
if (i < 15 || i == 35) {
@ -120,7 +120,7 @@ DEF_TEST(SkRasterPipeline_tail, r) {
SkRasterPipeline_<256> p;
p.append(SkRasterPipeline::load_f32, &src);
p.append(SkRasterPipeline::store_f32, &dst);
p.run(0, i);
p.run(0,0, i);
for (unsigned j = 0; j < i; j++) {
for (unsigned k = 0; k < 4; k++) {
if (buffer[j][k] != data[j][k]) {
@ -152,7 +152,7 @@ DEF_TEST(SkRasterPipeline_tail, r) {
SkRasterPipeline_<256> p;
p.append(SkRasterPipeline::load_f16, &src);
p.append(SkRasterPipeline::store_f16, &dst);
p.run(0, i);
p.run(0,0, i);
for (unsigned j = 0; j < i; j++) {
REPORTER_ASSERT(r,
!memcmp(&data[j][0], &buffer[j][0], sizeof(buffer[j])));
@ -189,7 +189,7 @@ DEF_TEST(SkRasterPipeline_tail, r) {
SkRasterPipeline_<256> p;
p.append(SkRasterPipeline::load_rgb_u16_be, &src);
p.append(SkRasterPipeline::store_f32, &dst);
p.run(0, i);
p.run(0,0, i);
for (unsigned j = 0; j < i; j++) {
for (unsigned k = 0; k < 4; k++) {
if (buffer[j][k] != answer[j][k]) {