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

Side by Side Diff: gm/lightingshader2.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 | « gm/lightingshader.cpp ('k') | gm/lightingshaderbevel.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 "gm.h" 8 #include "gm.h"
9 #include "SkLightingShader.h" 9 #include "SkLightingShader.h"
10 #include "SkNormalSource.h" 10 #include "SkNormalSource.h"
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 41
42 void onOnceBeforeDraw() override { 42 void onOnceBeforeDraw() override {
43 const SkVector3 kLightFromUpperRight = SkVector3::Make(0.788f, 0.394f, 0 .473f); 43 const SkVector3 kLightFromUpperRight = SkVector3::Make(0.788f, 0.394f, 0 .473f);
44 const SkVector3 kLightFromUpperLeft = SkVector3::Make(-0.788f, 0.394f, 0 .473f); 44 const SkVector3 kLightFromUpperLeft = SkVector3::Make(-0.788f, 0.394f, 0 .473f);
45 45
46 // Standard set of lights 46 // Standard set of lights
47 SkLights::Builder builder; 47 SkLights::Builder builder;
48 builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(1.0f, 1.0f, 1.0f), 48 builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(1.0f, 1.0f, 1.0f),
49 kLightFromUpperRight)); 49 kLightFromUpperRight));
50 builder.setAmbientLightColor(SkColor3f::Make(0.2f, 0.2f, 0.2f)); 50 builder.add(SkLights::Light::MakeAmbient(SkColor3f::Make(0.2f, 0.2f, 0.2 f)));
51 fLights = builder.finish(); 51 fLights = builder.finish();
52 52
53 // No directional lights 53 // No directional lights
54 SkLights::Builder builderNoDir; 54 SkLights::Builder builderNoDir;
55 builderNoDir.setAmbientLightColor(SkColor3f::Make(0.2f, 0.2f, 0.2f)); 55 builderNoDir.add(SkLights::Light::MakeAmbient(SkColor3f::Make(0.2f, 0.2f , 0.2f)));
56 fLightsNoDir = builderNoDir.finish(); 56 fLightsNoDir = builderNoDir.finish();
57 57
58 // Two directional lights 58 // Two directional lights
59 SkLights::Builder builderTwoDir; 59 SkLights::Builder builderTwoDir;
60 builderTwoDir.add(SkLights::Light::MakeDirectional(SkColor3f::Make(1.0f, 0.0f, 1.0f), 60 builderTwoDir.add(SkLights::Light::MakeDirectional(SkColor3f::Make(1.0f, 0.0f, 1.0f),
61 kLightFromUpperRight) ); 61 kLightFromUpperRight) );
62 builderTwoDir.add(SkLights::Light::MakeDirectional(SkColor3f::Make(0.0f, 1.0f, 1.0f), 62 builderTwoDir.add(SkLights::Light::MakeDirectional(SkColor3f::Make(0.0f, 1.0f, 1.0f),
63 kLightFromUpperLeft)) ; 63 kLightFromUpperLeft)) ;
64 builderTwoDir.setAmbientLightColor(SkColor3f::Make(0.2f, 0.2f, 0.2f)); 64 builderTwoDir.add(SkLights::Light::MakeAmbient(SkColor3f::Make(0.2f, 0.2 f, 0.2f)));
65 fLightsTwoDir = builderTwoDir.finish(); 65 fLightsTwoDir = builderTwoDir.finish();
66 66
67 fRect = SkRect::MakeIWH(kTexSize, kTexSize); 67 fRect = SkRect::MakeIWH(kTexSize, kTexSize);
68 SkMatrix matrix; 68 SkMatrix matrix;
69 SkRect bitmapBounds = SkRect::MakeIWH(kTexSize, kTexSize); 69 SkRect bitmapBounds = SkRect::MakeIWH(kTexSize, kTexSize);
70 matrix.setRectToRect(bitmapBounds, fRect, SkMatrix::kFill_ScaleToFit); 70 matrix.setRectToRect(bitmapBounds, fRect, SkMatrix::kFill_ScaleToFit);
71 71
72 SkBitmap opaqueDiffuseMap = sk_tool_utils::create_checkerboard_bitmap( 72 SkBitmap opaqueDiffuseMap = sk_tool_utils::create_checkerboard_bitmap(
73 kTexSize, kTexSize, 73 kTexSize, kTexSize,
74 sk_tool_utils::color_to_565(0x0), 74 sk_tool_utils::color_to_565(0x0),
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 sk_sp<SkLights> fLightsNoDir; 265 sk_sp<SkLights> fLightsNoDir;
266 sk_sp<SkLights> fLightsTwoDir; 266 sk_sp<SkLights> fLightsTwoDir;
267 267
268 typedef GM INHERITED; 268 typedef GM INHERITED;
269 }; 269 };
270 270
271 ////////////////////////////////////////////////////////////////////////////// 271 //////////////////////////////////////////////////////////////////////////////
272 272
273 DEF_GM(return new LightingShader2GM;) 273 DEF_GM(return new LightingShader2GM;)
274 } 274 }
OLDNEW
« no previous file with comments | « gm/lightingshader.cpp ('k') | gm/lightingshaderbevel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698