diff options
author | Jim Van Verth <jvanverth@google.com> | 2017-03-27 14:25:29 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-27 19:06:59 +0000 |
commit | b436655ad5c40a04b65c1642d0a0e781ce296c96 (patch) | |
tree | 4cf0067fb63ab9afbf817e0930c03b858b51588e /src/utils/SkShadowTessellator.h | |
parent | b549cc38c8404c58642ada75c0b24907702cc005 (diff) |
Add height function to shadow tessellators.
Prep work for adding perspective support.
Bug: skia:
Change-Id: Id07d3050afb3f0d001b885e482adb8d03125b619
Reviewed-on: https://skia-review.googlesource.com/10167
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/utils/SkShadowTessellator.h')
-rw-r--r-- | src/utils/SkShadowTessellator.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/utils/SkShadowTessellator.h b/src/utils/SkShadowTessellator.h index eb49bbee3f..f9f4a144c9 100644 --- a/src/utils/SkShadowTessellator.h +++ b/src/utils/SkShadowTessellator.h @@ -17,22 +17,25 @@ class SkPath; class SkVertices; namespace SkShadowTessellator { + +typedef std::function<SkScalar(SkScalar, SkScalar)> HeightFunc; + /** * This function generates an ambient shadow mesh for a path by walking the path, outsetting by * the radius, and setting inner and outer colors to umbraColor and penumbraColor, respectively. * If transparent is true, then the center of the ambient shadow will be filled in. */ -sk_sp<SkVertices> MakeAmbient(const SkPath& path, const SkMatrix& ctm, SkScalar radius, - SkColor umbraColor, SkColor penumbraColor, bool transparent); +sk_sp<SkVertices> MakeAmbient(const SkPath& path, const SkMatrix& ctm, + HeightFunc heightFunc, SkScalar ambientAlpha, bool transparent); /** * This function generates a spot shadow mesh for a path by walking the transformed path, * further transforming by the scale and translation, and outsetting and insetting by a radius. * The center will be clipped against the original path unless transparent is true. */ -sk_sp<SkVertices> MakeSpot(const SkPath& path, const SkMatrix& ctm, SkScalar scale, - const SkVector& translate, SkScalar radius, SkColor umbraColor, - SkColor penumbraColor, bool transparent); +sk_sp<SkVertices> MakeSpot(const SkPath& path, const SkMatrix& ctm, HeightFunc heightFunc, + const SkPoint3& lightPos, SkScalar lightRadius, + SkScalar spotAlpha, bool transparent); } #endif |