mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 11:08:12 +02:00
[fill] Construct trap using rectangle directly.
Avoid the overhead in sorting the edges within _cairo_traps_tessellate_convex_quad() by using our prior knowledge that we have a simple rectangle and construct the trap from the extreme points.
This commit is contained in:
parent
e749b58af8
commit
91f0b8b1ea
1 changed files with 14 additions and 2 deletions
|
|
@ -215,8 +215,20 @@ _cairo_path_fixed_fill_rectangle (cairo_path_fixed_t *path,
|
|||
cairo_traps_t *traps)
|
||||
{
|
||||
if (_cairo_path_fixed_is_box (path, NULL)) {
|
||||
return _cairo_traps_tessellate_convex_quad (traps,
|
||||
path->buf_head.base.points);
|
||||
cairo_point_t *p = path->buf_head.base.points;
|
||||
cairo_point_t *top_left, *bot_right;
|
||||
int n;
|
||||
|
||||
top_left = &p[0];
|
||||
bot_right = &p[0];
|
||||
for (n = 1; n < 4; n++) {
|
||||
if (p[n].x <= top_left->x && p[n].y <= top_left->y)
|
||||
top_left = &p[n];
|
||||
if (p[n].x >= bot_right->x && p[n].y >= bot_right->y)
|
||||
bot_right = &p[n];
|
||||
}
|
||||
|
||||
return _cairo_traps_tessellate_rectangle (traps, top_left, bot_right);
|
||||
}
|
||||
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue