aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-10-31 16:07:28 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-10-31 16:07:28 +0000
commit9154eb08ec1f0d51688a6eb55c54111cf6ec5fbb (patch)
treecd2321d547b170831e83dcbb00ad3f0fd7646cb3
parent57c4957604b9cb71acbc0db4a8e83701437e7fb1 (diff)
implement blitRect for aaclip builder. This speeds up setRect by 15x (for 640x480)
git-svn-id: http://skia.googlecode.com/svn/trunk@2566 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/core/SkAAClip.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp
index 9225061aa2..05742487b8 100644
--- a/src/core/SkAAClip.cpp
+++ b/src/core/SkAAClip.cpp
@@ -846,6 +846,19 @@ public:
SkASSERT(row->fWidth <= fBounds.width());
}
+ void addRectRun(int x, int y, int width, int height) {
+ SkASSERT(fBounds.contains(x + width - 1, y + height - 1));
+ this->addRun(x, y, 0xFF, width);
+
+ // we assum the rect must be all we'll see for these scanlines
+ // so we ensure our row goes all the way to our right
+ this->flushRowH(fCurrRow);
+
+ y -= fBounds.fTop;
+ SkASSERT(y == fCurrRow->fY);
+ fCurrRow->fY = y + height - 1;
+ }
+
bool finish(SkAAClip* target) {
this->flushRow(false);
@@ -947,17 +960,19 @@ public:
}
private:
+ void flushRowH(Row* row) {
+ // flush current row if needed
+ if (row->fWidth < fWidth) {
+ AppendRun(*row->fData, 0, fWidth - row->fWidth);
+ row->fWidth = fWidth;
+ }
+ }
Row* flushRow(bool readyForAnother) {
Row* next = NULL;
int count = fRows.count();
if (count > 0) {
- // flush current row if needed
- Row* curr = &fRows[count - 1];
- if (curr->fWidth < fWidth) {
- AppendRun(*curr->fData, 0, fWidth - curr->fWidth);
- curr->fWidth = fWidth;
- }
+ this->flushRowH(&fRows[count - 1]);
}
if (count > 1) {
// are our last two runs the same?
@@ -1022,10 +1037,8 @@ public:
{ unexpected(); }
virtual void blitRect(int x, int y, int width, int height) SK_OVERRIDE {
-// SkDebugf("blitRect Y:%d H:%d\n", y, height);
- while (--height >= 0) {
- this->blitH(x, y++, width);
- }
+ this->recordMinY(y);
+ fBuilder->addRectRun(x, y, width, height);
}
virtual void blitMask(const SkMask&, const SkIRect& clip) SK_OVERRIDE