fix cheap calc of edgelist size



git-svn-id: http://skia.googlecode.com/svn/trunk@419 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/SampleFuzz.cpp b/samplecode/SampleFuzz.cpp
index 309affe..ba1fc03 100644
--- a/samplecode/SampleFuzz.cpp
+++ b/samplecode/SampleFuzz.cpp
@@ -122,7 +122,7 @@
             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 @@
     }
     
     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 c5504c6..7b24f73 100644
--- a/src/core/SkScan_AntiPath.cpp
+++ b/src/core/SkScan_AntiPath.cpp
@@ -366,7 +366,6 @@
     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 e274579..8246376 100644
--- a/src/core/SkScan_Path.cpp
+++ b/src/core/SkScan_Path.cpp
@@ -446,11 +446,23 @@
 
 /* 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;
 }