Index: src/core/SkPictureRecord.cpp |
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp |
index f6da2f27932698002c1081b1277235d85dedd2f3..4a5aff2d722d7a66c66eac6a75a1ec20cbf52bef 100644 |
--- a/src/core/SkPictureRecord.cpp |
+++ b/src/core/SkPictureRecord.cpp |
@@ -293,15 +293,14 @@ static bool match(SkWriter32* writer, uint32_t offset, |
int numMatched; |
for (numMatched = 0; numMatched < numCommands && curOffset < writer->bytesWritten(); ++numMatched) { |
DrawType op = peek_op_and_size(writer, curOffset, &curSize); |
- while (NOOP == op && curOffset < writer->bytesWritten()) { |
+ while (NOOP == op) { |
curOffset += curSize; |
+ if (curOffset >= writer->bytesWritten()) { |
+ return false; |
+ } |
op = peek_op_and_size(writer, curOffset, &curSize); |
} |
- if (curOffset >= writer->bytesWritten()) { |
- return false; // ran out of byte stream |
- } |
- |
if (kDRAW_BITMAP_FLAVOR == pattern[numMatched]) { |
if (DRAW_BITMAP != op && DRAW_BITMAP_MATRIX != op && |
DRAW_BITMAP_NINE != op && DRAW_BITMAP_RECT_TO_RECT != op) { |
@@ -1649,6 +1648,11 @@ void SkPictureRecord::addPoints(const SkPoint pts[], int count) { |
#endif |
} |
+void SkPictureRecord::addNoOp() { |
+ size_t size = kUInt32Size; // op |
+ this->addDraw(NOOP, &size); |
+} |
+ |
void SkPictureRecord::addRect(const SkRect& rect) { |
#ifdef SK_DEBUG_SIZE |
size_t start = fWriter.bytesWritten(); |