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

Side by Side Diff: tests/SerializationTest.cpp

Issue 2396953002: Revert[8] "replace SkXfermode obj with SkBlendMode enum in paints" (Closed)
Patch Set: add tmp virtual to unroll legacy arithmodes Created 4 years, 2 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/RecordingXfermodeTest.cpp ('k') | tests/WritePixelsTest.cpp » ('j') | 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 "Resources.h" 8 #include "Resources.h"
9 #include "SkAnnotationKeys.h" 9 #include "SkAnnotationKeys.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 static void TestBitmapSerialization(const SkBitmap& validBitmap, 254 static void TestBitmapSerialization(const SkBitmap& validBitmap,
255 const SkBitmap& invalidBitmap, 255 const SkBitmap& invalidBitmap,
256 bool shouldSucceed, 256 bool shouldSucceed,
257 skiatest::Reporter* reporter) { 257 skiatest::Reporter* reporter) {
258 sk_sp<SkImage> validImage(SkImage::MakeFromBitmap(validBitmap)); 258 sk_sp<SkImage> validImage(SkImage::MakeFromBitmap(validBitmap));
259 sk_sp<SkImageFilter> validBitmapSource(SkImageSource::Make(std::move(validIm age))); 259 sk_sp<SkImageFilter> validBitmapSource(SkImageSource::Make(std::move(validIm age)));
260 sk_sp<SkImage> invalidImage(SkImage::MakeFromBitmap(invalidBitmap)); 260 sk_sp<SkImage> invalidImage(SkImage::MakeFromBitmap(invalidBitmap));
261 sk_sp<SkImageFilter> invalidBitmapSource(SkImageSource::Make(std::move(inval idImage))); 261 sk_sp<SkImageFilter> invalidBitmapSource(SkImageSource::Make(std::move(inval idImage)));
262 sk_sp<SkImageFilter> xfermodeImageFilter( 262 sk_sp<SkImageFilter> xfermodeImageFilter(
263 SkXfermodeImageFilter::Make(SkXfermode::Make(SkXfermode::kSrcOver_Mode), 263 SkXfermodeImageFilter::Make(SkBlendMode::kSrcOver,
264 std::move(invalidBitmapSource), 264 std::move(invalidBitmapSource),
265 std::move(validBitmapSource), nullptr)); 265 std::move(validBitmapSource), nullptr));
266 266
267 SkAutoTUnref<SkImageFilter> deserializedFilter( 267 SkAutoTUnref<SkImageFilter> deserializedFilter(
268 TestFlattenableSerialization<SkImageFilter>( 268 TestFlattenableSerialization<SkImageFilter>(
269 xfermodeImageFilter.get(), shouldSucceed, reporter)); 269 xfermodeImageFilter.get(), shouldSucceed, reporter));
270 270
271 // Try to render a small bitmap using the invalid deserialized filter 271 // Try to render a small bitmap using the invalid deserialized filter
272 // to make sure we don't crash while trying to render it 272 // to make sure we don't crash while trying to render it
273 if (shouldSucceed) { 273 if (shouldSucceed) {
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 { r1, SkAnnotationKeys::Define_Named_Dest_Key(), std::move(d1) }, 715 { r1, SkAnnotationKeys::Define_Named_Dest_Key(), std::move(d1) },
716 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), std::move(d2) }, 716 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), std::move(d2) },
717 }; 717 };
718 718
719 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture()); 719 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture());
720 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get())); 720 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get()));
721 721
722 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs)); 722 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs));
723 canvas.drawPicture(pict1); 723 canvas.drawPicture(pict1);
724 } 724 }
OLDNEW
« no previous file with comments | « tests/RecordingXfermodeTest.cpp ('k') | tests/WritePixelsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698