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

Unified Diff: src/core/SkLightingShader.cpp

Issue 2080993002: Added API for Bevel NormalSource. (Closed) Base URL: https://skia.googlesource.com/skia@dvonbeck-diffuse-api-change
Patch Set: Small init fix 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
Index: src/core/SkLightingShader.cpp
diff --git a/src/core/SkLightingShader.cpp b/src/core/SkLightingShader.cpp
index 02f14b34ddc9215c72070aeedc769a8f36418cd2..c393dc8c02922f4aeb3982e669d20fb4bd13cb7a 100644
--- a/src/core/SkLightingShader.cpp
+++ b/src/core/SkLightingShader.cpp
@@ -491,12 +491,13 @@ SkShader::Context* SkLightingShaderImpl::onCreateContext(const ContextRec& rec,
sk_sp<SkShader> SkLightingShader::Make(sk_sp<SkShader> diffuseShader,
sk_sp<SkNormalSource> normalSource,
sk_sp<SkLights> lights) {
- if (!diffuseShader || !normalSource) {
+ if (!diffuseShader) {
// TODO: Use paint's color in absence of a diffuseShader
- // TODO: Use a default implementation of normalSource instead
return nullptr;
}
robertphillips 2016/07/11 19:13:21 Hmmm, don't we just want the flat guy?
dvonbeck 2016/07/13 14:23:37 This was before i wrote the flat guy. Now that I u
robertphillips 2016/07/13 14:40:22 This doesn't look like the flat guy.
dvonbeck 2016/07/13 16:09:16 Patch 5 no longer has modifications to lighting sh
-
+ if (!normalSource) {
+ normalSource = SkNormalSource::MakeBevel(SkNormalSource::BevelType::kLinear, 0, 0);
+ }
return sk_make_sp<SkLightingShaderImpl>(std::move(diffuseShader), std::move(normalSource),
std::move(lights));
}

Powered by Google App Engine
This is Rietveld 408576698