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

Unified Diff: src/gpu/GrShape.h

Issue 2064113004: Some simplifications of GrShape reductions/canonicalizations (Closed) Base URL: https://chromium.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 6da1a41acb4f5b12835cac30b3b5b96c1b0675b0..6086537a99547daf3780523940905c35be734c0c 100644
--- a/src/gpu/GrShape.h
+++ b/src/gpu/GrShape.h
@@ -39,7 +39,7 @@ public:
explicit GrShape(const SkPath& path)
: fType(Type::kPath)
, fPath(&path) {
- this->attemptToReduceFromPath();
+ this->attemptToSimplifyPath();
}
explicit GrShape(const SkRRect& rrect)
@@ -47,7 +47,7 @@ public:
, fRRect(rrect)
, fRRectIsInverted(false) {
fRRectStart = DefaultRRectDirAndStartIndex(rrect, false, &fRRectDir);
- this->attemptToReduceFromRRect();
+ this->attemptToSimplifyRRect();
}
explicit GrShape(const SkRect& rect)
@@ -55,14 +55,14 @@ public:
, fRRect(SkRRect::MakeRect(rect))
, fRRectIsInverted(false) {
fRRectStart = DefaultRectDirAndStartIndex(rect, false, &fRRectDir);
- this->attemptToReduceFromRRect();
+ this->attemptToSimplifyRRect();
}
GrShape(const SkPath& path, const GrStyle& style)
: fType(Type::kPath)
, fPath(&path)
, fStyle(style) {
- this->attemptToReduceFromPath();
+ this->attemptToSimplifyPath();
}
GrShape(const SkRRect& rrect, const GrStyle& style)
@@ -71,7 +71,7 @@ public:
, fRRectIsInverted(false)
, fStyle(style) {
fRRectStart = DefaultRRectDirAndStartIndex(rrect, style.hasPathEffect(), &fRRectDir);
- this->attemptToReduceFromRRect();
+ this->attemptToSimplifyRRect();
}
GrShape(const SkRRect& rrect, SkPath::Direction dir, unsigned start, bool inverted,
@@ -91,7 +91,7 @@ public:
} else {
fRRectStart = DefaultRRectDirAndStartIndex(rrect, false, &fRRectDir);
}
- this->attemptToReduceFromRRect();
+ this->attemptToSimplifyRRect();
}
GrShape(const SkRect& rect, const GrStyle& style)
@@ -100,14 +100,14 @@ public:
, fRRectIsInverted(false)
, fStyle(style) {
fRRectStart = DefaultRectDirAndStartIndex(rect, style.hasPathEffect(), &fRRectDir);
- this->attemptToReduceFromRRect();
+ this->attemptToSimplifyRRect();
}
GrShape(const SkPath& path, const SkPaint& paint)
: fType(Type::kPath)
, fPath(&path)
, fStyle(paint) {
- this->attemptToReduceFromPath();
+ this->attemptToSimplifyPath();
}
GrShape(const SkRRect& rrect, const SkPaint& paint)
@@ -116,7 +116,7 @@ public:
, fRRectIsInverted(false)
, fStyle(paint) {
fRRectStart = DefaultRRectDirAndStartIndex(rrect, fStyle.hasPathEffect(), &fRRectDir);
- this->attemptToReduceFromRRect();
+ this->attemptToSimplifyRRect();
}
GrShape(const SkRect& rect, const SkPaint& paint)
@@ -125,7 +125,7 @@ public:
, fRRectIsInverted(false)
, fStyle(paint) {
fRRectStart = DefaultRectDirAndStartIndex(rect, fStyle.hasPathEffect(), &fRRectDir);
- this->attemptToReduceFromRRect();
+ this->attemptToSimplifyRRect();
}
GrShape(const GrShape&);
@@ -278,34 +278,9 @@ private:
*/
void setInheritedKey(const GrShape& parentShape, GrStyle::Apply, SkScalar scale);
- void attemptToReduceFromPath() {
- SkASSERT(Type::kPath == fType);
- fType = AttemptToReduceFromPathImpl(*fPath.get(), &fRRect, &fRRectDir, &fRRectStart,
- &fRRectIsInverted, fStyle.pathEffect(),
- fStyle.strokeRec());
- if (Type::kPath != fType) {
- fPath.reset();
- fInheritedKey.reset(0);
- }
- }
-
- void attemptToReduceFromRRect() {
- SkASSERT(Type::kRRect == fType);
- SkASSERT(!fInheritedKey.count());
- if (fRRectIsInverted) {
- if (fStyle.isDashed()) {
- // Dashing ignores the inverseness (currently). skbug.com/5421
- fRRectIsInverted = false;
- }
- } else if (fRRect.isEmpty()) {
- fType = Type::kEmpty;
- }
- }
+ void attemptToSimplifyPath();
- static Type AttemptToReduceFromPathImpl(const SkPath& path, SkRRect* rrect,
- SkPath::Direction* rrectDir, unsigned* rrectStart,
- bool* rrectIsInverted, const SkPathEffect* pe,
- const SkStrokeRec& strokeRec);
+ void attemptToSimplifyRRect();
static constexpr SkPath::Direction kDefaultRRectDir = SkPath::kCW_Direction;
static constexpr unsigned kDefaultRRectStart = 0;
« 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