diff options
author | bsalomon <bsalomon@google.com> | 2016-06-28 11:18:47 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-28 11:18:47 -0700 |
commit | 635df95a9a25c66959f76b4bbb594b75333ded21 (patch) | |
tree | 62f9702e34246fceda51b8d1d89351f17cc8c122 /src/gpu/GrShape.h | |
parent | c31bb870f274455197749cceea48c45c4b905d6e (diff) |
Revert of Make lines a special case in GrShape (patchset #5 id:120001 of https://codereview.chromium.org/2108523002/ )
Reason for revert:
Assertion failures
Original issue's description:
> Make lines a special case in GrShape
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2108523002
>
> Committed: https://skia.googlesource.com/skia/+/c62318c748a1907649bd75382c4f4fd10533f2b3
TBR=robertphillips@google.com,egdaniel@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review-Url: https://codereview.chromium.org/2109613003
Diffstat (limited to 'src/gpu/GrShape.h')
-rw-r--r-- | src/gpu/GrShape.h | 48 |
1 files changed, 8 insertions, 40 deletions
diff --git a/src/gpu/GrShape.h b/src/gpu/GrShape.h index 8f3be58702..87ee26e173 100644 --- a/src/gpu/GrShape.h +++ b/src/gpu/GrShape.h @@ -152,19 +152,12 @@ public: * 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. */ - bool asLine(SkPoint pts[2], bool* inverted) const { - if (fType != Type::kLine) { - return false; - } - if (pts) { - pts[0] = fLineData.fPts[0]; - pts[1] = fLineData.fPts[1]; - } - if (inverted) { - *inverted = fLineData.fInverted; - } - return true; - } + bool asLine(SkPoint pts[2]) const { + if (fType != Type::kPath) { + return false; + } + return this->path().isLine(pts); + } /** Returns the unstyled geometry as a path. */ void asPath(SkPath* out) const { @@ -182,16 +175,6 @@ public: out->setFillType(kDefaultPathFillType); } break; - case Type::kLine: - out->reset(); - out->moveTo(fLineData.fPts[0]); - out->lineTo(fLineData.fPts[1]); - if (fLineData.fInverted) { - out->setFillType(kDefaultPathInverseFillType); - } else { - out->setFillType(kDefaultPathFillType); - } - break; case Type::kPath: *out = this->path(); break; @@ -208,13 +191,13 @@ public: * Gets the bounds of the geometry without reflecting the shape's styling. This ignores * the inverse fill nature of the geometry. */ - SkRect bounds() const; + const SkRect& bounds() const; /** * Gets the bounds of the geometry reflecting the shape's styling (ignoring inverse fill * status). */ - SkRect styledBounds() const; + void styledBounds(SkRect* bounds) const; /** * Is this shape known to be convex, before styling is applied. An unclosed but otherwise @@ -227,8 +210,6 @@ public: return true; case Type::kRRect: return true; - case Type::kLine: - return true; case Type::kPath: // SkPath.isConvex() really means "is this path convex were it to be closed" and // thus doesn't give the correct answer for stroked paths, hence we also check @@ -250,9 +231,6 @@ public: case Type::kRRect: ret = fRRectData.fInverted; break; - case Type::kLine: - ret = fLineData.fInverted; - break; case Type::kPath: ret = this->path().isInverseFillType(); break; @@ -286,8 +264,6 @@ public: return true; case Type::kRRect: return true; - case Type::kLine: - return false; case Type::kPath: // SkPath doesn't keep track of the closed status of each contour. return SkPathPriv::IsClosedSingleContour(this->path()); @@ -306,8 +282,6 @@ public: return SkPath::kLine_SegmentMask; } return SkPath::kLine_SegmentMask | SkPath::kConic_SegmentMask; - case Type::kLine: - return SkPath::kLine_SegmentMask; case Type::kPath: return this->path().getSegmentMasks(); } @@ -333,7 +307,6 @@ private: enum class Type { kEmpty, kRRect, - kLine, kPath, }; @@ -383,7 +356,6 @@ private: void attemptToSimplifyPath(); void attemptToSimplifyRRect(); - void attemptToSimplifyLine(); // Defaults to use when there is no distinction between even/odd and winding fills. static constexpr SkPath::FillType kDefaultPathFillType = SkPath::kEvenOdd_FillType; @@ -448,10 +420,6 @@ private: // Gen ID of the original path (fPath may be modified) int32_t fGenID; } fPathData; - struct { - SkPoint fPts[2]; - bool fInverted; - } fLineData; }; GrStyle fStyle; SkAutoSTArray<8, uint32_t> fInheritedKey; |