aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkLightingShader.cpp
diff options
context:
space:
mode:
authorGravatar dvonbeck <dvonbeck@google.com>2016-07-10 18:38:33 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-10 18:38:34 -0700
commit6af677ff8f549751352847ceefda4538236c8a20 (patch)
tree9a95a87e2c9903938117cbf334c5b35695317d50 /src/core/SkLightingShader.cpp
parent3ab14ca950d98a5c4d4c4a5f96ea8b0c984e0116 (diff)
Changed SkLightingShader API to take in a shader as color source
This CL's base is the CL for the same modification, but in the implementation side: https://codereview.chromium.org/2062703003/ BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2064153002 Review-Url: https://codereview.chromium.org/2064153002
Diffstat (limited to 'src/core/SkLightingShader.cpp')
-rw-r--r--src/core/SkLightingShader.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/core/SkLightingShader.cpp b/src/core/SkLightingShader.cpp
index 84ec64cc06..02f14b34dd 100644
--- a/src/core/SkLightingShader.cpp
+++ b/src/core/SkLightingShader.cpp
@@ -488,23 +488,15 @@ SkShader::Context* SkLightingShaderImpl::onCreateContext(const ContextRec& rec,
///////////////////////////////////////////////////////////////////////////////
-sk_sp<SkShader> SkLightingShader::Make(const SkBitmap& diffuse,
- sk_sp<SkLights> lights,
- const SkMatrix* diffLocalM,
- sk_sp<SkNormalSource> normalSource) {
- if (diffuse.isNull() || SkBitmapProcShader::BitmapIsTooBig(diffuse)) {
- return nullptr;
- }
-
- if (!normalSource) {
+sk_sp<SkShader> SkLightingShader::Make(sk_sp<SkShader> diffuseShader,
+ sk_sp<SkNormalSource> normalSource,
+ sk_sp<SkLights> lights) {
+ if (!diffuseShader || !normalSource) {
+ // TODO: Use paint's color in absence of a diffuseShader
// TODO: Use a default implementation of normalSource instead
return nullptr;
}
- // TODO: support other tile modes
- sk_sp<SkShader> diffuseShader = SkBitmapProcShader::MakeBitmapShader(diffuse,
- SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, diffLocalM);
-
return sk_make_sp<SkLightingShaderImpl>(std::move(diffuseShader), std::move(normalSource),
std::move(lights));
}