aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-09 18:10:49 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-09 18:10:49 +0000
commit73e71023a05393ef0aa12bf3644a1c704feeec0c (patch)
treee10898eed6b7721bbd5b234f0f496bc1d7f2e976
parentd74e710c00700aea603d7843d3ff670043bb1c15 (diff)
Added method of getting top genID from SkClipStack
-rw-r--r--include/core/SkClipStack.h3
-rw-r--r--src/core/SkClipStack.cpp11
2 files changed, 14 insertions, 0 deletions
diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h
index 077c4b7eea..7ebd4928d1 100644
--- a/include/core/SkClipStack.h
+++ b/include/core/SkClipStack.h
@@ -100,6 +100,8 @@ public:
static const int32_t kEmptyGenID = 1; // no pixels writeable
static const int32_t kWideOpenGenID = 2; // all pixels writeable
+ int32_t getTopmostGenID() const;
+
private:
struct Rec;
@@ -127,6 +129,7 @@ public:
const SkPath* fPath; // if non-null, this is a path clip
SkRegion::Op fOp;
bool fDoAA;
+ int32_t fGenID;
};
/**
diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp
index 25e8ced29c..ff771c1cbe 100644
--- a/src/core/SkClipStack.cpp
+++ b/src/core/SkClipStack.cpp
@@ -690,6 +690,7 @@ const SkClipStack::Iter::Clip* SkClipStack::Iter::updateClip(
}
fClip.fOp = rec->fOp;
fClip.fDoAA = rec->fDoAA;
+ fClip.fGenID = rec->fGenID;
return &fClip;
}
@@ -812,3 +813,13 @@ void SkClipStack::purgeClip(Rec* rec) {
int32_t SkClipStack::GetNextGenID() {
return sk_atomic_inc(&gGenID);
}
+
+int32_t SkClipStack::getTopmostGenID() const {
+
+ if (fDeque.empty()) {
+ return kInvalidGenID;
+ }
+
+ Rec* rec = (Rec*)fDeque.back();
+ return rec->fGenID;
+}