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

Unified Diff: src/core/SkPictureRecord.cpp

Issue 1992283002: Add drawBitmapLattice() API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add implementation for SkRecorder and SkPictureRecord Created 4 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
Index: src/core/SkPictureRecord.cpp
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 17ed1aa20b69ea5c1470e82c06280d935bde01a7..878aad029f79fa4578733c870cc708806bc59f97 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "SkCanvasPriv.h"
#include "SkPictureRecord.h"
#include "SkImage_Base.h"
#include "SkPatchUtils.h"
@@ -541,6 +542,23 @@ void SkPictureRecord::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& ce
this->validate(initialOffset, size);
}
+void SkPictureRecord::onDrawBitmapNine(const SkBitmap& bitmap, const NinePatchDivs& divs,
+ const SkRect& dst, const SkPaint* paint) {
+ // dataLen + xCount + yCount + xDivs + yDivs
+ // It is unnecesary to store the dataLen (it can be determined from xCount and yCount),
+ // but it is convenient to use the read/write data helpers.
+ size_t divsSize = (1 + 1 + 1 + divs.fXCount + divs.fYCount) * kUInt32Size;
+
+ // op + paint index + bitmap id + divs + dst rect
+ size_t size = 3 * kUInt32Size + divsSize + sizeof(dst);
+ size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE_DIVS, &size);
+ this->addPaintPtr(paint);
+ this->addBitmap(bitmap);
+ fWriter.writeData(((const SkNinePatchDivs&) divs).asData().get());
+ 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