Index: src/image/SkImage_Codec.cpp |
diff --git a/src/image/SkImage_Codec.cpp b/src/image/SkImage_Codec.cpp |
index 61661de3569f86b4faf479ad43fb17219468d29c..b9a8990838fa8c587c26b7005ddb46d2250586cf 100644 |
--- a/src/image/SkImage_Codec.cpp |
+++ b/src/image/SkImage_Codec.cpp |
@@ -19,6 +19,7 @@ public: |
virtual ~SkImage_Codec(); |
virtual void onDraw(SkCanvas*, SkScalar, SkScalar, const SkPaint*) SK_OVERRIDE; |
+ virtual void onDrawRectToRect(SkCanvas*, const SkRect*, const SkRect&, const SkPaint*) SK_OVERRIDE; |
private: |
SkData* fEncodedData; |
@@ -48,6 +49,17 @@ void SkImage_Codec::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPai |
canvas->drawBitmap(fBitmap, x, y, paint); |
} |
+void SkImage_Codec::onDrawRectToRect(SkCanvas* canvas, const SkRect* src, |
+ const SkRect& dst, const SkPaint* paint) { |
+ if (!fBitmap.pixelRef()) { |
+ if (!SkImageDecoder::DecodeMemory(fEncodedData->bytes(), fEncodedData->size(), |
+ &fBitmap)) { |
+ return; |
+ } |
+ } |
+ canvas->drawBitmapRectToRect(fBitmap, src, dst, paint); |
+} |
+ |
/////////////////////////////////////////////////////////////////////////////// |
SkImage* SkImage::NewEncodedData(SkData* data) { |