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

Side by Side Diff: tests/SerializationTest.cpp

Issue 1535353002: change all factories to return their base-class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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/PictureTest.cpp ('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 "Resources.h" 8 #include "Resources.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkFixed.h" 10 #include "SkFixed.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 239
240 static void TestBitmapSerialization(const SkBitmap& validBitmap, 240 static void TestBitmapSerialization(const SkBitmap& validBitmap,
241 const SkBitmap& invalidBitmap, 241 const SkBitmap& invalidBitmap,
242 bool shouldSucceed, 242 bool shouldSucceed,
243 skiatest::Reporter* reporter) { 243 skiatest::Reporter* reporter) {
244 SkAutoTUnref<SkImage> validImage(SkImage::NewFromBitmap(validBitmap)); 244 SkAutoTUnref<SkImage> validImage(SkImage::NewFromBitmap(validBitmap));
245 SkAutoTUnref<SkImageFilter> validBitmapSource(SkImageSource::Create(validIma ge)); 245 SkAutoTUnref<SkImageFilter> validBitmapSource(SkImageSource::Create(validIma ge));
246 SkAutoTUnref<SkImage> invalidImage(SkImage::NewFromBitmap(invalidBitmap)); 246 SkAutoTUnref<SkImage> invalidImage(SkImage::NewFromBitmap(invalidBitmap));
247 SkAutoTUnref<SkImageFilter> invalidBitmapSource(SkImageSource::Create(invali dImage)); 247 SkAutoTUnref<SkImageFilter> invalidBitmapSource(SkImageSource::Create(invali dImage));
248 SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(SkXfermode::kSrcOver_Mode)) ; 248 SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(SkXfermode::kSrcOver_Mode)) ;
249 SkAutoTUnref<SkXfermodeImageFilter> xfermodeImageFilter( 249 SkAutoTUnref<SkImageFilter> xfermodeImageFilter(
250 SkXfermodeImageFilter::Create(mode, invalidBitmapSource, validBitmapSour ce)); 250 SkXfermodeImageFilter::Create(mode, invalidBitmapSource, validBitmapSour ce));
251 251
252 SkAutoTUnref<SkImageFilter> deserializedFilter( 252 SkAutoTUnref<SkImageFilter> deserializedFilter(
253 TestFlattenableSerialization<SkImageFilter>( 253 TestFlattenableSerialization<SkImageFilter>(
254 xfermodeImageFilter, shouldSucceed, reporter)); 254 xfermodeImageFilter, shouldSucceed, reporter));
255 255
256 // Try to render a small bitmap using the invalid deserialized filter 256 // Try to render a small bitmap using the invalid deserialized filter
257 // to make sure we don't crash while trying to render it 257 // to make sure we don't crash while trying to render it
258 if (shouldSucceed) { 258 if (shouldSucceed) {
259 SkBitmap bitmap; 259 SkBitmap bitmap;
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 539
540 // Deserialize picture 540 // Deserialize picture
541 SkValidatingReadBuffer reader(static_cast<void*>(data.get()), size); 541 SkValidatingReadBuffer reader(static_cast<void*>(data.get()), size);
542 SkAutoTUnref<SkPicture> readPict( 542 SkAutoTUnref<SkPicture> readPict(
543 SkPicture::CreateFromBuffer(reader)); 543 SkPicture::CreateFromBuffer(reader));
544 REPORTER_ASSERT(reporter, readPict.get()); 544 REPORTER_ASSERT(reporter, readPict.get());
545 } 545 }
546 546
547 TestPictureTypefaceSerialization(reporter); 547 TestPictureTypefaceSerialization(reporter);
548 } 548 }
OLDNEW
« no previous file with comments | « tests/PictureTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698