skia2/include/utils/SkShadowUtils.h
Brian Salomon 804e091df9 Make shadow_utils GM use its own SkResourceCache
This should stabilize the replay testing on the bots.

Change-Id: I89e3e308000743da6e1a765751103cffabc7e4ba
Reviewed-on: https://skia-review.googlesource.com/8902
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-02-23 16:22:56 +00:00

47 lines
1.7 KiB
C++

/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkShadowUtils_DEFINED
#define SkShadowUtils_DEFINED
#include "SkColor.h"
#include "SkScalar.h"
#include "../private/SkShadowFlags.h"
class SkCanvas;
class SkPath;
class SkResourceCache;
class SkShadowUtils {
public:
/**
* Draw an offset spot shadow and outlining ambient shadow for the given path using a disc
* light.
*
* @param canvas The canvas on which to draw the shadows.
* @param path The occluder used to generate the shadows.
* @param occluderHeight The vertical offset of the occluder from the canvas. This is
* indepdendent of the canvas's current matrix.
* @param lightPos The 3D position of the light relative to the canvas plane. This is
* independent of the canvas's current matrix.
* @param lightRadius The radius of the disc light.
* @param ambientAlpha The maximum alpha of the ambient shadow.
* @param spotAlpha The maxium alpha of the spot shadow.
* @param color The shadow color.
* @param flags Options controlling opaque occluder optimizations and shadow appearance. See
* SkShadowFlags.
* @param cache Used for testing purposes. Clients should pass nullptr (default).
*/
static void DrawShadow(SkCanvas* canvas, const SkPath& path, SkScalar occluderHeight,
const SkPoint3& lightPos, SkScalar lightRadius, SkScalar ambientAlpha,
SkScalar spotAlpha, SkColor color,
uint32_t flags = SkShadowFlags::kNone_ShadowFlag,
SkResourceCache* cache = nullptr);
};
#endif