| 1 |
/* |
| 2 |
* Copyright 2012 Google Inc. |
| 3 |
* |
| 4 |
* Use of this source code is governed by a BSD-style license that can be |
| 5 |
* found in the LICENSE file. |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef SkPathRef_DEFINED |
| 9 |
#define SkPathRef_DEFINED |
| 10 |
|
| 11 |
#include "include/core/SkArc.h" |
| 12 |
#include "include/core/SkMatrix.h" |
| 13 |
#include "include/core/SkPathTypes.h" // IWYU pragma: keep |
| 14 |
#include "include/core/SkPoint.h" |
| 15 |
#include "include/core/SkRRect.h" |
| 16 |
#include "include/core/SkRect.h" |
| 17 |
#include "include/core/SkRefCnt.h" |
| 18 |
#include "include/core/SkScalar.h" |
| 19 |
#include "include/core/SkTypes.h" |
| 20 |
#include "include/private/SkIDChangeListener.h" |
| 21 |
#include "include/private/base/SkDebug.h" |
| 22 |
#include "include/private/base/SkSpan_impl.h" |
| 23 |
#include "include/private/base/SkTArray.h" |
| 24 |
#include "include/private/base/SkTo.h" |
| 25 |
|
| 26 |
#include <atomic> |
| 27 |
#include <cstddef> |
| 28 |
#include <cstdint> |
| 29 |
#include <tuple> |
| 30 |
|
| 31 |
class SkMatrix; |
| 32 |
|
| 33 |
/* |
| 34 |
* These "info" structs are used to return identifying information, when a path |
| 35 |
* is queried if it is a special "shape". (e.g. isOval(), isRRect()) |
| 36 |
*/ |
| 37 |
|
| 38 |
struct SkPathRectInfo { |
| 39 |
SkRect fRect; |
| 40 |
SkPathDirection fDirection; |
| 41 |
uint8_t fStartIndex; |
| 42 |
}; |
| 43 |
|
| 44 |
struct SkPathOvalInfo { |
| 45 |
SkRect fBounds; |
| 46 |
SkPathDirection fDirection; |
| 47 |
uint8_t fStartIndex; |
| 48 |
}; |
| 49 |
|
| 50 |
struct SkPathRRectInfo { |
| 51 |
SkRRect fRRect; |
| 52 |
SkPathDirection fDirection; |
| 53 |
uint8_t fStartIndex; |
| 54 |
}; |
| 55 |
|
| 56 |
/* |
| 57 |
* Paths can be tagged with a "Type" -- the IsAType |
| 58 |
* This signals that it was built from a high-level shape: oval, rrect, arc, wedge. |
| 59 |
* We try to retain this tag, but still build the explicitly line/quad/conic/cubic |
| 60 |
* structure need to represent that shape. Thus a user of path can always just look |
| 61 |
* at the points and verbs, and draw it correctly. |
| 62 |
* |
| 63 |
* The GPU backend sometimes will sniff the path for this tag/type, and may have a |
| 64 |
* more optimal way to draw the shape if they know its "really" an oval or whatever. |
| 65 |
* |
| 66 |
* Path's can also identify as a "rect" -- but we don't store any special tag for this. |
| 67 |
* |
| 68 |
* Here are the special "types" we have APIs for (e.g. isRRect()) and what we store: |
| 69 |
* |
| 70 |
* kGeneral : no identifying shape, no extra data |
| 71 |
* (Rect) : no tag, but isRect() will examing the points/verbs, and try to |
| 72 |
* deduce that it represents a rect. |
| 73 |
* kOval : the path bounds is also the oval's bounds -- we store the direction |
| 74 |
* and start_index (important for dashing). see SkPathMakers.h |
| 75 |
* kRRect : same as kOval for implicit bounds, direction and start_index. |
| 76 |
* Note: we don't store its radii -- we deduce those when isRRect() is |
| 77 |
* called, by examining the points/verbs. |
| 78 |
*/ |
| 79 |
enum class SkPathIsAType : uint8_t { |
| 80 |
kGeneral, |
| 81 |
kOval, |
| 82 |
kRRect, |
| 83 |
}; |
| 84 |
|
| 85 |
struct SkPathIsAData { |
| 86 |
uint8_t fStartIndex; |
| 87 |
SkPathDirection fDirection; |
| 88 |
}; |
| 89 |
|
| 90 |
#endif |