diff options
Diffstat (limited to 'src/core/SkRasterPipeline.cpp')
-rw-r--r-- | src/core/SkRasterPipeline.cpp | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/src/core/SkRasterPipeline.cpp b/src/core/SkRasterPipeline.cpp index c50383af01..71c993dfb8 100644 --- a/src/core/SkRasterPipeline.cpp +++ b/src/core/SkRasterPipeline.cpp @@ -9,29 +9,30 @@ SkRasterPipeline::SkRasterPipeline() {} -void SkRasterPipeline::append(SkRasterPipeline::Fn body_fn, const void* body_ctx, - SkRasterPipeline::Fn tail_fn, const void* tail_ctx) { +void SkRasterPipeline::append(SkRasterPipeline::Fn body, + SkRasterPipeline::Fn tail, + const void* ctx) { // Each stage holds its own context and the next function to call. // So the pipeline itself has to hold onto the first function that starts the pipeline. - (fBody.empty() ? fBodyStart : fBody.back().fNext) = body_fn; - (fTail.empty() ? fTailStart : fTail.back().fNext) = tail_fn; + (fBody.empty() ? fBodyStart : fBody.back().fNext) = body; + (fTail.empty() ? fTailStart : fTail.back().fNext) = tail; // Each last stage starts with its next function set to JustReturn as a safety net. // It'll be overwritten by the next call to append(). - fBody.push_back({ &JustReturn, const_cast<void*>(body_ctx) }); - fTail.push_back({ &JustReturn, const_cast<void*>(tail_ctx) }); + fBody.push_back({ &JustReturn, const_cast<void*>(ctx) }); + fTail.push_back({ &JustReturn, const_cast<void*>(ctx) }); } void SkRasterPipeline::extend(const SkRasterPipeline& src) { SkASSERT(src.fBody.count() == src.fTail.count()); - Fn body_fn = src.fBodyStart, - tail_fn = src.fTailStart; + Fn body = src.fBodyStart, + tail = src.fTailStart; for (int i = 0; i < src.fBody.count(); i++) { - this->append(body_fn, src.fBody[i].fCtx, - tail_fn, src.fTail[i].fCtx); - body_fn = src.fBody[i].fNext; - tail_fn = src.fTail[i].fNext; + SkASSERT(src.fBody[i].fCtx == src.fTail[i].fCtx); + this->append(body, tail, src.fBody[i].fCtx); + body = src.fBody[i].fNext; + tail = src.fTail[i].fNext; } } @@ -40,16 +41,14 @@ void SkRasterPipeline::run(size_t x, size_t n) { Sk4f v; while (n >= 4) { - fBodyStart(fBody.begin(), x, v,v,v,v, v,v,v,v); + fBodyStart(fBody.begin(), x,0, v,v,v,v, v,v,v,v); x += 4; n -= 4; } - while (n > 0) { - fTailStart(fTail.begin(), x, v,v,v,v, v,v,v,v); - x += 1; - n -= 1; + if (n > 0) { + fTailStart(fTail.begin(), x,n, v,v,v,v, v,v,v,v); } } -void SK_VECTORCALL SkRasterPipeline::JustReturn(Stage*, size_t, Sk4f,Sk4f,Sk4f,Sk4f, - Sk4f,Sk4f,Sk4f,Sk4f) {} +void SK_VECTORCALL SkRasterPipeline::JustReturn(Stage*, size_t, size_t, Sk4f,Sk4f,Sk4f,Sk4f, + Sk4f,Sk4f,Sk4f,Sk4f) {} |