mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-01 18:28:00 +02:00
test-surfaces: compilation fixes
Update to the last minute changes in the traps compositor API. And so it begins. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
af9fbd176b
commit
65a954d5ba
2 changed files with 0 additions and 94 deletions
|
|
@ -628,92 +628,6 @@ typedef struct {
|
|||
cairo_antialias_t antialias;
|
||||
} composite_traps_info_t;
|
||||
|
||||
#define CAIRO_FIXED_16_16_MIN _cairo_fixed_from_int (-32768)
|
||||
#define CAIRO_FIXED_16_16_MAX _cairo_fixed_from_int (32767)
|
||||
|
||||
static cairo_bool_t
|
||||
line_exceeds_16_16 (const cairo_line_t *line)
|
||||
{
|
||||
return
|
||||
line->p1.x <= CAIRO_FIXED_16_16_MIN ||
|
||||
line->p1.x >= CAIRO_FIXED_16_16_MAX ||
|
||||
|
||||
line->p2.x <= CAIRO_FIXED_16_16_MIN ||
|
||||
line->p2.x >= CAIRO_FIXED_16_16_MAX ||
|
||||
|
||||
line->p1.y <= CAIRO_FIXED_16_16_MIN ||
|
||||
line->p1.y >= CAIRO_FIXED_16_16_MAX ||
|
||||
|
||||
line->p2.y <= CAIRO_FIXED_16_16_MIN ||
|
||||
line->p2.y >= CAIRO_FIXED_16_16_MAX;
|
||||
}
|
||||
|
||||
static void
|
||||
project_line_x_onto_16_16 (const cairo_line_t *line,
|
||||
cairo_fixed_t top,
|
||||
cairo_fixed_t bottom,
|
||||
pixman_line_fixed_t *out)
|
||||
{
|
||||
/* XXX use fixed-point arithmetic? */
|
||||
cairo_point_double_t p1, p2;
|
||||
double m;
|
||||
|
||||
p1.x = _cairo_fixed_to_double (line->p1.x);
|
||||
p1.y = _cairo_fixed_to_double (line->p1.y);
|
||||
|
||||
p2.x = _cairo_fixed_to_double (line->p2.x);
|
||||
p2.y = _cairo_fixed_to_double (line->p2.y);
|
||||
|
||||
m = (p2.x - p1.x) / (p2.y - p1.y);
|
||||
out->p1.x = _cairo_fixed_16_16_from_double (p1.x + m * _cairo_fixed_to_double (top - line->p1.y));
|
||||
out->p2.x = _cairo_fixed_16_16_from_double (p1.x + m * _cairo_fixed_to_double (bottom - line->p1.y));
|
||||
}
|
||||
|
||||
static void
|
||||
_pixman_image_add_traps (pixman_image_t *image,
|
||||
int dst_x, int dst_y,
|
||||
cairo_traps_t *traps)
|
||||
{
|
||||
cairo_trapezoid_t *t = traps->traps;
|
||||
int num_traps = traps->num_traps;
|
||||
while (num_traps--) {
|
||||
pixman_trapezoid_t trap;
|
||||
|
||||
/* top/bottom will be clamped to surface bounds */
|
||||
trap.top = _cairo_fixed_to_16_16 (t->top);
|
||||
trap.bottom = _cairo_fixed_to_16_16 (t->bottom);
|
||||
|
||||
/* However, all the other coordinates will have been left untouched so
|
||||
* as not to introduce numerical error. Recompute them if they
|
||||
* exceed the 16.16 limits.
|
||||
*/
|
||||
if (unlikely (line_exceeds_16_16 (&t->left))) {
|
||||
project_line_x_onto_16_16 (&t->left, t->top, t->bottom, &trap.left);
|
||||
trap.left.p1.y = trap.top;
|
||||
trap.left.p2.y = trap.bottom;
|
||||
} else {
|
||||
trap.left.p1.x = _cairo_fixed_to_16_16 (t->left.p1.x);
|
||||
trap.left.p1.y = _cairo_fixed_to_16_16 (t->left.p1.y);
|
||||
trap.left.p2.x = _cairo_fixed_to_16_16 (t->left.p2.x);
|
||||
trap.left.p2.y = _cairo_fixed_to_16_16 (t->left.p2.y);
|
||||
}
|
||||
|
||||
if (unlikely (line_exceeds_16_16 (&t->right))) {
|
||||
project_line_x_onto_16_16 (&t->right, t->top, t->bottom, &trap.right);
|
||||
trap.right.p1.y = trap.top;
|
||||
trap.right.p2.y = trap.bottom;
|
||||
} else {
|
||||
trap.right.p1.x = _cairo_fixed_to_16_16 (t->right.p1.x);
|
||||
trap.right.p1.y = _cairo_fixed_to_16_16 (t->right.p1.y);
|
||||
trap.right.p2.x = _cairo_fixed_to_16_16 (t->right.p2.x);
|
||||
trap.right.p2.y = _cairo_fixed_to_16_16 (t->right.p2.y);
|
||||
}
|
||||
|
||||
pixman_rasterize_trapezoid (image, &trap, -dst_x, -dst_y);
|
||||
t++;
|
||||
}
|
||||
}
|
||||
|
||||
static cairo_int_status_t
|
||||
composite_traps (cairo_image_surface_t *dst,
|
||||
void *closure,
|
||||
|
|
|
|||
|
|
@ -238,13 +238,6 @@ set_clip_region (void *_surface,
|
|||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_bool_t
|
||||
has_snapshot (void *_dst,
|
||||
const cairo_pattern_t *pattern)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
pattern_to_surface (cairo_surface_t *dst,
|
||||
const cairo_pattern_t *pattern,
|
||||
|
|
@ -412,7 +405,6 @@ no_traps_compositor_get (void)
|
|||
compositor.release = release;
|
||||
compositor.set_clip_region = set_clip_region;
|
||||
compositor.pattern_to_surface = pattern_to_surface;
|
||||
compositor.has_snapshot = has_snapshot;
|
||||
compositor.draw_image_boxes = draw_image_boxes;
|
||||
//compositor.copy_boxes = copy_boxes;
|
||||
compositor.fill_boxes = fill_boxes;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue