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

Side by Side Diff: tests/SerializationTest.cpp

Issue 1852123002: Update SkXfermodeImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Overload Make methods Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « tests/ImageFilterTest.cpp.rej ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkAnnotationKeys.h" 8 #include "SkAnnotationKeys.h"
9 #include "Resources.h" 9 #include "Resources.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 static void TestBitmapSerialization(const SkBitmap& validBitmap, 241 static void TestBitmapSerialization(const SkBitmap& validBitmap,
242 const SkBitmap& invalidBitmap, 242 const SkBitmap& invalidBitmap,
243 bool shouldSucceed, 243 bool shouldSucceed,
244 skiatest::Reporter* reporter) { 244 skiatest::Reporter* reporter) {
245 sk_sp<SkImage> validImage(SkImage::MakeFromBitmap(validBitmap)); 245 sk_sp<SkImage> validImage(SkImage::MakeFromBitmap(validBitmap));
246 sk_sp<SkImageFilter> validBitmapSource(SkImageSource::Make(std::move(validIm age))); 246 sk_sp<SkImageFilter> validBitmapSource(SkImageSource::Make(std::move(validIm age)));
247 sk_sp<SkImage> invalidImage(SkImage::MakeFromBitmap(invalidBitmap)); 247 sk_sp<SkImage> invalidImage(SkImage::MakeFromBitmap(invalidBitmap));
248 sk_sp<SkImageFilter> invalidBitmapSource(SkImageSource::Make(std::move(inval idImage))); 248 sk_sp<SkImageFilter> invalidBitmapSource(SkImageSource::Make(std::move(inval idImage)));
249 sk_sp<SkImageFilter> xfermodeImageFilter( 249 sk_sp<SkImageFilter> xfermodeImageFilter(
250 SkXfermodeImageFilter::Make(SkXfermode::Make(SkXfermode::kSrcOver_Mode), 250 SkXfermodeImageFilter::Make(SkXfermode::Make(SkXfermode::kSrcOver_Mode),
251 invalidBitmapSource.get(), validBitmapSource .get(), nullptr)); 251 std::move(invalidBitmapSource),
252 std::move(validBitmapSource), nullptr));
252 253
253 SkAutoTUnref<SkImageFilter> deserializedFilter( 254 SkAutoTUnref<SkImageFilter> deserializedFilter(
254 TestFlattenableSerialization<SkImageFilter>( 255 TestFlattenableSerialization<SkImageFilter>(
255 xfermodeImageFilter.get(), shouldSucceed, reporter)); 256 xfermodeImageFilter.get(), shouldSucceed, reporter));
256 257
257 // Try to render a small bitmap using the invalid deserialized filter 258 // Try to render a small bitmap using the invalid deserialized filter
258 // to make sure we don't crash while trying to render it 259 // to make sure we don't crash while trying to render it
259 if (shouldSucceed) { 260 if (shouldSucceed) {
260 SkBitmap bitmap; 261 SkBitmap bitmap;
261 bitmap.allocN32Pixels(24, 24); 262 bitmap.allocN32Pixels(24, 24);
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 { r1, SkAnnotationKeys::Define_Named_Dest_Key(), d1 }, 621 { r1, SkAnnotationKeys::Define_Named_Dest_Key(), d1 },
621 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), d2 }, 622 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), d2 },
622 }; 623 };
623 624
624 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture()); 625 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture());
625 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get())); 626 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get()));
626 627
627 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs)); 628 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs));
628 canvas.drawPicture(pict1); 629 canvas.drawPicture(pict1);
629 } 630 }
OLDNEW
« no previous file with comments | « tests/ImageFilterTest.cpp.rej ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698