Index: src/image/SkImagePriv.cpp |
diff --git a/src/image/SkImagePriv.cpp b/src/image/SkImagePriv.cpp |
index c44e439b72c8b29eb82837b6dae19797d4b9569b..4ff1c92bff4c00a646a234f0b1d9b79a5f0bdf10 100644 |
--- a/src/image/SkImagePriv.cpp |
+++ b/src/image/SkImagePriv.cpp |
@@ -141,3 +141,33 @@ void SkImagePrivDrawPicture(SkCanvas* canvas, SkPicture* picture, |
canvas->drawPicture(*picture); |
canvas->restoreToCount(saveCount); |
} |
+ |
+void SkImagePrivDrawPicture(SkCanvas* canvas, SkPicture* picture, |
+ const SkRect* src, const SkRect& dst, const SkPaint* paint) { |
+ int saveCount = canvas->getSaveCount(); |
+ |
+ SkMatrix matrix; |
+ SkRect tmpSrc; |
+ |
+ if (NULL != src) { |
+ tmpSrc = *src; |
+ } else { |
+ tmpSrc.set(0, 0, |
+ SkIntToScalar(picture->width()), |
+ SkIntToScalar(picture->height())); |
+ } |
+ |
+ matrix.setRectToRect(tmpSrc, dst, SkMatrix::kFill_ScaleToFit); |
+ if (paint && needs_layer(*paint)) { |
+ canvas->saveLayer(&dst, paint); |
+ } else { |
+ canvas->save(); |
+ } |
+ canvas->concat(matrix); |
+ if (!paint || !needs_layer(*paint)) { |
+ canvas->clipRect(tmpSrc); |
+ } |
+ |
+ canvas->drawPicture(*picture); |
+ canvas->restoreToCount(saveCount); |
+} |