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

Unified Diff: src/core/SkPictureRecord.cpp

Issue 467683003: Add missing DRAW_PICTURE_MATRIX_PAINT paint offset. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: New order: paint->matrix->picture Created 6 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
« no previous file with comments | « src/core/SkPicturePlayback.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPictureRecord.cpp
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 7fc48e3c7839a1d725553183ff831b460d7aa3d4..b79b185b2d04a04d9d37a49e479e0591eb8abe7e 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -68,7 +68,7 @@ SkPictureRecord::~SkPictureRecord() {
// this method)
static inline size_t getPaintOffset(DrawType op, size_t opSize) {
// These offsets are where the paint would be if the op size doesn't overflow
- static const uint8_t gPaintOffsets[LAST_DRAWTYPE_ENUM + 1] = {
+ static const uint8_t gPaintOffsets[] = {
0, // UNUSED - no paint
0, // CLIP_PATH - no paint
0, // CLIP_REGION - no paint
@@ -113,6 +113,7 @@ static inline size_t getPaintOffset(DrawType op, size_t opSize) {
0, // PUSH_CULL - no paint
0, // POP_CULL - no paint
1, // DRAW_PATCH - right after op code
+ 1, // DRAW_PICTURE_MATRIX_PAINT - right after op code
};
SK_COMPILE_ASSERT(sizeof(gPaintOffsets) == LAST_DRAWTYPE_ENUM + 1,
@@ -1214,9 +1215,11 @@ void SkPictureRecord::onDrawPicture(const SkPicture* picture, const SkMatrix* ma
const SkMatrix& m = matrix ? *matrix : SkMatrix::I();
size += m.writeToMemory(NULL) + kUInt32Size; // matrix + paint
initialOffset = this->addDraw(DRAW_PICTURE_MATRIX_PAINT, &size);
- this->addPicture(picture);
- this->addMatrix(m);
+ SkASSERT(initialOffset + getPaintOffset(DRAW_PICTURE_MATRIX_PAINT, size)
+ == fWriter.bytesWritten());
this->addPaintPtr(paint);
+ this->addMatrix(m);
+ this->addPicture(picture);
}
this->validate(initialOffset, size);
}
« no previous file with comments | « src/core/SkPicturePlayback.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698