turn bitmaps into images during recording

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2185563003

Review-Url: https://codereview.chromium.org/2185563003
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index cdfce66..6cb41ef 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -92,16 +92,6 @@
 template <> void Draw::draw(const TranslateZ& r) { }
 #endif
 
-DRAW(DrawBitmap, drawBitmap(r.bitmap.shallowCopy(), r.left, r.top, r.paint));
-DRAW(DrawBitmapNine, drawBitmapNine(r.bitmap.shallowCopy(), r.center, r.dst, r.paint));
-DRAW(DrawBitmapRect,
-        legacy_drawBitmapRect(r.bitmap.shallowCopy(), r.src, r.dst, r.paint,
-                             SkCanvas::kStrict_SrcRectConstraint));
-DRAW(DrawBitmapRectFast,
-        legacy_drawBitmapRect(r.bitmap.shallowCopy(), r.src, r.dst, r.paint,
-                       SkCanvas::kFast_SrcRectConstraint));
-DRAW(DrawBitmapRectFixedSize,
-        legacy_drawBitmapRect(r.bitmap.shallowCopy(), &r.src, r.dst, &r.paint, r.constraint));
 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint));
 DRAW(DrawImage, drawImage(r.image, r.left, r.top, r.paint));
 DRAW(DrawImageRect, legacy_drawImageRect(r.image, r.src, r.dst, r.paint, r.constraint));
@@ -424,24 +414,6 @@
     Bounds bounds(const DrawImageNine& op) const {
         return this->adjustAndMap(op.dst, op.paint);
     }
-    Bounds bounds(const DrawBitmapRect& op) const {
-        return this->adjustAndMap(op.dst, op.paint);
-    }
-    Bounds bounds(const DrawBitmapRectFast& op) const {
-        return this->adjustAndMap(op.dst, op.paint);
-    }
-    Bounds bounds(const DrawBitmapRectFixedSize& op) const {
-        return this->adjustAndMap(op.dst, &op.paint);
-    }
-    Bounds bounds(const DrawBitmapNine& op) const {
-        return this->adjustAndMap(op.dst, op.paint);
-    }
-    Bounds bounds(const DrawBitmap& op) const {
-        return this->adjustAndMap(
-                SkRect::MakeXYWH(op.left, op.top, op.bitmap.width(), op.bitmap.height()),
-                op.paint);
-    }
-
     Bounds bounds(const DrawPath& op) const {
         return op.path.isInverseFillType() ? fCurrentClipBounds
                                            : this->adjustAndMap(op.path.getBounds(), &op.paint);
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index b620b37..42fc510 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -7,14 +7,13 @@
 
 #include "SkBigPicture.h"
 #include "SkCanvasPriv.h"
+#include "SkImage.h"
 #include "SkPatchUtils.h"
 #include "SkPicture.h"
 #include "SkPictureUtils.h"
 #include "SkRecorder.h"
 #include "SkSurface.h"
 
-//#define WRAP_BITMAP_AS_IMAGE
-
 SkDrawableList::~SkDrawableList() {
     fArray.unrefAll();
 }
@@ -180,14 +179,10 @@
                               SkScalar left,
                               SkScalar top,
                               const SkPaint* paint) {
-#ifdef WRAP_BITMAP_AS_IMAGE
-    SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bitmap));
+    sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap);
     if (image) {
-        this->onDrawImage(image, left, top, paint);
+        this->onDrawImage(image.get(), left, top, paint);
     }
-#else
-    APPEND(DrawBitmap, this->copy(paint), bitmap, left, top);
-#endif
 }
 
 void SkRecorder::onDrawBitmapRect(const SkBitmap& bitmap,
@@ -195,34 +190,20 @@
                                   const SkRect& dst,
                                   const SkPaint* paint,
                                   SrcRectConstraint constraint) {
-#ifdef WRAP_BITMAP_AS_IMAGE
-    // TODO: need a way to support the flags for images...
-    SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bitmap));
+    sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap);
     if (image) {
-        this->onDrawImageRect(image, src, dst, paint);
+        this->onDrawImageRect(image.get(), src, dst, paint, constraint);
     }
-#else
-    if (kFast_SrcRectConstraint == constraint) {
-        APPEND(DrawBitmapRectFast, this->copy(paint), bitmap, this->copy(src), dst);
-        return;
-    }
-    SkASSERT(kStrict_SrcRectConstraint == constraint);
-    APPEND(DrawBitmapRect, this->copy(paint), bitmap, this->copy(src), dst);
-#endif
 }
 
 void SkRecorder::onDrawBitmapNine(const SkBitmap& bitmap,
                                   const SkIRect& center,
                                   const SkRect& dst,
                                   const SkPaint* paint) {
-#ifdef WRAP_BITMAP_AS_IMAGE
-    SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bitmap));
+    sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap);
     if (image) {
-        this->onDrawImageNine(image, center, dst, paint);
+        this->onDrawImageNine(image.get(), center, dst, paint);
     }
-#else
-    APPEND(DrawBitmapNine, this->copy(paint), bitmap, center, dst);
-#endif
 }
 
 void SkRecorder::onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
diff --git a/src/core/SkRecords.cpp b/src/core/SkRecords.cpp
index d0a3ddb..81dd92f 100644
--- a/src/core/SkRecords.cpp
+++ b/src/core/SkRecords.cpp
@@ -9,15 +9,6 @@
 #include "SkRecords.h"
 
 namespace SkRecords {
-    ImmutableBitmap::ImmutableBitmap(const SkBitmap& bitmap) {
-        if (bitmap.isImmutable()) {
-            fBitmap = bitmap;
-        } else {
-            bitmap.copyTo(&fBitmap);
-        }
-        fBitmap.setImmutable();
-    }
-
     PreCachedPath::PreCachedPath(const SkPath& path) : SkPath(path) {
         this->updateBoundsCache();
 #if 0  // Disabled to see if we ever really race on this.  It costs time, chromium:496982.