Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(907)

Unified Diff: src/gpu/GrShape.h

Issue 2109613003: Revert of Make lines a special case in GrShape (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/gpu/GrShape.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrShape.h
diff --git a/src/gpu/GrShape.h b/src/gpu/GrShape.h
index 8f3be58702820eb0c4d7161b290a9477a5d640ac..87ee26e17333a50b7df08cb0bde4b19d51835ced 100644
--- a/src/gpu/GrShape.h
+++ b/src/gpu/GrShape.h
@@ -152,19 +152,12 @@
* 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 @@
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 @@
* 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
@@ -226,8 +209,6 @@
case Type::kEmpty:
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
@@ -250,9 +231,6 @@
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 @@
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 @@
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 @@
enum class Type {
kEmpty,
kRRect,
- kLine,
kPath,
};
@@ -383,7 +356,6 @@
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 @@
// 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;
« no previous file with comments | « no previous file | src/gpu/GrShape.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698