OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkLightingShader.h" | 10 #include "SkLightingShader.h" |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 fControlPanel.drawContent(canvas); | 742 fControlPanel.drawContent(canvas); |
743 canvas->restore(); | 743 canvas->restore(); |
744 | 744 |
745 SkLights::Builder builder; | 745 SkLights::Builder builder; |
746 for (int i = 0; i < kNumLights; i++) { | 746 for (int i = 0; i < kNumLights; i++) { |
747 builder.add(SkLights::Light::MakeDirectional(fLightDefs[i].fColor, | 747 builder.add(SkLights::Light::MakeDirectional(fLightDefs[i].fColor, |
748 SkPoint3::Make(fLightDe
fs[i].fDirXY.fX, | 748 SkPoint3::Make(fLightDe
fs[i].fDirXY.fX, |
749 fLightDe
fs[i].fDirXY.fY, | 749 fLightDe
fs[i].fDirXY.fY, |
750 fLightDe
fs[i].fDirZ))); | 750 fLightDe
fs[i].fDirZ))); |
751 } | 751 } |
752 builder.add(SkLights::Light::MakeAmbient(SkColor3f::Make(0.4f, 0.4f, 0.4
f))); | 752 builder.setAmbientLightColor(SkColor3f::Make(0.4f, 0.4f, 0.4f)); |
753 fLights = builder.finish(); | 753 fLights = builder.finish(); |
754 | 754 |
755 // Draw shapes | 755 // Draw shapes |
756 SkScalar xPos = kCtrlRange + 25.0f; | 756 SkScalar xPos = kCtrlRange + 25.0f; |
757 SkScalar yPos = fShapeBounds.height(); | 757 SkScalar yPos = fShapeBounds.height(); |
758 for (Shape shape : { kCircle_Shape, kRect_Shape }) { | 758 for (Shape shape : { kCircle_Shape, kRect_Shape }) { |
759 canvas->save(); | 759 canvas->save(); |
760 canvas->translate(xPos, yPos); | 760 canvas->translate(xPos, yPos); |
761 this->drawShape(shape, canvas); | 761 this->drawShape(shape, canvas); |
762 canvas->restore(); | 762 canvas->restore(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 sk_sp<SkTypeface> fLabelTypeface; | 824 sk_sp<SkTypeface> fLabelTypeface; |
825 | 825 |
826 typedef SampleView INHERITED; | 826 typedef SampleView INHERITED; |
827 }; | 827 }; |
828 | 828 |
829 ////////////////////////////////////////////////////////////////////////////// | 829 ////////////////////////////////////////////////////////////////////////////// |
830 | 830 |
831 static SkView* MyFactory() { return new BevelView; } | 831 static SkView* MyFactory() { return new BevelView; } |
832 static SkViewRegister reg(MyFactory); | 832 static SkViewRegister reg(MyFactory); |
833 | 833 |
OLD | NEW |