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 |