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

Unified Diff: gm/lightingshader.cpp

Issue 1261433009: Refugee from Dead Machine 11: Add SkCanvas::drawLitAtlas call Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gyp/SampleApp.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
};
« no previous file with comments | « no previous file | gyp/SampleApp.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698