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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 SkMatrix ctm; | 578 SkMatrix ctm; |
579 ctm.setRotate(45); | 579 ctm.setRotate(45); |
580 SkBitmap normals; | 580 SkBitmap normals; |
581 normals.allocN32Pixels(kTexSize, kTexSize); | 581 normals.allocN32Pixels(kTexSize, kTexSize); |
582 | 582 |
583 sk_tool_utils::create_frustum_normal_map(&normals, SkIRect::MakeWH(kTexS
ize, kTexSize)); | 583 sk_tool_utils::create_frustum_normal_map(&normals, SkIRect::MakeWH(kTexS
ize, kTexSize)); |
584 sk_sp<SkShader> normalMap = SkMakeBitmapShader(normals, SkShader::kClamp
_TileMode, | 584 sk_sp<SkShader> normalMap = SkMakeBitmapShader(normals, SkShader::kClamp
_TileMode, |
585 SkShader::kClamp_TileMode
, &matrix, nullptr); | 585 SkShader::kClamp_TileMode
, &matrix, nullptr); |
586 sk_sp<SkNormalSource> normalSource = SkNormalSource::MakeFromNormalMap(s
td::move(normalMap), | 586 sk_sp<SkNormalSource> normalSource = SkNormalSource::MakeFromNormalMap(s
td::move(normalMap), |
587 c
tm); | 587 c
tm); |
588 sk_sp<SkShader> lightingShader = SkLightingShader::Make(diffuse, fLights
, &matrix, | 588 sk_sp<SkShader> diffuseShader = SkMakeBitmapShader(diffuse, SkShader::kC
lamp_TileMode, |
589 std::move(normal
Source)); | 589 SkShader::kClamp_TileMode, &matrix, nullptr); |
| 590 sk_sp<SkShader> lightingShader = SkLightingShader::Make(std::move(diffus
eShader), |
| 591 std::move(normal
Source), |
| 592 fLights); |
590 | 593 |
591 SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get()
, true, reporter)); | 594 SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get()
, true, reporter)); |
592 // TODO test equality? | 595 // TODO test equality? |
593 | 596 |
594 } | 597 } |
595 } | 598 } |
596 | 599 |
597 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 600 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
598 #include "SkAnnotation.h" | 601 #include "SkAnnotation.h" |
599 | 602 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 { r1, SkAnnotationKeys::Define_Named_Dest_Key(), d1 }, | 670 { r1, SkAnnotationKeys::Define_Named_Dest_Key(), d1 }, |
668 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), d2 }, | 671 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), d2 }, |
669 }; | 672 }; |
670 | 673 |
671 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture()); | 674 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture()); |
672 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get())); | 675 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get())); |
673 | 676 |
674 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs)); | 677 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs)); |
675 canvas.drawPicture(pict1); | 678 canvas.drawPicture(pict1); |
676 } | 679 } |
OLD | NEW |