diff options
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; |