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

Unified Diff: tests/PictureTest.cpp

Issue 1568613008: unify how canvas checks for null on skia objects (images, blobs, pictures) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: CAPITALIZE the macro, update test now that we don't record the null-image Created 4 years, 11 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
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PictureTest.cpp
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index 86c791ae8a3b548b447b7d26a5da12799a231544..3d05a824a26556ad02c281b21723bcc2fdda8567 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -46,14 +46,13 @@ static void make_bm(SkBitmap* bm, int w, int h, SkColor color, bool immutable) {
// For a while willPlayBackBitmaps() ignored SkImages and just looked for SkBitmaps.
static void test_images_are_found_by_willPlayBackBitmaps(skiatest::Reporter* reporter) {
- // We just need _some_ SkImage.
- SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(SkBitmap()));
+ // We just need _some_ SkImage
+ const SkPMColor pixel = 0;
+ const SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1);
+ SkAutoTUnref<SkImage> image(SkImage::NewRasterCopy(info, &pixel, sizeof(pixel)));
SkPictureRecorder recorder;
- {
- auto canvas = recorder.beginRecording(100,100);
- canvas->drawImage(image, 0,0);
- }
+ recorder.beginRecording(100,100)->drawImage(image, 0,0);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
REPORTER_ASSERT(reporter, picture->willPlayBackBitmaps());
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698