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

Unified Diff: src/core/SkPicturePlayback.cpp

Issue 1918433002: Optionally enable SkValidatingReadBuffer in SkPictureImageFilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More clean up Created 4 years, 8 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.h ('k') | src/core/SkReadBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPicturePlayback.cpp
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index 2c0a164f22aa23aec3f018f381906c0eb4b8da61..3316fe958e2aa68b32bae3b570d20c2411c31483 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -85,27 +85,36 @@ static SkBitmap shallow_copy(const SkBitmap& bitmap) {
return bitmap;
}
-void SkPicturePlayback::draw(SkCanvas* canvas, SkPicture::AbortCallback* callback) {
+void SkPicturePlayback::draw(SkCanvas* canvas,
+ SkPicture::AbortCallback* callback,
+ const SkReadBuffer* buffer) {
AutoResetOpID aroi(this);
SkASSERT(0 == fCurOffset);
- SkReadBuffer reader(fPictureData->opData()->bytes(), fPictureData->opData()->size());
+ SkAutoTDelete<SkReadBuffer> reader;
+ if (buffer) {
+ reader.reset(buffer->clone(fPictureData->opData()->bytes(),
+ fPictureData->opData()->size()));
+ } else {
+ reader.reset(new SkReadBuffer(fPictureData->opData()->bytes(),
+ fPictureData->opData()->size()));
+ }
// Record this, so we can concat w/ it if we encounter a setMatrix()
SkMatrix initialMatrix = canvas->getTotalMatrix();
SkAutoCanvasRestore acr(canvas, false);
- while (!reader.eof()) {
+ while (!reader->eof()) {
if (callback && callback->abort()) {
return;
}
- fCurOffset = reader.offset();
+ fCurOffset = reader->offset();
uint32_t size;
- DrawType op = ReadOpAndSize(&reader, &size);
+ DrawType op = ReadOpAndSize(reader, &size);
- this->handleOp(&reader, op, size, canvas, initialMatrix);
+ this->handleOp(reader, op, size, canvas, initialMatrix);
}
}
« no previous file with comments | « src/core/SkPicturePlayback.h ('k') | src/core/SkReadBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698