aboutsummaryrefslogtreecommitdiffhomepage
path: root/gpu/src/GrPath.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-03-03 13:54:13 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-03-03 13:54:13 +0000
commitd302f1401b3c9aea094804bad4e76de98782cfe8 (patch)
treeb46ec6c4de175842aef051d7b812785dacbd1d73 /gpu/src/GrPath.cpp
parent1d12b1fd66e5be27fb4769ee09ce4fcd6bcc5979 (diff)
Add support for clipstack to Gr. GrClip is now a list of rects and paths with set operations to combine them. The stencil buffer is used to perform the set operations to put the clip into the stencil buffer. Building Gr's clip from Skia's clipStack is currently disabled due to the fact that Skia's clipStack is relative to the root layer not the current layer. This will be fixed in a subsequent CL.
git-svn-id: http://skia.googlecode.com/svn/trunk@878 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gpu/src/GrPath.cpp')
-rw-r--r--gpu/src/GrPath.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/gpu/src/GrPath.cpp b/gpu/src/GrPath.cpp
index 554b3b915a..ca5c43baa2 100644
--- a/gpu/src/GrPath.cpp
+++ b/gpu/src/GrPath.cpp
@@ -3,6 +3,8 @@
GrPath::GrPath() {}
GrPath::GrPath(const GrPath& src) : INHERITED() {
+ GrPath::Iter iter(src);
+ this->resetFromIter(&iter);
}
GrPath::GrPath(GrPathIter& iter) {
@@ -12,6 +14,26 @@ GrPath::GrPath(GrPathIter& iter) {
GrPath::~GrPath() {
}
+bool GrPath::operator ==(const GrPath& path) const {
+ if (fVerbs.count() != path.fVerbs.count() ||
+ fPts.count() != path.fPts.count()) {
+ return false;
+ }
+
+ for (int v = 0; v < fVerbs.count(); ++v) {
+ if (fVerbs[v] != path.fVerbs[v]) {
+ return false;
+ }
+ }
+
+ for (int p = 0; p < fPts.count(); ++p) {
+ if (fPts[p] != path.fPts[p]) {
+ return false;
+ }
+ }
+ return true;
+}
+
void GrPath::ensureMoveTo() {
if (fVerbs.isEmpty() || this->wasLastVerb(kClose)) {
*fVerbs.append() = kMove;
@@ -90,6 +112,7 @@ void GrPath::resetFromIter(GrPathIter* iter) {
break;
}
}
+ fConvexHint = iter->convexHint();
}
///////////////////////////////////////////////////////////////////////////////
@@ -157,7 +180,7 @@ GrPathIter::Command GrPath::Iter::next(GrPoint points[]) {
return (GrPathIter::Command)cmd;
}
-GrPathIter::ConvexHint GrPath::Iter::hint() const {
+GrPathIter::ConvexHint GrPath::Iter::convexHint() const {
return fPath.getConvexHint();
}