Add missing DRAW_PICTURE_MATRIX_PAINT paint offset.

Also remove explicit gPaintOffsets sizing to make the existing compile
time size check effective.

R=reed@google.com, robertphillips@google.com

Author: fmalita@chromium.org

Review URL: https://codereview.chromium.org/467683003
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index 7f3f9d7..6197d88 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -340,10 +340,10 @@
             canvas->drawPicture(fPictureData->getPicture(reader));
             break;
         case DRAW_PICTURE_MATRIX_PAINT: {
-            const SkPicture* pic = fPictureData->getPicture(reader);
+            const SkPaint* paint = fPictureData->getPaint(reader);
             SkMatrix matrix;
             reader->readMatrix(&matrix);
-            const SkPaint* paint = fPictureData->getPaint(reader);
+            const SkPicture* pic = fPictureData->getPicture(reader);
             canvas->drawPicture(pic, &matrix, paint);
         } break;
         case DRAW_POINTS: {
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 7fc48e3..b79b185 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -68,7 +68,7 @@
 // this method)
 static inline size_t getPaintOffset(DrawType op, size_t opSize) {
     // These offsets are where the paint would be if the op size doesn't overflow
-    static const uint8_t gPaintOffsets[LAST_DRAWTYPE_ENUM + 1] = {
+    static const uint8_t gPaintOffsets[] = {
         0,  // UNUSED - no paint
         0,  // CLIP_PATH - no paint
         0,  // CLIP_REGION - no paint
@@ -113,6 +113,7 @@
         0,  // PUSH_CULL - no paint
         0,  // POP_CULL - no paint
         1,  // DRAW_PATCH - right after op code
+        1,  // DRAW_PICTURE_MATRIX_PAINT - right after op code
     };
 
     SK_COMPILE_ASSERT(sizeof(gPaintOffsets) == LAST_DRAWTYPE_ENUM + 1,
@@ -1214,9 +1215,11 @@
         const SkMatrix& m = matrix ? *matrix : SkMatrix::I();
         size += m.writeToMemory(NULL) + kUInt32Size;    // matrix + paint
         initialOffset = this->addDraw(DRAW_PICTURE_MATRIX_PAINT, &size);
-        this->addPicture(picture);
-        this->addMatrix(m);
+        SkASSERT(initialOffset + getPaintOffset(DRAW_PICTURE_MATRIX_PAINT, size)
+                 == fWriter.bytesWritten());
         this->addPaintPtr(paint);
+        this->addMatrix(m);
+        this->addPicture(picture);
     }
     this->validate(initialOffset, size);
 }