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

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, 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
« no previous file with comments | « no previous file | samplecode/SampleLighting.cpp » ('j') | tests/SerializationTest.cpp » ('J')
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 e0a4ccfe7461f5b668f20e79d39572c58431f7de..48b677c9ffb1cf041c4a519220b6d8b3b0a8a81e 100644
--- a/gm/lightingshader.cpp
+++ b/gm/lightingshader.cpp
@@ -7,6 +7,7 @@
#include "gm.h"
+#include "SkBitmapProcShader.h"
#include "SkLightingShader.h"
#include "SkNormalSource.h"
#include "SkPoint3.h"
@@ -100,10 +101,12 @@ protected:
SkVector invNormRotation = { ctm[SkMatrix::kMScaleX], ctm[SkMatrix::kMSkewY] };
SkPaint paint;
+ sk_sp<SkShader> diffuseShader = SkBitmapProcShader::MakeBitmapShader(fDiffuse,
+ SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, &matrix);
sk_sp<SkNormalSource> normalSource = SkNormalSource::MakeMap(fNormalMaps[mapType],
invNormRotation, &matrix);
- 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') | tests/SerializationTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698