| 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 "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 TestPictureTypefaceSerialization(reporter); | 551 TestPictureTypefaceSerialization(reporter); |
| 552 | 552 |
| 553 // Test SkLightingShader/NormalMapSource serialization | 553 // Test SkLightingShader/NormalMapSource serialization |
| 554 { | 554 { |
| 555 const int kTexSize = 2; | 555 const int kTexSize = 2; |
| 556 | 556 |
| 557 SkLights::Builder builder; | 557 SkLights::Builder builder; |
| 558 | 558 |
| 559 builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(1.0f, 1.0f,
1.0f), | 559 builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(1.0f, 1.0f,
1.0f), |
| 560 SkVector3::Make(1.0f, 0.0f,
0.0f))); | 560 SkVector3::Make(1.0f, 0.0f,
0.0f))); |
| 561 builder.setAmbientLightColor(SkColor3f::Make(0.2f, 0.2f, 0.2f)); | 561 builder.add(SkLights::Light::MakeAmbient(SkColor3f::Make(0.2f, 0.2f, 0.2
f))); |
| 562 | 562 |
| 563 sk_sp<SkLights> fLights = builder.finish(); | 563 sk_sp<SkLights> fLights = builder.finish(); |
| 564 | 564 |
| 565 SkBitmap diffuse = sk_tool_utils::create_checkerboard_bitmap( | 565 SkBitmap diffuse = sk_tool_utils::create_checkerboard_bitmap( |
| 566 kTexSize, kTexSize, | 566 kTexSize, kTexSize, |
| 567 sk_tool_utils::color_to_565(0x0), | 567 sk_tool_utils::color_to_565(0x0), |
| 568 sk_tool_utils::color_to_565(0xFF804020), | 568 sk_tool_utils::color_to_565(0xFF804020), |
| 569 8); | 569 8); |
| 570 | 570 |
| 571 SkRect bitmapBounds = SkRect::MakeIWH(diffuse.width(), diffuse.height())
; | 571 SkRect bitmapBounds = SkRect::MakeIWH(diffuse.width(), diffuse.height())
; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 { r1, SkAnnotationKeys::Define_Named_Dest_Key(), std::move(d1) }, | 693 { r1, SkAnnotationKeys::Define_Named_Dest_Key(), std::move(d1) }, |
| 694 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), std::move(d2) }, | 694 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), std::move(d2) }, |
| 695 }; | 695 }; |
| 696 | 696 |
| 697 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture()); | 697 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture()); |
| 698 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get())); | 698 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get())); |
| 699 | 699 |
| 700 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs)); | 700 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs)); |
| 701 canvas.drawPicture(pict1); | 701 canvas.drawPicture(pict1); |
| 702 } | 702 } |
| OLD | NEW |