Check for invalid SkPictures
- Remove hasRecorded() since nobody uses it.
- Add "success" boolean to SkPicture stream constructor
- Track failures in render_pictures and bench_pictures
Review URL: https://codereview.appspot.com/6493105
git-svn-id: http://skia.googlecode.com/svn/trunk@5573 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index 8c453c6..4c7ccf7 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -207,10 +207,6 @@
return fRecord;
}
-bool SkPicture::hasRecorded() const {
- return NULL != fRecord && fRecord->writeStream().size() > 0;
-}
-
SkCanvas* SkPicture::getRecordingCanvas() const {
// will be null if we are not recording
return fRecord;
@@ -246,7 +242,10 @@
// V6 : added serialization of SkPath's bounds (and packed its flags tighter)
#define PICTURE_VERSION 6
-SkPicture::SkPicture(SkStream* stream) : SkRefCnt() {
+SkPicture::SkPicture(SkStream* stream, bool* success) : SkRefCnt() {
+ if (success) {
+ *success = false;
+ }
fRecord = NULL;
fPlayback = NULL;
fWidth = fHeight = 0;
@@ -273,6 +272,9 @@
// do this at the end, so that they will be zero if we hit an error.
fWidth = info.fWidth;
fHeight = info.fHeight;
+ if (success) {
+ *success = true;
+ }
}
void SkPicture::serialize(SkWStream* stream) const {