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

Unified Diff: src/core/SkPictureRecord.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/SkPictureRecord.cpp
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 4b317589681c9d78232945a6aaf70ae9309c5236..520451cb6127e6f525e6b48c6064bbfc9e2ac473 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -480,24 +480,6 @@ void SkPictureRecord::onDrawImage(const SkImage* image, SkScalar x, SkScalar y,
this->validate(initialOffset, size);
}
-void SkPictureRecord::onDrawImageLattice(const SkImage* image, const Lattice& lattice,
- const SkRect& dst, const SkPaint* paint) {
- // xCount + xDivs + yCount+ yDivs
- size_t latticeSize = (1 + lattice.fXCount + 1 + lattice.fYCount) * kUInt32Size;
-
- // op + paint index + image index + lattice + dst rect
- size_t size = 3 * kUInt32Size + latticeSize + sizeof(dst);
- size_t initialOffset = this->addDraw(DRAW_IMAGE_LATTICE, &size);
- this->addPaintPtr(paint);
- this->addImage(image);
- this->addInt(lattice.fXCount);
- fWriter.writePad(lattice.fXDivs, lattice.fXCount * kUInt32Size);
- this->addInt(lattice.fYCount);
- fWriter.writePad(lattice.fYDivs, lattice.fYCount * kUInt32Size);
- this->addRect(dst);
- this->validate(initialOffset, size);
-}
-
void SkPictureRecord::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
const SkPaint* paint, SrcRectConstraint constraint) {
// id + paint_index + image_index + bool_for_src + constraint
@@ -529,6 +511,24 @@ void SkPictureRecord::onDrawImageNine(const SkImage* img, const SkIRect& center,
this->validate(initialOffset, size);
}
+void SkPictureRecord::onDrawImageLattice(const SkImage* image, const Lattice& lattice,
+ const SkRect& dst, const SkPaint* paint) {
+ // xCount + xDivs + yCount+ yDivs
+ size_t latticeSize = (1 + lattice.fXCount + 1 + lattice.fYCount) * kUInt32Size;
+
+ // op + paint index + image index + lattice + dst rect
+ size_t size = 3 * kUInt32Size + latticeSize + sizeof(dst);
+ size_t initialOffset = this->addDraw(DRAW_IMAGE_LATTICE, &size);
+ this->addPaintPtr(paint);
+ this->addImage(image);
+ this->addInt(lattice.fXCount);
+ fWriter.writePad(lattice.fXDivs, lattice.fXCount * kUInt32Size);
+ this->addInt(lattice.fYCount);
+ fWriter.writePad(lattice.fYDivs, lattice.fYCount * kUInt32Size);
+ this->addRect(dst);
+ this->validate(initialOffset, size);
+}
+
void SkPictureRecord::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
const SkPaint& paint) {
// op + paint index + length + 'length' worth of chars + x + y

Powered by Google App Engine
This is Rietveld 408576698