SkCanvas::drawImage is the new way for drawing a SkImage to a Canvas

BUG=skia:2947

Committed: https://skia.googlesource.com/skia/+/432789972c1e1f8a66165c75a250dba1853efa08

R=junov@chromium.org, reed@google.com, bsalomon@google.com

Author: piotaixr@chromium.org

Review URL: https://codereview.chromium.org/583453002
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index dcc7047..afd7fbe 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -12,6 +12,7 @@
 #include "SkDraw.h"
 #include "SkDrawFilter.h"
 #include "SkDrawLooper.h"
+#include "SkImage.h"
 #include "SkMetaData.h"
 #include "SkPathOps.h"
 #include "SkPatchUtils.h"
@@ -183,7 +184,7 @@
         fFilter     = NULL;
         fLayer      = NULL;
         fTopLayer   = NULL;
-        
+
         // don't bother initializing fNext
         inc_rec();
     }
@@ -192,7 +193,7 @@
         fFilter = SkSafeRef(prev.fFilter);
         fLayer = NULL;
         fTopLayer = prev.fTopLayer;
-        
+
         // don't bother initializing fNext
         inc_rec();
     }
@@ -292,7 +293,7 @@
             // can we be marked as simple?
             fIsSimple = !fFilter && !fDoClearImageFilter;
         }
-        
+
         uint32_t oldFlags = paint.getFlags();
         fNewPaintFlags = filter_paint_flags(props, oldFlags);
         if (fIsSimple && (fNewPaintFlags != oldFlags)) {
@@ -457,7 +458,7 @@
     SkNoPixelsBitmapDevice(int width, int height) : INHERITED(make_nopixels(width, height)) {}
 
 private:
-    
+
     typedef SkBitmapDevice INHERITED;
 };
 
@@ -466,7 +467,7 @@
     , fProps(SkSurfaceProps::kLegacyFontHost_InitType)
 {
     inc_canvas();
-    
+
     this->init(SkNEW_ARGS(SkNoPixelsBitmapDevice, (width, height)), kDefault_InitFlags)->unref();
 }
 
@@ -475,7 +476,7 @@
     , fProps(SkSurfaceProps::kLegacyFontHost_InitType)
 {
     inc_canvas();
-    
+
     this->init(SkNEW_ARGS(SkNoPixelsBitmapDevice, (width, height)), flags)->unref();
 }
 
@@ -484,7 +485,7 @@
     , fProps(SkSurfacePropsCopyOrDefault(props))
 {
     inc_canvas();
-    
+
     this->init(device, flags);
 }
 
@@ -493,7 +494,7 @@
     , fProps(SkSurfaceProps::kLegacyFontHost_InitType)
 {
     inc_canvas();
-    
+
     this->init(device, kDefault_InitFlags);
 }
 
@@ -502,7 +503,7 @@
     , fProps(props)
 {
     inc_canvas();
-    
+
     SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap)));
     this->init(device, kDefault_InitFlags);
 }
@@ -512,7 +513,7 @@
     , fProps(SkSurfaceProps::kLegacyFontHost_InitType)
 {
     inc_canvas();
-    
+
     SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap)));
     this->init(device, kDefault_InitFlags);
 }
@@ -1885,6 +1886,17 @@
     LOOPER_END
 }
 
+void SkCanvas::drawImage(const SkImage* image, SkScalar left, SkScalar top,
+                       const SkPaint* paint) {
+    image->draw(this, left, top, paint);
+}
+
+void SkCanvas::drawImageRect(const SkImage* image, const SkRect* src,
+                           const SkRect& dst,
+                           const SkPaint* paint) {
+    image->draw(this, src, dst, paint);
+}
+
 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
                           const SkPaint* paint) {
     SkDEBUGCODE(bitmap.validate();)