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

Unified Diff: gm/lightingshader.cpp

Issue 2064153002: Changed SkLightingShader API to take in a shader as color source (Closed) Base URL: https://skia.googlesource.com/skia@dvonbeck-diffuse-factor-out
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | samplecode/SampleLighting.cpp » ('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 3b1c224f2bf980ab91a3e2524d36a4eaa2b22b10..2cf4a953d800b78c0577a57f48daa020168ee698 100644
--- a/gm/lightingshader.cpp
+++ b/gm/lightingshader.cpp
@@ -100,12 +100,14 @@ protected:
const SkMatrix& ctm = canvas->getTotalMatrix();
SkPaint paint;
+ sk_sp<SkShader> diffuseShader = SkMakeBitmapShader(fDiffuse,
+ SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, &matrix, nullptr);
sk_sp<SkShader> normalMap = SkMakeBitmapShader(fNormalMaps[mapType],
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, &matrix, nullptr);
sk_sp<SkNormalSource> normalSource = SkNormalSource::MakeFromNormalMap(std::move(normalMap),
ctm);
- paint.setShader(SkLightingShader::Make(fDiffuse, fLights, &matrix,
- std::move(normalSource)));
+ paint.setShader(SkLightingShader::Make(std::move(diffuseShader), std::move(normalSource),
+ fLights));
canvas->drawRect(r, paint);
}
« no previous file with comments | « no previous file | samplecode/SampleLighting.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698