add SkCanvas::drawDRRect

BUG=skia:
R=bsalomon@google.com, robertphillips@google.com, humper@google.com

Author: reed@google.com

Review URL: https://codereview.chromium.org/174243003

git-svn-id: http://skia.googlecode.com/svn/trunk@13524 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index c14328b..aedb7df 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -111,9 +111,11 @@
         0,  // BEGIN_GROUP - no paint
         0,  // COMMENT - no paint
         0,  // END_GROUP - no paint
+        1,  // DRAWDRRECT - right after op code
     };
 
-    SkASSERT(sizeof(gPaintOffsets) == LAST_DRAWTYPE_ENUM + 1);
+    SK_COMPILE_ASSERT(sizeof(gPaintOffsets) == LAST_DRAWTYPE_ENUM + 1,
+                      need_to_be_in_sync);
     SkASSERT((unsigned)op <= (unsigned)LAST_DRAWTYPE_ENUM);
 
     int overflow = 0;
@@ -463,6 +465,10 @@
                                                 result[0], result[3]);
 }
 
+static bool is_drawing_op(DrawType op) {
+    return (op > CONCAT && op < ROTATE) || DRAW_DRRECT == op;
+}
+
 /*
  *  Restore has just been called (but not recorded), so look back at the
  *  matching save(), and see if we can eliminate the pair of them, due to no
@@ -511,7 +517,7 @@
     offset += opSize;
     while (offset < restoreOffset) {
         op = peek_op_and_size(writer, offset, &opSize);
-        if ((op > CONCAT && op < ROTATE) || (SAVE_LAYER == op)) {
+        if (is_drawing_op(op) || (SAVE_LAYER == op)) {
             // drawing verb, abort
             return false;
         }
@@ -1068,6 +1074,24 @@
     }
 }
 
+void SkPictureRecord::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
+                                   const SkPaint& paint) {
+    
+#ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
+    fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType);
+#endif
+    
+    // op + paint index + rrects
+    uint32_t initialOffset, size;
+    size = 2 * kUInt32Size + SkRRect::kSizeInMemory * 2;
+    initialOffset = this->addDraw(DRAW_DRRECT, &size);
+    SkASSERT(initialOffset+getPaintOffset(DRAW_DRRECT, size) == fWriter.bytesWritten());
+    this->addPaint(paint);
+    this->addRRect(outer);
+    this->addRRect(inner);
+    this->validate(initialOffset, size);
+}
+
 void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) {
 
 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE