Flutter Engine
The Flutter Engine
|
#include <GrStyledShape.h>
Public Types | |
enum class | DoSimplify : bool { kNo = false , kYes } |
enum class | FillInversion { kPreserve , kFlip , kForceNoninverted , kForceInverted } |
Static Public Member Functions | |
static GrStyledShape | MakeArc (const SkArc &arc, const GrStyle &style, DoSimplify=DoSimplify::kYes) |
static GrStyledShape | MakeFilled (const GrStyledShape &original, FillInversion=FillInversion::kPreserve) |
Static Public Attributes | |
static constexpr int | kMaxKeyFromDataVerbCnt = 10 |
Represents a geometric shape (rrect or path) and the GrStyle that it should be rendered with. It is possible to apply the style to the GrStyledShape to produce a new GrStyledShape where the geometry reflects the styling information (e.g. is stroked). It is also possible to apply just the path effect from the style. In this case the resulting shape will include any remaining stroking information that is to be applied after the path effect.
Shapes can produce keys that represent only the geometry information, not the style. Note that when styling information is applied to produce a new shape then the style has been converted to geometric information and is included in the new shape's key. When the same style is applied to two shapes that reflect the same underlying geometry the computed keys of the stylized shapes will be the same.
Currently this can only be constructed from a path, rect, or rrect though it can become a path applying style to the geometry. The idea is to expand this to cover most or all of the geometries that have fast paths in the GPU backend.
Definition at line 49 of file GrStyledShape.h.
|
strong |
Enumerator | |
---|---|
kNo | |
kYes |
Definition at line 57 of file GrStyledShape.h.
|
strong |
Informs MakeFilled on how to modify that shape's fill rule when making a simple filled version of the shape.
Enumerator | |
---|---|
kPreserve | |
kFlip | |
kForceNoninverted | |
kForceInverted |
Definition at line 124 of file GrStyledShape.h.
|
inline |
Definition at line 55 of file GrStyledShape.h.
|
inlineexplicit |
Definition at line 59 of file GrStyledShape.h.
|
inlineexplicit |
Definition at line 62 of file GrStyledShape.h.
|
inlineexplicit |
Definition at line 65 of file GrStyledShape.h.
|
inline |
Definition at line 68 of file GrStyledShape.h.
|
inline |
Definition at line 72 of file GrStyledShape.h.
|
inline |
Definition at line 76 of file GrStyledShape.h.
|
inline |
Definition at line 80 of file GrStyledShape.h.
|
inline |
Definition at line 88 of file GrStyledShape.h.
|
inline |
Definition at line 93 of file GrStyledShape.h.
|
inline |
Definition at line 104 of file GrStyledShape.h.
GrStyledShape::GrStyledShape | ( | const GrStyledShape & | that | ) |
Definition at line 330 of file GrStyledShape.cpp.
void GrStyledShape::addGenIDChangeListener | ( | sk_sp< SkIDChangeListener > | listener | ) | const |
Adds a listener to the original path. Typically used to invalidate cached resources when a path is no longer in-use. If the shape started out as something other than a path, this does nothing.
Definition at line 311 of file GrStyledShape.cpp.
|
inline |
Returns a shape that has either applied the path effect or path effect and stroking information from this shape's style to its geometry. Scale is used when approximating the output geometry and typically is computed from the view matrix
Definition at line 150 of file GrStyledShape.h.
bool GrStyledShape::asLine | ( | SkPoint | pts[2], |
bool * | inverted | ||
) | const |
If the unstyled shape is a straight line segment, returns true and sets pts to the endpoints. An inverse filled line path is still considered a line.
Definition at line 453 of file GrStyledShape.cpp.
bool GrStyledShape::asNestedRects | ( | SkRect | rects[2] | ) | const |
Definition at line 468 of file GrStyledShape.cpp.
|
inline |
Returns the unstyled geometry as a path.
Definition at line 173 of file GrStyledShape.h.
bool GrStyledShape::asRRect | ( | SkRRect * | rrect, |
bool * | inverted | ||
) | const |
Returns the unstyled geometry as a rrect if possible.
Definition at line 437 of file GrStyledShape.cpp.
|
inline |
Gets the bounds of the geometry without reflecting the shape's styling. This ignores the inverse fill nature of the geometry.
Definition at line 187 of file GrStyledShape.h.
|
inline |
Definition at line 259 of file GrStyledShape.h.
|
inline |
Is the pre-styled geometry inverse filled?
Definition at line 217 of file GrStyledShape.h.
|
inline |
Returns whether the geometry is empty. Note that applying the style could produce a non-empty shape. It also may have an inverse fill.
Definition at line 181 of file GrStyledShape.h.
|
inline |
Definition at line 154 of file GrStyledShape.h.
|
inline |
Does the shape have a known winding direction. Some degenerate convex shapes may not have a computable direction, but this is not always a requirement for path renderers so it is kept separate from knownToBeConvex().
Definition at line 209 of file GrStyledShape.h.
|
inline |
Is it known that the unstyled geometry has no unclosed contours. This means that it will not have any caps if stroked (modulo the effect of any path effect).
Definition at line 243 of file GrStyledShape.h.
|
inline |
Is this shape known to be convex, before styling is applied. An unclosed but otherwise convex path is considered to be closed if they styling reflects a fill and not otherwise. This is because filling closes all contours in the path.
Definition at line 200 of file GrStyledShape.h.
|
static |
Definition at line 317 of file GrStyledShape.cpp.
|
static |
Makes a filled shape from the pre-styled original shape and optionally modifies whether the fill is inverted or not. It's important to note that the original shape's geometry may already have been modified if doing so was neutral with respect to its style (e.g. filled paths are always closed when stored in a shape and dashed paths are always made non-inverted since dashing ignores inverseness).
Definition at line 56 of file GrStyledShape.cpp.
|
inline |
Might applying the styling to the geometry produce an inverse fill. The "may" part comes in because an arbitrary path effect could produce an inverse filled path. In other cases this can be thought of as "inverseFilledAfterStyling()".
Definition at line 230 of file GrStyledShape.h.
GrStyledShape & GrStyledShape::operator= | ( | const GrStyledShape & | that | ) |
Definition at line 25 of file GrStyledShape.cpp.
|
inline |
Definition at line 248 of file GrStyledShape.h.
|
inline |
Definition at line 143 of file GrStyledShape.h.
void GrStyledShape::simplify | ( | ) |
Similar to GrShape::simplify but also takes into account style and stroking, possibly applying the style explicitly to produce a new analytic shape with a simpler style. Unless "doSimplify" is kNo, this method gets called automatically during construction.
Definition at line 529 of file GrStyledShape.cpp.
|
inline |
Definition at line 140 of file GrStyledShape.h.
SkRect GrStyledShape::styledBounds | ( | ) | const |
Gets the bounds of the geometry reflecting the shape's styling (ignoring inverse fill status).
Definition at line 92 of file GrStyledShape.cpp.
uint32_t GrStyledShape::testingOnly_getOriginalGenerationID | ( | ) | const |
Helpers that are only exposed for unit tests, to determine if the shape is a path, and get the generation ID of the original path. This is the path that will receive GenIDChangeListeners added to this shape.
Definition at line 50 of file GrStyledShapeTest.cpp.
bool GrStyledShape::testingOnly_isNonVolatilePath | ( | ) | const |
Definition at line 61 of file GrStyledShapeTest.cpp.
bool GrStyledShape::testingOnly_isPath | ( | ) | const |
Definition at line 57 of file GrStyledShapeTest.cpp.
int GrStyledShape::unstyledKeySize | ( | ) | const |
Gets the size of the key for the shape represented by this GrStyledShape (ignoring its styling). A negative value is returned if the shape has no key (shouldn't be cached).
Definition at line 144 of file GrStyledShape.cpp.
void GrStyledShape::writeUnstyledKey | ( | uint32_t * | key | ) | const |
Writes unstyledKeySize() bytes into the provided pointer. Assumes that there is enough space allocated for the key and that unstyledKeySize() does not return a negative value for this shape.
Definition at line 189 of file GrStyledShape.cpp.
|
inlinestaticconstexpr |
Definition at line 53 of file GrStyledShape.h.