Fix bug in SampleApp's Tiling View
SampleApp was crashing when invoked as "SampleApp --slide Tiling" due to r14171 (split SkPictureRecorder out of SkPicture - https://codereview.chromium.org/214953003/)
R=bungeman@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/239353006
git-svn-id: http://skia.googlecode.com/svn/trunk@14214 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/SampleTiling.cpp b/samplecode/SampleTiling.cpp
index 7d109fd..d267012 100644
--- a/samplecode/SampleTiling.cpp
+++ b/samplecode/SampleTiling.cpp
@@ -105,7 +105,7 @@
SkPictureRecorder recorder;
SkCanvas* textCanvas = NULL;
- if (fTextPicture->width() == 0) {
+ if (NULL == fTextPicture) {
textCanvas = recorder.beginRecording(1000, 1000);
}
@@ -146,7 +146,7 @@
x += r.width() * 4 / 3;
}
}
- if (textCanvas) {
+ if (NULL != textCanvas) {
SkPaint p;
SkString str;
p.setAntiAlias(true);
@@ -159,8 +159,12 @@
}
}
- fTextPicture.reset(recorder.endRecording());
+ if (NULL != textCanvas) {
+ SkASSERT(NULL == fTextPicture);
+ fTextPicture.reset(recorder.endRecording());
+ }
+ SkASSERT(NULL != fTextPicture);
canvas->drawPicture(*fTextPicture);
}