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

Side by Side Diff: gm/lightingshader2.cpp

Issue 2171853002: Fixed GM:lightingshader2 size (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 5 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 | no next file » | 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 9
10 #include "SkBitmapProcShader.h" 10 #include "SkBitmapProcShader.h"
(...skipping 20 matching lines...) Expand all
31 LightingShader2GM() { 31 LightingShader2GM() {
32 this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC)); 32 this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC));
33 } 33 }
34 34
35 protected: 35 protected:
36 SkString onShortName() override { 36 SkString onShortName() override {
37 return SkString("lightingshader2"); 37 return SkString("lightingshader2");
38 } 38 }
39 39
40 SkISize onISize() override { 40 SkISize onISize() override {
41 return SkISize::Make(kGMSize, kGMSize); 41 return SkISize::Make(600, 740);
42 } 42 }
43 43
44 void onOnceBeforeDraw() override { 44 void onOnceBeforeDraw() override {
45 SkLights::Builder builder; 45 SkLights::Builder builder;
46 const SkVector3 kLightFromUpperRight = SkVector3::Make(0.788f, 0.394f, 0 .473f); 46 const SkVector3 kLightFromUpperRight = SkVector3::Make(0.788f, 0.394f, 0 .473f);
47 47
48 builder.add(SkLights::Light(SkColor3f::Make(1.0f, 1.0f, 1.0f), 48 builder.add(SkLights::Light(SkColor3f::Make(1.0f, 1.0f, 1.0f),
49 kLightFromUpperRight)); 49 kLightFromUpperRight));
50 builder.add(SkLights::Light(SkColor3f::Make(0.2f, 0.2f, 0.2f))); 50 builder.add(SkLights::Light(SkColor3f::Make(0.2f, 0.2f, 0.2f)));
51 fLights = builder.finish(); 51 fLights = builder.finish();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 canvas->translate(xPos, yPos); 207 canvas->translate(xPos, yPos);
208 this->drawRect(canvas, 0.6f, 0.4f, 30.0f, true, true, true, true); 208 this->drawRect(canvas, 0.6f, 0.4f, 30.0f, true, true, true, true);
209 canvas->restore(); 209 canvas->restore();
210 210
211 gridNum++; 211 gridNum++;
212 } 212 }
213 } 213 }
214 214
215 private: 215 private:
216 static const int kTexSize = 96; 216 static const int kTexSize = 96;
217 static const int kGMSize = 512;
218 217
219 sk_sp<SkShader> fOpaqueDiffuse; 218 sk_sp<SkShader> fOpaqueDiffuse;
220 sk_sp<SkShader> fTranslucentDiffuse; 219 sk_sp<SkShader> fTranslucentDiffuse;
221 sk_sp<SkShader> fNormalMapShader; 220 sk_sp<SkShader> fNormalMapShader;
222 221
223 SkRect fRect; 222 SkRect fRect;
224 sk_sp<SkLights> fLights; 223 sk_sp<SkLights> fLights;
225 224
226 typedef GM INHERITED; 225 typedef GM INHERITED;
227 }; 226 };
228 227
229 ////////////////////////////////////////////////////////////////////////////// 228 //////////////////////////////////////////////////////////////////////////////
230 229
231 DEF_GM(return new LightingShader2GM;) 230 DEF_GM(return new LightingShader2GM;)
232 } 231 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698