sna: Tweak find clip box asserts
Reordering the asserts to save one predicate! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
cb2269d130
commit
b7e28618cd
|
|
@ -1208,11 +1208,13 @@ find_clip_box_for_y(const BoxRec *begin, const BoxRec *end, int16_t y)
|
|||
|
||||
/* Quick test if scanline is within range of clip boxes */
|
||||
if (begin->y2 > y) {
|
||||
assert(__find_clip_box_for_y(begin, end, y) == begin);
|
||||
assert(end == begin + 1 ||
|
||||
__find_clip_box_for_y(begin, end, y) == begin);
|
||||
return begin;
|
||||
}
|
||||
if (y >= end[-1].y2) {
|
||||
assert(__find_clip_box_for_y(begin, end, y) == end);
|
||||
assert(end == begin + 1 ||
|
||||
__find_clip_box_for_y(begin, end, y) == end);
|
||||
return end;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7165,14 +7165,14 @@ sna_copy_area(DrawablePtr src, DrawablePtr dst, GCPtr gc,
|
|||
const BoxRec *
|
||||
__find_clip_box_for_y(const BoxRec *begin, const BoxRec *end, int16_t y)
|
||||
{
|
||||
assert(begin != end);
|
||||
while (end > begin + 1) {
|
||||
assert(end - begin > 1);
|
||||
do {
|
||||
const BoxRec *mid = begin + (end - begin) / 2;
|
||||
if (mid->y2 > y)
|
||||
end = mid;
|
||||
else
|
||||
begin = mid;
|
||||
}
|
||||
} while (end > begin + 1);
|
||||
if (begin->y2 > y)
|
||||
return begin;
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in New Issue