| OLD | NEW |
| 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 20 matching lines...) Expand all Loading... |
| 31 return SkISize::Make(SkScalarCeilToInt(GRID_NUM_COLUMNS * GRID_CELL_WIDT
H), | 31 return SkISize::Make(SkScalarCeilToInt(GRID_NUM_COLUMNS * GRID_CELL_WIDT
H), |
| 32 SkScalarCeilToInt(GRID_NUM_ROWS * GRID_CELL_WIDT
H)); | 32 SkScalarCeilToInt(GRID_NUM_ROWS * GRID_CELL_WIDT
H)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void onOnceBeforeDraw() override { | 35 void onOnceBeforeDraw() override { |
| 36 SkLights::Builder builder; | 36 SkLights::Builder builder; |
| 37 const SkVector3 kLightFromUpperRight = SkVector3::Make(0.788f, 0.394f, 0
.473f); | 37 const SkVector3 kLightFromUpperRight = SkVector3::Make(0.788f, 0.394f, 0
.473f); |
| 38 | 38 |
| 39 builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(1.0f, 1.0f,
1.0f), | 39 builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(1.0f, 1.0f,
1.0f), |
| 40 kLightFromUpperRight)); | 40 kLightFromUpperRight)); |
| 41 builder.add(SkLights::Light::MakeAmbient(SkColor3f::Make(0.2f, 0.2f, 0.2
f))); | 41 builder.setAmbientLightColor(SkColor3f::Make(0.2f, 0.2f, 0.2f)); |
| 42 fLights = builder.finish(); | 42 fLights = builder.finish(); |
| 43 | 43 |
| 44 // fRect is assumed to be square throughout this file | 44 // fRect is assumed to be square throughout this file |
| 45 fRect = SkRect::MakeIWH(kTexSize, kTexSize); | 45 fRect = SkRect::MakeIWH(kTexSize, kTexSize); |
| 46 SkMatrix matrix; | 46 SkMatrix matrix; |
| 47 SkRect bitmapBounds = SkRect::MakeIWH(kTexSize, kTexSize); | 47 SkRect bitmapBounds = SkRect::MakeIWH(kTexSize, kTexSize); |
| 48 matrix.setRectToRect(bitmapBounds, fRect, SkMatrix::kFill_ScaleToFit); | 48 matrix.setRectToRect(bitmapBounds, fRect, SkMatrix::kFill_ScaleToFit); |
| 49 | 49 |
| 50 SkBitmap diffuseMap = sk_tool_utils::create_checkerboard_bitmap( | 50 SkBitmap diffuseMap = sk_tool_utils::create_checkerboard_bitmap( |
| 51 kTexSize, kTexSize, | 51 kTexSize, kTexSize, |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 SkPath fConcavePath; | 258 SkPath fConcavePath; |
| 259 sk_sp<SkLights> fLights; | 259 sk_sp<SkLights> fLights; |
| 260 | 260 |
| 261 typedef GM INHERITED; | 261 typedef GM INHERITED; |
| 262 }; | 262 }; |
| 263 | 263 |
| 264 ////////////////////////////////////////////////////////////////////////////// | 264 ////////////////////////////////////////////////////////////////////////////// |
| 265 | 265 |
| 266 DEF_GM(return new LightingShaderBevelGM;) | 266 DEF_GM(return new LightingShaderBevelGM;) |
| 267 } | 267 } |
| OLD | NEW |