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

Unified Diff: src/image/SkImage_Raster.cpp

Issue 1127993004: Revert of Revert of Revert of Make drawImage a virtual on SkDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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_Gpu.cpp ('k') | src/pipe/SkGPipePriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImage_Raster.cpp
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index 20ae62c9f75ff191db6620e3b3cdf212f9c6129b..acf805829d5d97579d97eb35e27976635fd711d4 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -53,6 +53,8 @@
SkImage_Raster(const SkImageInfo&, SkData*, size_t rb, const SkSurfaceProps*);
virtual ~SkImage_Raster();
+ void onDraw(SkCanvas*, SkScalar, SkScalar, const SkPaint*) const override;
+ void onDrawRect(SkCanvas*, const SkRect*, const SkRect&, const SkPaint*) const override;
SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) const override;
bool onReadPixels(const SkImageInfo&, void*, size_t, int srcX, int srcY) const override;
const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const override;
@@ -118,6 +120,17 @@
return SkShader::CreateBitmapShader(fBitmap, tileX, tileY, localMatrix);
}
+void SkImage_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const {
+ SkBitmap shallowCopy(fBitmap);
+ canvas->drawBitmap(shallowCopy, x, y, paint);
+}
+
+void SkImage_Raster::onDrawRect(SkCanvas* canvas, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint) const {
+ SkBitmap shallowCopy(fBitmap);
+ canvas->drawBitmapRectToRect(shallowCopy, src, dst, paint);
+}
+
SkSurface* SkImage_Raster::onNewSurface(const SkImageInfo& info, const SkSurfaceProps& props) const {
return SkSurface::NewRaster(info, &props);
}
« no previous file with comments | « src/image/SkImage_Gpu.cpp ('k') | src/pipe/SkGPipePriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698