Index: gm/lightingshader.cpp |
diff --git a/gm/lightingshader.cpp b/gm/lightingshader.cpp |
index 7e33504477fef81e0c5740caf505e1bdb89dc91c..9221e5e1870d0d9e90bfe6d5ef0c1668541761b5 100644 |
--- a/gm/lightingshader.cpp |
+++ b/gm/lightingshader.cpp |
@@ -9,6 +9,7 @@ |
#include "SkLightingShader.h" |
#include "SkPoint3.h" |
+#include "SkRSXform.h" |
#include "SkShader.h" |
static SkBitmap make_checkerboard(int texSize) { |
@@ -58,10 +59,13 @@ public: |
LightingShaderGM() { |
this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC)); |
- fLight.fColor = SkColor3f::Make(1.0f, 1.0f, 1.0f); |
- fLight.fDirection = SkVector3::Make(0.0f, 0.0f, 1.0f); |
+ SkLightingShader::Lights::Builder builder; |
- fAmbient = SkColor3f::Make(0.1f, 0.1f, 0.1f); |
+ builder.add(SkLight(SkColor3f::Make(1.0f, 1.0f, 1.0f), |
+ SkVector3::Make(0.0f, 0.0f, 1.0f))); |
+ builder.add(SkLight(SkColor3f::Make(0.1f, 0.1f, 0.1f))); |
+ |
+ fLights.reset(builder.finish()); |
} |
protected: |
@@ -98,11 +102,14 @@ protected: |
SkMatrix matrix; |
matrix.setRectToRect(bitmapBounds, r, SkMatrix::kFill_ScaleToFit); |
+ SkRSXform xform; |
+ xform.setIdentity(); |
+ |
SkAutoTUnref<SkShader> fShader(SkLightingShader::Create( |
fDiffuse, |
fNormalMaps[mapType], |
- fLight, fAmbient, |
- &matrix)); |
+ fLights, |
+ xform, &matrix, &matrix)); |
SkPaint paint; |
paint.setShader(fShader); |
@@ -131,8 +138,7 @@ private: |
SkBitmap fDiffuse; |
SkBitmap fNormalMaps[kNormalMapCount]; |
- SkLightingShader::Light fLight; |
- SkColor3f fAmbient; |
+ SkAutoTUnref<const SkLightingShader::Lights> fLights; |
typedef GM INHERITED; |
}; |