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

Side by Side Diff: samplecode/SampleShadowing.cpp

Issue 2323383002: made point lights linear attenuation; also fixed point light depth bug (Closed)
Patch Set: added comments! 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 | « no previous file | src/core/SkRadialShadowMapShader.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 "SkPictureRecorder.h" 9 #include "SkPictureRecorder.h"
10 #include "SkShadowPaintFilterCanvas.h" 10 #include "SkShadowPaintFilterCanvas.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove rride { 159 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove rride {
160 return new SkView::Click(this); 160 return new SkView::Click(this);
161 } 161 }
162 162
163 void updateLights(int x, int y) { 163 void updateLights(int x, int y) {
164 SkLights::Builder builder; 164 SkLights::Builder builder;
165 builder.add(SkLights::Light::MakePoint(SkColor3f::Make(1.0f, 1.0f, 1.0f) , 165 builder.add(SkLights::Light::MakePoint(SkColor3f::Make(1.0f, 1.0f, 1.0f) ,
166 SkVector3::Make(x, 166 SkVector3::Make(x,
167 kHeight - y, 167 kHeight - y,
168 fLightDepth), 168 fLightDepth),
169 100000, true)); 169 400, true));
170 fLights = builder.finish(); 170 fLights = builder.finish();
171 } 171 }
172 172
173 void updateFromSelectedSlider() { 173 void updateFromSelectedSlider() {
174 SkScalar newValue = fSliders[fSelectedSliderID].fGeometry.fLeft * 174 SkScalar newValue = fSliders[fSelectedSliderID].fGeometry.fLeft *
175 fSliders[fSelectedSliderID].fScale + 175 fSliders[fSelectedSliderID].fScale +
176 fSliders[fSelectedSliderID].fOffset; 176 fSliders[fSelectedSliderID].fOffset;
177 177
178 switch (fSelectedSliderID) { 178 switch (fSelectedSliderID) {
179 case 0: 179 case 0:
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 sk_sp<SkLights> fLights; 292 sk_sp<SkLights> fLights;
293 293
294 typedef SampleView INHERITED; 294 typedef SampleView INHERITED;
295 }; 295 };
296 296
297 ////////////////////////////////////////////////////////////////////////////// 297 //////////////////////////////////////////////////////////////////////////////
298 static SkView* MyFactory() { return new ShadowingView; } 298 static SkView* MyFactory() { return new ShadowingView; }
299 static SkViewRegister reg(MyFactory); 299 static SkViewRegister reg(MyFactory);
300 300
301 #endif 301 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkRadialShadowMapShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698