diff options
author | Jim Van Verth <jvanverth@google.com> | 2017-05-10 14:13:24 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-10 19:27:39 +0000 |
commit | 37c5a96bbdeac2000c8b31d40f4786b31c39f2dd (patch) | |
tree | a9f582e9f528d332441fc47288af9f2861287c5c /gm/shadowutils.cpp | |
parent | 77ced29102c8bc3b8c067e56504ad8411c1176a8 (diff) |
Unify ShadowUtils interface
Bug: skia:
Change-Id: I116bec82783d297e91ef061217b5e61f7ff16a76
Reviewed-on: https://skia-review.googlesource.com/16371
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'gm/shadowutils.cpp')
-rw-r--r-- | gm/shadowutils.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/gm/shadowutils.cpp b/gm/shadowutils.cpp index 53d9b78602..9d9eaae405 100644 --- a/gm/shadowutils.cpp +++ b/gm/shadowutils.cpp @@ -12,24 +12,17 @@ #include "SkShadowUtils.h" void draw_shadow(SkCanvas* canvas, const SkPath& path, int height, SkColor color, SkPoint3 lightPos, - SkScalar lightR, bool isAmbient, uint32_t flags, SkResourceCache* cache) { + SkScalar lightR, bool isAmbient, uint32_t flags) { SkScalar ambientAlpha = isAmbient ? .5f : 0.f; SkScalar spotAlpha = isAmbient ? 0.f : .5f; SkShadowUtils::DrawShadow(canvas, path, height, lightPos, lightR, ambientAlpha, spotAlpha, - color, flags, cache); + color, flags); } static constexpr int kW = 800; static constexpr int kH = 800; DEF_SIMPLE_GM(shadow_utils, canvas, kW, kH) { - // SkShadowUtils uses a cache of SkVertices meshes. The vertices are created in a local - // coordinate system and then translated when reused. The coordinate system depends on - // parameters to the generating draw. If other threads are hitting the cache while this GM is - // running then we may have different cache behavior leading to slight rendering differences. - // To avoid that we use our own isolated cache rather than the global cache. - SkResourceCache cache(1 << 20); - SkTArray<SkPath> paths; paths.push_back().addRoundRect(SkRect::MakeWH(50, 50), 10, 10); SkRRect oddRRect; @@ -70,10 +63,8 @@ DEF_SIMPLE_GM(shadow_utils, canvas, kW, kH) { canvas->save(); canvas->concat(m); - draw_shadow(canvas, path, kHeight, SK_ColorRED, kLightPos, kLightR, true, flags, - &cache); - draw_shadow(canvas, path, kHeight, SK_ColorBLUE, kLightPos, kLightR, false, flags, - &cache); + draw_shadow(canvas, path, kHeight, SK_ColorRED, kLightPos, kLightR, true, flags); + draw_shadow(canvas, path, kHeight, SK_ColorBLUE, kLightPos, kLightR, false, flags); // Draw the path outline in green on top of the ambient and spot shadows. SkPaint paint; |