revert 6766, thereby re-landing 6762-6763 now that the bots are ready



git-svn-id: http://skia.googlecode.com/svn/trunk@6770 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 3c4df53..82257c8 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -8,6 +8,7 @@
 #include "SkPictureRecord.h"
 #include "SkTSearch.h"
 #include "SkPixelRef.h"
+#include "SkRRect.h"
 #include "SkBBoxHierarchy.h"
 #include "SkPictureStateTree.h"
 
@@ -111,6 +112,7 @@
         4,  // CLIP_PATH,
         4,  // CLIP_REGION,
         7,  // CLIP_RECT,
+        15, // CLIP_RRECT,
         2,  // CONCAT,
         0,  // DRAW_BITMAP,
         0,  // DRAW_BITMAP_MATRIX,
@@ -118,6 +120,7 @@
         0,  // DRAW_BITMAP_RECT,
         0,  // DRAW_CLEAR,
         0,  // DRAW_DATA,
+        0,  // DRAW_OVAL,
         0,  // DRAW_PAINT,
         0,  // DRAW_PATH,
         0,  // DRAW_PICTURE,
@@ -127,6 +130,7 @@
         0,  // DRAW_POS_TEXT_H,
         0,  // DRAW_POS_TEXT_H_TOP_BOTTOM, // fast variant of DRAW_POS_TEXT_H
         0,  // DRAW_RECT,
+        0,  // DRAW_RRECT,
         0,  // DRAW_SPRITE,
         0,  // DRAW_TEXT,
         0,  // DRAW_TEXT_ON_PATH,
@@ -352,11 +356,30 @@
     addRect(rect);
     addInt(ClipParams_pack(op, doAA));
     recordRestoreOffsetPlaceholder(op);
-
+    
     validate();
     return this->INHERITED::clipRect(rect, op, doAA);
 }
 
+bool SkPictureRecord::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
+    if (rrect.isRect()) {
+        return this->SkPictureRecord::clipRect(rrect.getBounds(), op, doAA);
+    }
+
+    addDraw(CLIP_RRECT);
+    addRRect(rrect);
+    addInt(ClipParams_pack(op, doAA));
+    recordRestoreOffsetPlaceholder(op);
+    
+    validate();
+
+    if (fRecordFlags & SkPicture::kUsePathBoundsForClip_RecordingFlag) {
+        return this->INHERITED::clipRect(rrect.getBounds(), op, doAA);
+    } else {
+        return this->INHERITED::clipRRect(rrect, op, doAA);
+    }
+}
+
 bool SkPictureRecord::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
 
     SkRect r;
@@ -410,6 +433,13 @@
     validate();
 }
 
+void SkPictureRecord::drawOval(const SkRect& oval, const SkPaint& paint) {
+    addDraw(DRAW_OVAL);
+    addPaint(paint);
+    addRect(oval);
+    validate();
+}
+
 void SkPictureRecord::drawRect(const SkRect& rect, const SkPaint& paint) {
     addDraw(DRAW_RECT);
     addPaint(paint);
@@ -417,6 +447,23 @@
     validate();
 }
 
+void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
+    if (rrect.isRect()) {
+        addDraw(DRAW_RECT);
+        addPaint(paint);
+        addRect(rrect.getBounds());
+    } else if (rrect.isOval()) {
+        addDraw(DRAW_OVAL);
+        addPaint(paint);
+        addRect(rrect.getBounds());
+    } else {
+        addDraw(DRAW_RRECT);
+        addPaint(paint);
+        addRRect(rrect);
+    }
+    validate();
+}
+
 void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) {
     addDraw(DRAW_PATH);
     addPaint(paint);
@@ -754,6 +801,10 @@
     }
 }
 
+void SkPictureRecord::addRRect(const SkRRect& rrect) {
+    fWriter.writeRRect(rrect);
+}
+
 void SkPictureRecord::addRegion(const SkRegion& region) {
     addInt(fRegions.find(region));
 }