aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--samplecode/SampleFuzz.cpp3
-rw-r--r--src/core/SkScan_AntiPath.cpp1
-rw-r--r--src/core/SkScan_Path.cpp20
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;
}