diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-05-31 19:18:02 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-05-31 19:18:02 +0000 |
commit | fa57ae7d1ec7404a654e0f32c09b698feec1b7fa (patch) | |
tree | 659128f2504b23724f3da4375956f386553d3e29 /src/core/SkScan_AntiPath.cpp | |
parent | 9405e55c3727af71a58c831892038b57cc951bad (diff) |
remember previous x-offset when we re-enter the runs array. speeds up paths
with lots of x-transitions in a single scanline
git-svn-id: http://skia.googlecode.com/svn/trunk@1456 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkScan_AntiPath.cpp')
-rw-r--r-- | src/core/SkScan_AntiPath.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/core/SkScan_AntiPath.cpp b/src/core/SkScan_AntiPath.cpp index b7ce190e9a..98f3b25aea 100644 --- a/src/core/SkScan_AntiPath.cpp +++ b/src/core/SkScan_AntiPath.cpp @@ -53,7 +53,7 @@ protected: int fWidth, fLeft, fSuperLeft; SkDEBUGCODE(int fCurrX;) - SkDEBUGCODE(int fCurrY;) + int fCurrY; }; BaseSuperBlitter::BaseSuperBlitter(SkBlitter* realBlitter, const SkIRect& ir, @@ -89,6 +89,7 @@ public: private: SkAlphaRuns fRuns; + int fOffsetX; }; SuperBlitter::SuperBlitter(SkBlitter* realBlitter, const SkIRect& ir, @@ -100,6 +101,8 @@ SuperBlitter::SuperBlitter(SkBlitter* realBlitter, const SkIRect& ir, fRuns.fRuns = (int16_t*)sk_malloc_throw((width + 1 + (width + 2)/2) * sizeof(int16_t)); fRuns.fAlpha = (uint8_t*)(fRuns.fRuns + width + 1); fRuns.reset(width); + + fOffsetX = 0; } void SuperBlitter::flush() { @@ -108,6 +111,7 @@ void SuperBlitter::flush() { // SkDEBUGCODE(fRuns.dump();) fRealBlitter->blitAntiH(fLeft, fCurrIY, fRuns.fAlpha, fRuns.fRuns); fRuns.reset(fWidth); + fOffsetX = 0; } fCurrIY = -1; SkDEBUGCODE(fCurrX = -1;) @@ -134,11 +138,14 @@ void SuperBlitter::blitH(int x, int y, int width) { } #ifdef SK_DEBUG - SkASSERT(y >= fCurrY); SkASSERT(y != fCurrY || x >= fCurrX); - fCurrY = y; #endif - + SkASSERT(y >= fCurrY); + if (fCurrY != y) { + fOffsetX = 0; + fCurrY = y; + } + if (iy != fCurrIY) { // new scanline this->flush(); fCurrIY = iy; @@ -167,8 +174,10 @@ void SuperBlitter::blitH(int x, int y, int width) { fb = (1 << SHIFT) - fb; } } - fRuns.add(x >> SHIFT, coverage_to_alpha(fb), n, coverage_to_alpha(fe), - (1 << (8 - SHIFT)) - (((y & MASK) + 1) >> SHIFT)); + + fOffsetX = fRuns.add(x >> SHIFT, coverage_to_alpha(fb), n, coverage_to_alpha(fe), + (1 << (8 - SHIFT)) - (((y & MASK) + 1) >> SHIFT), + fOffsetX); #ifdef SK_DEBUG fRuns.assertValid(y & MASK, (1 << (8 - SHIFT))); |