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

Unified Diff: samplecode/SampleLighting.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/SampleLighting.cpp
diff --git a/samplecode/SampleLighting.cpp b/samplecode/SampleLighting.cpp
index 16b187408ac2051615cd97fb5f17b64909a23803..48d3f8a15ca51a804815b855c2da8a9766a19cf1 100755
--- a/samplecode/SampleLighting.cpp
+++ b/samplecode/SampleLighting.cpp
@@ -8,6 +8,7 @@
#include "SampleCode.h"
#include "Resources.h"
+#include "SkBitmapProcShader.h"
#include "SkCanvas.h"
#include "SkLightingShader.h"
#include "SkNormalSource.h"
@@ -65,11 +66,13 @@ protected:
sk_sp<SkLights> lights(create_lights(fLightAngle, fColorFactor));
SkPaint paint;
+ sk_sp<SkShader> diffuseShader = SkBitmapProcShader::MakeBitmapShader(fDiffuseBitmap,
+ SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, nullptr);
sk_sp<SkNormalSource> normalSource = SkNormalSource::MakeMap(fNormalBitmap,
SkVector::Make(1.0f, 0.0f),
nullptr);
- paint.setShader(SkLightingShader::Make(fDiffuseBitmap, std::move(lights), nullptr,
- std::move(normalSource)));
+ paint.setShader(SkLightingShader::Make(std::move(diffuseShader), std::move(normalSource),
+ std::move(lights)));
paint.setColor(SK_ColorBLACK);
SkRect r = SkRect::MakeWH((SkScalar)fDiffuseBitmap.width(),

Powered by Google App Engine
This is Rietveld 408576698