Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(395)

Side by Side Diff: samplecode/SampleBevel.cpp

Issue 2291663002: Revert of Moved ambient lights out of SkLight's light array (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkLights.h ('k') | samplecode/SampleLighting.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.setAmbientLightColor(SkColor3f::Make(0.4f, 0.4f, 0.4f)); 752 builder.add(SkLights::Light::MakeAmbient(SkColor3f::Make(0.4f, 0.4f, 0.4 f)));
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
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
OLDNEW
« no previous file with comments | « include/core/SkLights.h ('k') | samplecode/SampleLighting.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698