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

Side by Side Diff: tests/SerializationTest.cpp

Issue 1827433002: Reland of [2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/RecordOptsTest.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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 SkAutoTUnref<SkXfermode> copy( 279 SkAutoTUnref<SkXfermode> copy(
280 TestFlattenableSerialization<SkXfermode>(mode.get(), true, reporter) ); 280 TestFlattenableSerialization<SkXfermode>(mode.get(), true, reporter) );
281 } 281 }
282 } 282 }
283 283
284 static void TestColorFilterSerialization(skiatest::Reporter* reporter) { 284 static void TestColorFilterSerialization(skiatest::Reporter* reporter) {
285 uint8_t table[256]; 285 uint8_t table[256];
286 for (int i = 0; i < 256; ++i) { 286 for (int i = 0; i < 256; ++i) {
287 table[i] = (i * 41) % 256; 287 table[i] = (i * 41) % 256;
288 } 288 }
289 SkAutoTUnref<SkColorFilter> colorFilter(SkTableColorFilter::Create(table)); 289 auto colorFilter(SkTableColorFilter::Make(table));
290 SkAutoTUnref<SkColorFilter> copy( 290 SkAutoTUnref<SkColorFilter> copy(
291 TestFlattenableSerialization<SkColorFilter>(colorFilter.get(), true, rep orter)); 291 TestFlattenableSerialization<SkColorFilter>(colorFilter.get(), true, rep orter));
292 } 292 }
293 293
294 static SkBitmap draw_picture(SkPicture& picture) { 294 static SkBitmap draw_picture(SkPicture& picture) {
295 SkBitmap bitmap; 295 SkBitmap bitmap;
296 bitmap.allocN32Pixels(SkScalarCeilToInt(picture.cullRect().width()), 296 bitmap.allocN32Pixels(SkScalarCeilToInt(picture.cullRect().width()),
297 SkScalarCeilToInt(picture.cullRect().height())); 297 SkScalarCeilToInt(picture.cullRect().height()));
298 SkCanvas canvas(bitmap); 298 SkCanvas canvas(bitmap);
299 picture.playback(&canvas); 299 picture.playback(&canvas);
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), d2 }, 621 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), d2 },
622 }; 622 };
623 623
624 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture()); 624 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture());
625 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get())); 625 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get()));
626 626
627 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs)); 627 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs));
628 canvas.drawPicture(pict1); 628 canvas.drawPicture(pict1);
629 } 629 }
630 630
OLDNEW
« no previous file with comments | « tests/RecordOptsTest.cpp ('k') | tests/SkColor4fTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698