| 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 "Resources.h" | 8 #include "Resources.h" |
| 9 #include "SkAnnotationKeys.h" | 9 #include "SkAnnotationKeys.h" |
| 10 #include "SkBitmapProcShader.h" | 10 #include "SkBitmapProcShader.h" |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 lightingShader = SkLightingShader::Make(nullptr, | 601 lightingShader = SkLightingShader::Make(nullptr, |
| 602 std::move(normalSource), | 602 std::move(normalSource), |
| 603 fLights); | 603 fLights); |
| 604 SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get()
, true, reporter)); | 604 SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get()
, true, reporter)); |
| 605 | 605 |
| 606 lightingShader = SkLightingShader::Make(nullptr, | 606 lightingShader = SkLightingShader::Make(nullptr, |
| 607 nullptr, | 607 nullptr, |
| 608 fLights); | 608 fLights); |
| 609 SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get()
, true, reporter)); | 609 SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get()
, true, reporter)); |
| 610 } | 610 } |
| 611 |
| 612 // Test NormalBevelSource serialization |
| 613 { |
| 614 sk_sp<SkNormalSource> bevelSource = SkNormalSource::MakeBevel( |
| 615 SkNormalSource::BevelType::kLinear, 2.0f, 5.0f); |
| 616 |
| 617 SkAutoTUnref<SkNormalSource>(TestFlattenableSerialization(bevelSource.ge
t(), true, |
| 618 reporter)); |
| 619 // TODO test equality? |
| 620 |
| 621 } |
| 611 } | 622 } |
| 612 | 623 |
| 613 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 624 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 614 #include "SkAnnotation.h" | 625 #include "SkAnnotation.h" |
| 615 | 626 |
| 616 static sk_sp<SkPicture> copy_picture_via_serialization(SkPicture* src) { | 627 static sk_sp<SkPicture> copy_picture_via_serialization(SkPicture* src) { |
| 617 SkDynamicMemoryWStream wstream; | 628 SkDynamicMemoryWStream wstream; |
| 618 src->serialize(&wstream); | 629 src->serialize(&wstream); |
| 619 SkAutoTDelete<SkStreamAsset> rstream(wstream.detachAsStream()); | 630 SkAutoTDelete<SkStreamAsset> rstream(wstream.detachAsStream()); |
| 620 return SkPicture::MakeFromStream(rstream); | 631 return SkPicture::MakeFromStream(rstream); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 { r1, SkAnnotationKeys::Define_Named_Dest_Key(), d1 }, | 694 { r1, SkAnnotationKeys::Define_Named_Dest_Key(), d1 }, |
| 684 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), d2 }, | 695 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), d2 }, |
| 685 }; | 696 }; |
| 686 | 697 |
| 687 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture()); | 698 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture()); |
| 688 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get())); | 699 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get())); |
| 689 | 700 |
| 690 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs)); | 701 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs)); |
| 691 canvas.drawPicture(pict1); | 702 canvas.drawPicture(pict1); |
| 692 } | 703 } |
| OLD | NEW |