Index: src/core/SkCanvas.cpp |
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp |
index dcc7047dbcee58ecf56d9d914a09b109afa3baeb..afd7fbef88bd82c97f7b9b6ced77e259209417cc 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 @@ public: |
fFilter = NULL; |
fLayer = NULL; |
fTopLayer = NULL; |
- |
+ |
// don't bother initializing fNext |
inc_rec(); |
} |
@@ -192,7 +193,7 @@ public: |
fFilter = SkSafeRef(prev.fFilter); |
fLayer = NULL; |
fTopLayer = prev.fTopLayer; |
- |
+ |
// don't bother initializing fNext |
inc_rec(); |
} |
@@ -292,7 +293,7 @@ public: |
// 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 @@ public: |
SkNoPixelsBitmapDevice(int width, int height) : INHERITED(make_nopixels(width, height)) {} |
private: |
- |
+ |
typedef SkBitmapDevice INHERITED; |
}; |
@@ -466,7 +467,7 @@ SkCanvas::SkCanvas(int width, int height) |
, fProps(SkSurfaceProps::kLegacyFontHost_InitType) |
{ |
inc_canvas(); |
- |
+ |
this->init(SkNEW_ARGS(SkNoPixelsBitmapDevice, (width, height)), kDefault_InitFlags)->unref(); |
} |
@@ -475,7 +476,7 @@ SkCanvas::SkCanvas(int width, int height, InitFlags flags) |
, fProps(SkSurfaceProps::kLegacyFontHost_InitType) |
{ |
inc_canvas(); |
- |
+ |
this->init(SkNEW_ARGS(SkNoPixelsBitmapDevice, (width, height)), flags)->unref(); |
} |
@@ -484,7 +485,7 @@ SkCanvas::SkCanvas(SkBaseDevice* device, const SkSurfaceProps* props, InitFlags |
, fProps(SkSurfacePropsCopyOrDefault(props)) |
{ |
inc_canvas(); |
- |
+ |
this->init(device, flags); |
} |
@@ -493,7 +494,7 @@ SkCanvas::SkCanvas(SkBaseDevice* device) |
, fProps(SkSurfaceProps::kLegacyFontHost_InitType) |
{ |
inc_canvas(); |
- |
+ |
this->init(device, kDefault_InitFlags); |
} |
@@ -502,7 +503,7 @@ SkCanvas::SkCanvas(const SkBitmap& bitmap, const SkSurfaceProps& props) |
, fProps(props) |
{ |
inc_canvas(); |
- |
+ |
SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap))); |
this->init(device, kDefault_InitFlags); |
} |
@@ -512,7 +513,7 @@ SkCanvas::SkCanvas(const SkBitmap& bitmap) |
, fProps(SkSurfaceProps::kLegacyFontHost_InitType) |
{ |
inc_canvas(); |
- |
+ |
SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap))); |
this->init(device, kDefault_InitFlags); |
} |
@@ -1885,6 +1886,17 @@ void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) { |
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();) |