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

Unified Diff: src/core/SkPicture.cpp

Issue 24826002: Allow creating a picture from skp to fail. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Interesting bit - return false on error. Created 7 years, 3 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/SkPicture.cpp
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index a1aa35e61e09f1447e65f70271d9c49cd3db46d6..18e229ca233f182effd9168f241fd1641e6400d3 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -310,7 +310,12 @@ SkPicture* SkPicture::CreateFromStream(SkStream* stream, InstallPixelRefProc pro
SkPicturePlayback* playback;
// Check to see if there is a playback to recreate.
if (stream->readBool()) {
- playback = SkNEW_ARGS(SkPicturePlayback, (stream, info, proc));
+ bool isValid = false;
caryclark 2013/09/26 21:12:46 It looks like this argues for creating a SkPicture
reed1 2013/09/26 21:16:07 +1
scroggo 2013/09/26 22:17:46 I think that is generally a better pattern (this c
+ playback = SkNEW_ARGS(SkPicturePlayback, (stream, info, &isValid, proc));
+ if (!isValid) {
+ SkDELETE(playback);
+ return NULL;
+ }
} else {
playback = NULL;
}

Powered by Google App Engine
This is Rietveld 408576698