aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-16 14:49:14 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-16 14:49:14 +0000
commitfa1d29112d44d0728cd10e2ff1f8982240303272 (patch)
treebb1d4b98f1ce03d3b61e1e3e7c930cd3ab97975f /include
parentd0b95896d66422444f787825cf78d384b8643d4d (diff)
Propagated AA flags through Ganesh's clip stack (in preparation for GL AA clipping)
Diffstat (limited to 'include')
-rw-r--r--include/core/SkClipStack.h3
-rw-r--r--include/gpu/GrClip.h9
-rw-r--r--include/gpu/GrClipIterator.h5
-rw-r--r--include/gpu/SkGr.h58
4 files changed, 25 insertions, 50 deletions
diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h
index 306ba2a490..5ad118cb20 100644
--- a/include/core/SkClipStack.h
+++ b/include/core/SkClipStack.h
@@ -49,7 +49,8 @@ public:
B2FIter(const SkClipStack& stack);
struct Clip {
- Clip() : fRect(NULL), fPath(NULL), fOp(SkRegion::kIntersect_Op) {}
+ Clip() : fRect(NULL), fPath(NULL), fOp(SkRegion::kIntersect_Op),
+ fDoAA(false) {}
friend bool operator==(const Clip& a, const Clip& b);
friend bool operator!=(const Clip& a, const Clip& b);
const SkRect* fRect; // if non-null, this is a rect clip
diff --git a/include/gpu/GrClip.h b/include/gpu/GrClip.h
index d86eb978c7..a23f99c1ce 100644
--- a/include/gpu/GrClip.h
+++ b/include/gpu/GrClip.h
@@ -39,6 +39,8 @@ public:
const GrRect& getConservativeBounds() const { return fConservativeBounds; }
+ bool requiresAA() const { return fRequiresAA; }
+
int getElementCount() const { return fList.count(); }
GrClipType getElementType(int i) const { return fList[i].fType; }
@@ -60,6 +62,8 @@ public:
GrSetOp getOp(int i) const { return fList[i].fOp; }
+ bool getDoAA(int i) const { return fList[i].fDoAA; }
+
bool isRect() const {
if (1 == fList.count() && kRect_ClipType == fList[0].fType &&
(kIntersect_SetOp == fList[0].fOp ||
@@ -112,8 +116,9 @@ private:
GrPath fPath;
GrPathFill fPathFill;
GrSetOp fOp;
+ bool fDoAA;
bool operator ==(const Element& e) const {
- if (e.fType != fType || e.fOp != fOp) {
+ if (e.fType != fType || e.fOp != fOp || e.fDoAA != fDoAA) {
return false;
}
switch (fType) {
@@ -132,6 +137,8 @@ private:
GrRect fConservativeBounds;
bool fConservativeBoundsValid;
+ bool fRequiresAA;
+
enum {
kPreAllocElements = 4,
};
diff --git a/include/gpu/GrClipIterator.h b/include/gpu/GrClipIterator.h
index 4a5cc7135f..a540bb4251 100644
--- a/include/gpu/GrClipIterator.h
+++ b/include/gpu/GrClipIterator.h
@@ -61,6 +61,11 @@ public:
virtual GrSetOp getOp() const = 0;
/**
+ * Gets anti-aliasing setting desired for the current clip
+ */
+ virtual bool getDoAA() const = 0;
+
+ /**
* Call to move to the next element in the list, previous path iter can be
* made invalid.
*/
diff --git a/include/gpu/SkGr.h b/include/gpu/SkGr.h
index f4dab532ed..6bc65499a2 100644
--- a/include/gpu/SkGr.h
+++ b/include/gpu/SkGr.h
@@ -103,14 +103,16 @@ public:
void reset(const SkClipStack& clipStack);
// overrides
- virtual bool isDone() const { return NULL == fCurr; }
- virtual void next() { fCurr = fIter.next(); }
- virtual void rewind() { this->reset(*fClipStack); }
- virtual GrClipType getType() const;
+ virtual bool isDone() const SK_OVERRIDE { return NULL == fCurr; }
+ virtual void next() SK_OVERRIDE { fCurr = fIter.next(); }
+ virtual void rewind() SK_OVERRIDE { this->reset(*fClipStack); }
+ virtual GrClipType getType() const SK_OVERRIDE;
- virtual GrSetOp getOp() const;
+ virtual GrSetOp getOp() const SK_OVERRIDE;
- virtual void getRect(GrRect* rect) const {
+ virtual bool getDoAA() const SK_OVERRIDE;
+
+ virtual void getRect(GrRect* rect) const SK_OVERRIDE {
if (!fCurr->fRect) {
rect->setEmpty();
} else {
@@ -118,11 +120,11 @@ public:
}
}
- virtual const GrPath* getPath() {
+ virtual const GrPath* getPath() SK_OVERRIDE {
return fCurr->fPath;
}
- virtual GrPathFill getPathFill() const;
+ virtual GrPathFill getPathFill() const SK_OVERRIDE;
private:
const SkClipStack* fClipStack;
@@ -132,46 +134,6 @@ private:
const SkClipStack::B2FIter::Clip* fCurr;
};
-class SkGrRegionIterator : public GrClipIterator {
-public:
- SkGrRegionIterator() {}
- SkGrRegionIterator(const SkRegion& region) { this->reset(region); }
-
- void reset(const SkRegion& region) {
- fRegion = &region;
- fIter.reset(region);
- }
-
- // overrides
- virtual bool isDone() const { return fIter.done(); }
- virtual void next() { fIter.next(); }
- virtual void rewind() { this->reset(*fRegion); }
- virtual GrClipType getType() const { return kRect_ClipType; }
-
- virtual GrSetOp getOp() const { return kUnion_SetOp; }
-
- virtual void getRect(GrRect* rect) const {
- const SkIRect& r = fIter.rect();
- rect->fLeft = GrIntToScalar(r.fLeft);
- rect->fTop = GrIntToScalar(r.fTop);
- rect->fRight = GrIntToScalar(r.fRight);
- rect->fBottom = GrIntToScalar(r.fBottom);
- }
-
- virtual const GrPath* getPath() {
- SkASSERT(0);
- return NULL;
- }
-
- virtual GrPathFill getPathFill() const {
- SkASSERT(0);
- return kWinding_PathFill;
- }
-private:
- const SkRegion* fRegion;
- SkRegion::Iterator fIter;
-};
-
class SkGlyphCache;
class SkGrFontScaler : public GrFontScaler {