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

Side by Side Diff: gm/shadowmaps.cpp

Issue 2311223004: added in radial shadows (Closed)
Patch Set: moving lights 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 | gyp/core.gypi » ('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 8
9 #include "gm.h" 9 #include "gm.h"
10 #include "SkPathEffect.h" 10 #include "SkPathEffect.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 builder.setAmbientLightColor(SkColor3f::Make(0.4f, 0.4f, 0.4f)); 77 builder.setAmbientLightColor(SkColor3f::Make(0.4f, 0.4f, 0.4f));
78 fLights = builder.finish(); 78 fLights = builder.finish();
79 79
80 fShadowParams.fShadowRadius = 4.0f; 80 fShadowParams.fShadowRadius = 4.0f;
81 fShadowParams.fBiasingConstant = 0.3f; 81 fShadowParams.fBiasingConstant = 0.3f;
82 fShadowParams.fMinVariance = 1024; 82 fShadowParams.fMinVariance = 1024;
83 fShadowParams.fType = SkShadowParams::kVariance_ShadowType; 83 fShadowParams.fType = SkShadowParams::kVariance_ShadowType;
84 } 84 }
85 85
86 protected: 86 protected:
87 constexpr int kWidth = 400; 87 static constexpr int kWidth = 400;
88 constexpr int kHeight = 400; 88 static constexpr int kHeight = 400;
89 89
90 SkString onShortName() override { 90 SkString onShortName() override {
91 return SkString("shadowmaps"); 91 return SkString("shadowmaps");
92 } 92 }
93 93
94 SkISize onISize() override { 94 SkISize onISize() override {
95 return SkISize::Make(kWidth, kHeight); 95 return SkISize::Make(kWidth, kHeight);
96 } 96 }
97 97
98 void onDraw(SkCanvas* canvas) override { 98 void onDraw(SkCanvas* canvas) override {
99 // This picture stores the picture of the scene. 99 // This picture stores the picture of the scene.
100 // It's used to generate the depth maps. 100 // It's used to generate the depth maps.
101 sk_sp<SkPicture> pic(make_test_picture(kWidth, kHeight)); 101 sk_sp<SkPicture> pic(make_test_picture(kWidth, kHeight));
102 canvas->setLights(fLights); 102 canvas->setLights(fLights);
103 canvas->drawShadowedPicture(pic, nullptr, nullptr, fShadowParams); 103 canvas->drawShadowedPicture(pic, nullptr, nullptr, fShadowParams);
104 } 104 }
105 105
106 private: 106 private:
107 sk_sp<SkLights> fLights; 107 sk_sp<SkLights> fLights;
108 SkShadowParams fShadowParams; 108 SkShadowParams fShadowParams;
109 typedef GM INHERITED; 109 typedef GM INHERITED;
110 }; 110 };
111 111
112 ////////////////////////////////////////////////////////////////////////////// 112 //////////////////////////////////////////////////////////////////////////////
113 113
114 DEF_GM(return new ShadowMapsGM;) 114 DEF_GM(return new ShadowMapsGM;)
115 } 115 }
116 116
117 #endif 117 #endif
OLDNEW
« no previous file with comments | « no previous file | gyp/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698