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

Side by Side Diff: tests/SerializationTest.cpp

Issue 1810813003: update callsites for Make image factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: start to take advantage of sk_sp drawImage Created 4 years, 9 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/RecorderTest.cpp ('k') | tests/SkColor4fTest.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 "SkAnnotationKeys.h" 8 #include "SkAnnotationKeys.h"
9 #include "Resources.h" 9 #include "Resources.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 SkValidatingReadBuffer buffer2(dataWritten, bytesWritten); 235 SkValidatingReadBuffer buffer2(dataWritten, bytesWritten);
236 success = SerializationUtils<T>::Read(buffer2, dataRead, kArraySize); 236 success = SerializationUtils<T>::Read(buffer2, dataRead, kArraySize);
237 // This should have succeeded, since there are enough bytes to read this 237 // This should have succeeded, since there are enough bytes to read this
238 REPORTER_ASSERT(reporter, success); 238 REPORTER_ASSERT(reporter, success);
239 } 239 }
240 240
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 SkAutoTUnref<SkImage> validImage(SkImage::NewFromBitmap(validBitmap)); 245 sk_sp<SkImage> validImage(SkImage::MakeFromBitmap(validBitmap));
246 SkAutoTUnref<SkImageFilter> validBitmapSource(SkImageSource::Create(validIma ge)); 246 SkAutoTUnref<SkImageFilter> validBitmapSource(SkImageSource::Create(validIma ge.get()));
247 SkAutoTUnref<SkImage> invalidImage(SkImage::NewFromBitmap(invalidBitmap)); 247 sk_sp<SkImage> invalidImage(SkImage::MakeFromBitmap(invalidBitmap));
248 SkAutoTUnref<SkImageFilter> invalidBitmapSource(SkImageSource::Create(invali dImage)); 248 SkAutoTUnref<SkImageFilter> invalidBitmapSource(SkImageSource::Create(invali dImage.get()));
249 SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(SkXfermode::kSrcOver_Mode)) ; 249 SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(SkXfermode::kSrcOver_Mode)) ;
250 SkAutoTUnref<SkImageFilter> xfermodeImageFilter( 250 SkAutoTUnref<SkImageFilter> xfermodeImageFilter(
251 SkXfermodeImageFilter::Create(mode, invalidBitmapSource, validBitmapSour ce)); 251 SkXfermodeImageFilter::Create(mode, invalidBitmapSource, validBitmapSour ce));
252 252
253 SkAutoTUnref<SkImageFilter> deserializedFilter( 253 SkAutoTUnref<SkImageFilter> deserializedFilter(
254 TestFlattenableSerialization<SkImageFilter>( 254 TestFlattenableSerialization<SkImageFilter>(
255 xfermodeImageFilter, shouldSucceed, reporter)); 255 xfermodeImageFilter, shouldSucceed, reporter));
256 256
257 // Try to render a small bitmap using the invalid deserialized filter 257 // Try to render a small bitmap using the invalid deserialized filter
258 // to make sure we don't crash while trying to render it 258 // to make sure we don't crash while trying to render it
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), d2 }, 622 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), d2 },
623 }; 623 };
624 624
625 SkAutoTUnref<SkPicture> pict0(recorder.endRecording()); 625 SkAutoTUnref<SkPicture> pict0(recorder.endRecording());
626 SkAutoTUnref<SkPicture> pict1(copy_picture_via_serialization(pict0)); 626 SkAutoTUnref<SkPicture> pict1(copy_picture_via_serialization(pict0));
627 627
628 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs)); 628 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs));
629 canvas.drawPicture(pict1); 629 canvas.drawPicture(pict1);
630 } 630 }
631 631
OLDNEW
« no previous file with comments | « tests/RecorderTest.cpp ('k') | tests/SkColor4fTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698