| OLD | NEW |
| 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 Loading... |
| 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 auto colorFilter(SkTableColorFilter::Make(table)); | 289 SkAutoTUnref<SkColorFilter> colorFilter(SkTableColorFilter::Create(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 Loading... |
| 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 |
| OLD | NEW |