Fixes for nacl_debugger's use of picture.
Now that CreateFromStream is used, check for NULL rather than looking at width and height (prevents a crash on an invalid SKP). Unref the picture when done with it. Remove the member variable for picture, since it is only accessed inside the one function. R=borenet@google.com Review URL: https://codereview.chromium.org/18055014 git-svn-id: http://skia.googlecode.com/svn/trunk@9831 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
fa13a632a0
commit
6c4c3a5554
@ -37,7 +37,6 @@ public:
|
||||
explicit SkiaInstance(PP_Instance instance)
|
||||
: pp::Instance(instance)
|
||||
, fCanvas(NULL)
|
||||
, fPicture(NULL)
|
||||
, fFlushLoopRunning(false)
|
||||
, fFlushPending(false)
|
||||
|
||||
@ -68,12 +67,13 @@ public:
|
||||
return;
|
||||
}
|
||||
SkMemoryStream pictureStream(decodedData.getData(), decodedSize);
|
||||
fPicture = SkPicture::CreateFromStream(&pictureStream);
|
||||
if (fPicture->width() == 0 || fPicture->height() == 0) {
|
||||
SkPicture* picture = SkPicture::CreateFromStream(&pictureStream);
|
||||
if (NULL == picture) {
|
||||
SkDebugf("Failed to create SKP.\n");
|
||||
return;
|
||||
}
|
||||
fDebugger.loadPicture(fPicture);
|
||||
fDebugger.loadPicture(picture);
|
||||
picture->unref();
|
||||
|
||||
// Set up the command list.
|
||||
SkTArray<SkString>* commands = fDebugger.getDrawCommandsAsStrings();
|
||||
@ -194,7 +194,6 @@ private:
|
||||
SkBitmap fBitmap;
|
||||
SkCanvas* fCanvas;
|
||||
SkDebugger fDebugger;
|
||||
SkPicture* fPicture;
|
||||
|
||||
bool fFlushLoopRunning;
|
||||
bool fFlushPending;
|
||||
|
Loading…
Reference in New Issue
Block a user