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

Unified Diff: src/core/SkRecorder.cpp

Issue 2205273003: Add onDrawBitmapLattice(), avoid unnecessary bitmap->image copy (Closed) Base URL: https://skia.googlesource.com/skia.git@copypaste
Patch Set: Add support for SkLiteRecorder 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/SkRecorder.cpp
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index 7ffb1f4c443f24028bceeb753f212df4338370c6..b961c7d1e79a0a186af157c669e3645f24805d8c 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -206,21 +206,17 @@ void SkRecorder::onDrawBitmapNine(const SkBitmap& bitmap,
}
}
+void SkRecorder::onDrawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice,
+ const SkRect& dst, const SkPaint* paint) {
+ sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap);
+ this->onDrawImageLattice(image.get(), lattice, dst, paint);
+}
+
void SkRecorder::onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
const SkPaint* paint) {
APPEND(DrawImage, this->copy(paint), sk_ref_sp(image), left, top);
}
-void SkRecorder::onDrawImageLattice(const SkImage* image,
- const Lattice& lattice,
- const SkRect& dst,
- const SkPaint* paint) {
- APPEND(DrawImageLattice, this->copy(paint), sk_ref_sp(image),
- lattice.fXCount, this->copy(lattice.fXDivs, lattice.fXCount),
- lattice.fYCount, this->copy(lattice.fYDivs, lattice.fYCount), dst);
-}
-
-
void SkRecorder::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
const SkPaint* paint, SrcRectConstraint constraint) {
APPEND(DrawImageRect, this->copy(paint), sk_ref_sp(image), this->copy(src), dst, constraint);
@@ -231,6 +227,13 @@ void SkRecorder::onDrawImageNine(const SkImage* image, const SkIRect& center,
APPEND(DrawImageNine, this->copy(paint), sk_ref_sp(image), center, dst);
}
+void SkRecorder::onDrawImageLattice(const SkImage* image, const Lattice& lattice, const SkRect& dst,
+ const SkPaint* paint) {
+ APPEND(DrawImageLattice, this->copy(paint), sk_ref_sp(image),
+ lattice.fXCount, this->copy(lattice.fXDivs, lattice.fXCount),
+ lattice.fYCount, this->copy(lattice.fYDivs, lattice.fYCount), dst);
+}
+
void SkRecorder::onDrawText(const void* text, size_t byteLength,
SkScalar x, SkScalar y, const SkPaint& paint) {
APPEND(DrawText,

Powered by Google App Engine
This is Rietveld 408576698