diff options
author | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-11-05 21:04:00 +0000 |
---|---|---|
committer | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-11-05 21:04:00 +0000 |
commit | 5ebbe14f76da3028e5d4523c093a0f4a2cf8e982 (patch) | |
tree | fe1edd70e74a3de481a1459ceecadd21560033f4 | |
parent | 9272761b22746d2d22439c26f5555028f8e824da (diff) |
fix cheap calc of edgelist size
git-svn-id: http://skia.googlecode.com/svn/trunk@419 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | samplecode/SampleFuzz.cpp | 3 | ||||
-rw-r--r-- | src/core/SkScan_AntiPath.cpp | 1 | ||||
-rw-r--r-- | src/core/SkScan_Path.cpp | 20 |
3 files changed, 18 insertions, 6 deletions
diff --git a/samplecode/SampleFuzz.cpp b/samplecode/SampleFuzz.cpp index 309affe02b..ba1fc03382 100644 --- a/samplecode/SampleFuzz.cpp +++ b/samplecode/SampleFuzz.cpp @@ -122,7 +122,7 @@ static void do_fuzz(SkCanvas* canvas) { case 1: mode = SkXfermode::kXor_Mode; break; case 2: mode = SkXfermode::kSrcOver_Mode; break; } - paint.setXfermode(mode); + paint.setXfermodeMode(mode); } break; @@ -339,6 +339,7 @@ protected: } virtual void onDraw(SkCanvas* canvas) { + SkIRect r = canvas->getTotalClip().getBounds(); this->drawBG(canvas); do_fuzz(canvas); this->inval(NULL); diff --git a/src/core/SkScan_AntiPath.cpp b/src/core/SkScan_AntiPath.cpp index c5504c6c2e..7b24f73d56 100644 --- a/src/core/SkScan_AntiPath.cpp +++ b/src/core/SkScan_AntiPath.cpp @@ -366,7 +366,6 @@ void SkScan::AntiFillPath(const SkPath& path, const SkRegion& clip, if (ir.isEmpty()) { return; } - SkASSERT(SkIntToScalar(ir.fTop) <= path.getBounds().fTop); // use bit-or since we expect all to pass, so no need to go slower with // a short-circuiting logical-or diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp index e2745795ae..8246376a79 100644 --- a/src/core/SkScan_Path.cpp +++ b/src/core/SkScan_Path.cpp @@ -446,11 +446,23 @@ static int worst_case_edge_count(const SkPath& path, size_t* storage) /* Much faster than worst_case_edge_count, but over estimates even more */ -static int cheap_worst_case_edge_count(const SkPath& path, size_t* storage) -{ +static int cheap_worst_case_edge_count(const SkPath& path, size_t* storage) { int ptCount = path.getPoints(NULL, 0); - int edgeCount = ptCount; - *storage = edgeCount * sizeof(SkCubicEdge); + // worst case is curve, close, curve, close, as that is + // 2 lines per pt, or : pts * 2 + // 2 quads + 1 line per 2 pts, or : pts * 3 / 2 + // 3 cubics + 1 line per 3 pts : pts * 4 / 3 + int edgeCount = ptCount << 1; + // worst storage, due to relative size of different edge types, is + // quads * 3 / 2 + size_t quadSize = (ptCount * 3 >> 1) * sizeof(SkQuadraticEdge); +#if 0 + size_t lineSize = (ptCount << 1) * sizeof(SkEdge); + size_t cubicSize = (ptCount * 3 / 4) * sizeof(SkCubicEdge); + SkASSERT(lineSize <= quadSize); + SkASSERT(cubicSize <= quadSize); +#endif + *storage = quadSize; return edgeCount; } |