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

Unified Diff: samplecode/SampleLitAtlas.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, 6 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
Index: samplecode/SampleLitAtlas.cpp
diff --git a/samplecode/SampleLitAtlas.cpp b/samplecode/SampleLitAtlas.cpp
index 36955a16d851a3174cb8306ca97f611ff5933509..ae1e7237a5c7fd1fe226982f9fd4904c86b2fa1b 100644
--- a/samplecode/SampleLitAtlas.cpp
+++ b/samplecode/SampleLitAtlas.cpp
@@ -7,7 +7,7 @@
#include "SampleCode.h"
#include "SkAnimTimer.h"
-#include "SkView.h"
+#include "SkBitmapProcShader.h"
#include "SkCanvas.h"
#include "SkDrawable.h"
#include "SkLightingShader.h"
@@ -15,6 +15,7 @@
#include "SkNormalSource.h"
#include "SkRandom.h"
#include "SkRSXform.h"
+#include "SkView.h"
#include "sk_tool_utils.h"
@@ -135,8 +136,10 @@ protected:
sk_sp<SkNormalSource> normalSource = SkNormalSource::MakeMap(fAtlas, invNormRotation,
&normalMat);
- paint.setShader(SkLightingShader::Make(fAtlas, fLights, &diffMat,
- std::move(normalSource)));
+ sk_sp<SkShader> diffuseShader = SkBitmapProcShader::MakeBitmapShader(fAtlas,
+ SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, &diffMat);
+ paint.setShader(SkLightingShader::Make(std::move(diffuseShader),
+ std::move(normalSource), fLights));
canvas->save();
canvas->setMatrix(m);

Powered by Google App Engine
This is Rietveld 408576698