зеркало из https://github.com/mozilla/moz-skia.git
[PDF] Improve the SkClipStack skipping prefix code.
Because of intersecting done in SkClipStack, we may have to do more work in the last entry of the prefix. Review URL: http://codereview.appspot.com/4530066 git-svn-id: http://skia.googlecode.com/svn/trunk@1418 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
19e3c1ed1b
Коммит
8887ede824
|
@ -43,6 +43,7 @@ public:
|
||||||
|
|
||||||
struct Clip {
|
struct Clip {
|
||||||
friend bool operator==(const Clip& a, const Clip& b);
|
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
|
const SkRect* fRect; // if non-null, this is a rect clip
|
||||||
const SkPath* fPath; // if non-null, this is a path clip
|
const SkPath* fPath; // if non-null, this is a path clip
|
||||||
SkRegion::Op fOp;
|
SkRegion::Op fOp;
|
||||||
|
|
|
@ -188,6 +188,11 @@ bool operator==(const SkClipStack::B2FIter::Clip& a,
|
||||||
((a.fPath == NULL && b.fPath == NULL) || *a.fPath == *b.fPath);
|
((a.fPath == NULL && b.fPath == NULL) || *a.fPath == *b.fPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator!=(const SkClipStack::B2FIter::Clip& a,
|
||||||
|
const SkClipStack::B2FIter::Clip& b) {
|
||||||
|
return !(a == b);
|
||||||
|
}
|
||||||
|
|
||||||
SkClipStack::B2FIter::B2FIter(const SkClipStack& stack) {
|
SkClipStack::B2FIter::B2FIter(const SkClipStack& stack) {
|
||||||
this->reset(stack);
|
this->reset(stack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,11 +233,29 @@ static void skip_clip_stack_prefix(const SkClipStack& prefix,
|
||||||
const SkClipStack::B2FIter::Clip* prefixEntry;
|
const SkClipStack::B2FIter::Clip* prefixEntry;
|
||||||
const SkClipStack::B2FIter::Clip* iterEntry;
|
const SkClipStack::B2FIter::Clip* iterEntry;
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
for (prefixEntry = prefixIter.next(); prefixEntry;
|
for (prefixEntry = prefixIter.next(); prefixEntry;
|
||||||
prefixEntry = prefixIter.next()) {
|
prefixEntry = prefixIter.next(), count++) {
|
||||||
iterEntry = iter->next();
|
iterEntry = iter->next();
|
||||||
SkASSERT(iterEntry);
|
SkASSERT(iterEntry);
|
||||||
SkASSERT(*prefixEntry == *iterEntry);
|
// Because of SkClipStack does internal intersection, the last clip
|
||||||
|
// entry may differ.
|
||||||
|
if(*prefixEntry != *iterEntry) {
|
||||||
|
SkASSERT(prefixEntry->fOp == SkRegion::kIntersect_Op);
|
||||||
|
SkASSERT(iterEntry->fOp == SkRegion::kIntersect_Op);
|
||||||
|
SkASSERT((iterEntry->fRect == NULL) ==
|
||||||
|
(prefixEntry->fRect == NULL));
|
||||||
|
SkASSERT((iterEntry->fPath == NULL) ==
|
||||||
|
(prefixEntry->fPath == NULL));
|
||||||
|
// We need to back up the iterator by one but don't have that
|
||||||
|
// function, so reset and go forward by one less.
|
||||||
|
iter->reset(stack);
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
iter->next();
|
||||||
|
}
|
||||||
|
prefixEntry = prefixIter.next();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SkASSERT(prefixEntry == NULL);
|
SkASSERT(prefixEntry == NULL);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче