Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: src/image/SkImage_Codec.cpp

Issue 19729007: Add SkImage->draw() call with src and dst rects. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/image/SkImage_Base.h ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « src/image/SkImage_Base.h ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698