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

Unified Diff: src/core/SkDevice.cpp

Issue 2205273003: Add onDrawBitmapLattice(), avoid unnecessary bitmap->image copy (Closed) Base URL: https://skia.googlesource.com/skia.git@copypaste
Patch Set: Move bitmap virtual into SkBaseDevice Created 4 years, 4 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
Index: src/core/SkDevice.cpp
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index 59408dc64abe0074b36842ff106632985285441d..5fd1b9fc1427d5b402a75d913819b364e62a6ae0 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -12,6 +12,7 @@
#include "SkImage_Base.h"
#include "SkImageFilter.h"
#include "SkImageFilterCache.h"
+#include "SkImagePriv.h"
#include "SkLatticeIter.h"
#include "SkMetaData.h"
#include "SkPatchUtils.h"
@@ -152,17 +153,6 @@ void SkBaseDevice::drawImage(const SkDraw& draw, const SkImage* image, SkScalar
}
}
-void SkBaseDevice::drawImageLattice(const SkDraw& draw, const SkImage* image,
- const SkCanvas::Lattice& lattice, const SkRect& dst,
- const SkPaint& paint) {
- SkLatticeIter iter(image->width(), image->height(), lattice, dst);
-
- SkRect srcR, dstR;
- while (iter.next(&srcR, &dstR)) {
- this->drawImageRect(draw, image, &srcR, dstR, paint, SkCanvas::kStrict_SrcRectConstraint);
- }
-}
-
void SkBaseDevice::drawImageRect(const SkDraw& draw, const SkImage* image, const SkRect* src,
const SkRect& dst, const SkPaint& paint,
SkCanvas::SrcRectConstraint constraint) {
@@ -193,6 +183,24 @@ void SkBaseDevice::drawBitmapNine(const SkDraw& draw, const SkBitmap& bitmap, co
}
}
+void SkBaseDevice::drawImageLattice(const SkDraw& draw, const SkImage* image,
+ const SkCanvas::Lattice& lattice, const SkRect& dst,
+ const SkPaint& paint) {
+ SkLatticeIter iter(image->width(), image->height(), lattice, dst);
+
+ SkRect srcR, dstR;
+ while (iter.next(&srcR, &dstR)) {
+ this->drawImageRect(draw, image, &srcR, dstR, paint, SkCanvas::kStrict_SrcRectConstraint);
+ }
+}
+
+void SkBaseDevice::drawBitmapLattice(const SkDraw& draw, const SkBitmap& bitmap,
+ const SkCanvas::Lattice& lattice, const SkRect& dst,
+ const SkPaint& paint) {
+ sk_sp<SkImage> image = SkMakeImageFromRasterBitmap(bitmap, kNever_ForceCopyMode);
msarett 2016/08/03 15:49:23 So now we convert image->bitmap here. No need to
reed1 2016/08/15 20:34:43 Since this trick with kNever is only safe for Rast
msarett 2016/08/15 20:43:03 sgtm, that seems like the right think to do. I'm
+ this->drawImageLattice(draw, image.get(), lattice, dst, paint);
+}
+
void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkRSXform xform[],
const SkRect tex[], const SkColor colors[], int count,
SkXfermode::Mode mode, const SkPaint& paint) {
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkPictureRecord.h » ('j') | src/pdf/SkPDFCanvas.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698