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

Unified Diff: src/core/SkPicturePlayback.cpp

Issue 316063005: Fix error revealed by Android unit test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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/SkPicturePlayback.cpp
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index 63f2d7e8f93b943d4ed8fc4d5d6b9304a4ba0117..3f83b6a9cccc7080ba3dd36555141e164e7b0bbd 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -59,7 +59,7 @@ SkPicturePlayback::SkPicturePlayback(const SkPicture* picture, const SkPictInfo&
SkPicturePlayback::SkPicturePlayback(const SkPicture* picture,
const SkPictureRecord& record,
const SkPictInfo& info,
- bool deepCopy)
+ bool deepCopyOps)
: fPicture(picture)
, fInfo(info) {
#ifdef SK_DEBUG_SIZE
@@ -107,7 +107,12 @@ SkPicturePlayback::SkPicturePlayback(const SkPicture* picture,
fOpData = SkData::NewEmpty();
return;
}
- fOpData = writer.snapshotAsData();
+ if (deepCopyOps) {
+ // Don't try to do anything clever w.r.t. copy on write
+ fOpData = SkData::NewWithCopy(writer.contiguousArray(), writer.bytesWritten());
reed1 2014/06/10 12:29:03 I presume this continuousArray() call can mutate t
robertphillips 2014/06/10 17:26:28 Right now SkWriter32 does store its data contiguou
+ } else {
+ fOpData = writer.snapshotAsData();
+ }
fBoundingHierarchy = record.fBoundingHierarchy;
fStateTree = record.fStateTree;
@@ -134,12 +139,8 @@ SkPicturePlayback::SkPicturePlayback(const SkPicture* picture,
if (fPictureCount > 0) {
fPictureRefs = SkNEW_ARRAY(const SkPicture*, fPictureCount);
for (int i = 0; i < fPictureCount; i++) {
- if (deepCopy) {
- fPictureRefs[i] = pictures[i]->clone();
scroggo 2014/06/10 13:31:25 Why this change? deepCopy is used when we are clon
robertphillips 2014/06/10 17:26:28 TL;DR - this change has been split off into: (Remo
- } else {
- fPictureRefs[i] = pictures[i];
- fPictureRefs[i]->ref();
- }
+ fPictureRefs[i] = pictures[i];
+ fPictureRefs[i]->ref();
}
}

Powered by Google App Engine
This is Rietveld 408576698