From 6af677ff8f549751352847ceefda4538236c8a20 Mon Sep 17 00:00:00 2001 From: dvonbeck Date: Sun, 10 Jul 2016 18:38:33 -0700 Subject: 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 --- src/core/SkLightingShader.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src/core/SkLightingShader.cpp') 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 SkLightingShader::Make(const SkBitmap& diffuse, - sk_sp lights, - const SkMatrix* diffLocalM, - sk_sp normalSource) { - if (diffuse.isNull() || SkBitmapProcShader::BitmapIsTooBig(diffuse)) { - return nullptr; - } - - if (!normalSource) { +sk_sp SkLightingShader::Make(sk_sp diffuseShader, + sk_sp normalSource, + sk_sp 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 diffuseShader = SkBitmapProcShader::MakeBitmapShader(diffuse, - SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, diffLocalM); - return sk_make_sp(std::move(diffuseShader), std::move(normalSource), std::move(lights)); } -- cgit v1.2.3