mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-04-22 16:20:47 +02:00
[gl] Use spans for trapezois.
Always use spans, even for unaligned boxes. In the future (given a new interface) we may want to emit the common unaligned box code more efficient than a per-scanline computation -- but for now simply avoid the requirements to write a temporary CPU buffer.
This commit is contained in:
parent
e65dfacab5
commit
87175334a5
6 changed files with 46 additions and 39 deletions
|
|
@ -667,7 +667,6 @@ _cairo_gl_surface_get_image (cairo_gl_surface_t *surface,
|
|||
GLenum err;
|
||||
GLenum format, type;
|
||||
cairo_format_t cairo_format;
|
||||
int y;
|
||||
unsigned int cpp;
|
||||
|
||||
/* Want to use a switch statement here but the compiler gets whiny. */
|
||||
|
|
@ -1481,6 +1480,23 @@ _cairo_gl_surface_composite_trapezoids (cairo_operator_t op,
|
|||
cairo_surface_pattern_t traps_pattern;
|
||||
cairo_int_status_t status;
|
||||
|
||||
if (! _cairo_gl_operator_is_supported (op))
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
|
||||
if (_cairo_surface_check_span_renderer (op,pattern,&dst->base, antialias)) {
|
||||
status =
|
||||
_cairo_surface_composite_trapezoids_as_polygon (&dst->base,
|
||||
op, pattern,
|
||||
antialias,
|
||||
src_x, src_y,
|
||||
dst_x, dst_y,
|
||||
width, height,
|
||||
traps, num_traps,
|
||||
clip_region);
|
||||
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _cairo_gl_get_traps_pattern (dst,
|
||||
dst_x, dst_y, width, height,
|
||||
traps, num_traps, antialias,
|
||||
|
|
@ -1810,8 +1826,7 @@ static cairo_bool_t
|
|||
_cairo_gl_surface_check_span_renderer (cairo_operator_t op,
|
||||
const cairo_pattern_t *pattern,
|
||||
void *abstract_dst,
|
||||
cairo_antialias_t antialias,
|
||||
const cairo_composite_rectangles_t *rects)
|
||||
cairo_antialias_t antialias)
|
||||
{
|
||||
if (! _cairo_gl_operator_is_supported (op))
|
||||
return FALSE;
|
||||
|
|
@ -1824,7 +1839,6 @@ _cairo_gl_surface_check_span_renderer (cairo_operator_t op,
|
|||
(void) pattern;
|
||||
(void) abstract_dst;
|
||||
(void) antialias;
|
||||
(void) rects;
|
||||
}
|
||||
|
||||
static cairo_span_renderer_t *
|
||||
|
|
|
|||
|
|
@ -1483,15 +1483,13 @@ static cairo_bool_t
|
|||
_cairo_image_surface_check_span_renderer (cairo_operator_t op,
|
||||
const cairo_pattern_t *pattern,
|
||||
void *abstract_dst,
|
||||
cairo_antialias_t antialias,
|
||||
const cairo_composite_rectangles_t *rects)
|
||||
cairo_antialias_t antialias)
|
||||
{
|
||||
return TRUE;
|
||||
(void) op;
|
||||
(void) pattern;
|
||||
(void) abstract_dst;
|
||||
(void) antialias;
|
||||
(void) rects;
|
||||
}
|
||||
|
||||
static cairo_span_renderer_t *
|
||||
|
|
|
|||
|
|
@ -1184,10 +1184,7 @@ _cairo_surface_fallback_stroke (cairo_surface_t *surface,
|
|||
goto CLEANUP;
|
||||
}
|
||||
|
||||
if (antialias != CAIRO_ANTIALIAS_NONE &&
|
||||
_cairo_surface_check_span_renderer (op, source, surface,
|
||||
antialias, NULL))
|
||||
{
|
||||
if (_cairo_surface_check_span_renderer (op, source, surface, antialias)) {
|
||||
cairo_composite_spans_info_t info;
|
||||
|
||||
info.polygon = &polygon;
|
||||
|
|
@ -1327,10 +1324,7 @@ _cairo_surface_fallback_fill (cairo_surface_t *surface,
|
|||
}
|
||||
|
||||
|
||||
if (antialias != CAIRO_ANTIALIAS_NONE &&
|
||||
_cairo_surface_check_span_renderer (op, source, surface,
|
||||
antialias, NULL))
|
||||
{
|
||||
if (_cairo_surface_check_span_renderer (op, source, surface, antialias)) {
|
||||
cairo_composite_spans_info_t info;
|
||||
|
||||
info.polygon = &polygon;
|
||||
|
|
|
|||
|
|
@ -2218,29 +2218,22 @@ _cairo_surface_create_span_renderer (cairo_operator_t op,
|
|||
}
|
||||
|
||||
cairo_bool_t
|
||||
_cairo_surface_check_span_renderer (cairo_operator_t op,
|
||||
const cairo_pattern_t *pattern,
|
||||
cairo_surface_t *dst,
|
||||
cairo_antialias_t antialias,
|
||||
const cairo_composite_rectangles_t *rects)
|
||||
_cairo_surface_check_span_renderer (cairo_operator_t op,
|
||||
const cairo_pattern_t *pattern,
|
||||
cairo_surface_t *dst,
|
||||
cairo_antialias_t antialias)
|
||||
{
|
||||
cairo_int_status_t status;
|
||||
|
||||
assert (dst->snapshot_of == NULL);
|
||||
assert (dst->status == CAIRO_STATUS_SUCCESS);
|
||||
assert (! dst->finished);
|
||||
|
||||
if (unlikely (dst->status))
|
||||
/* XXX: Currently we have no mono span renderer */
|
||||
if (antialias == CAIRO_ANTIALIAS_NONE)
|
||||
return FALSE;
|
||||
|
||||
if (unlikely (dst->finished)) {
|
||||
status = _cairo_surface_set_error (dst, CAIRO_STATUS_SURFACE_FINISHED);
|
||||
return FALSE;
|
||||
}
|
||||
if (dst->backend->check_span_renderer != NULL)
|
||||
return dst->backend->check_span_renderer (op, pattern, dst, antialias);
|
||||
|
||||
if (dst->backend->check_span_renderer) {
|
||||
return dst->backend->check_span_renderer (op, pattern, dst,
|
||||
antialias,
|
||||
rects);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2003,14 +2003,12 @@ static cairo_bool_t
|
|||
_cairo_win32_surface_check_span_renderer (cairo_operator_t op,
|
||||
const cairo_pattern_t *pattern,
|
||||
void *abstract_dst,
|
||||
cairo_antialias_t antialias,
|
||||
const cairo_composite_rectangles_t *rects)
|
||||
cairo_antialias_t antialias)
|
||||
{
|
||||
(void) op;
|
||||
(void) pattern;
|
||||
(void) abstract_dst;
|
||||
(void) antialias;
|
||||
(void) rects;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -683,8 +683,7 @@ struct _cairo_surface_backend {
|
|||
(*check_span_renderer) (cairo_operator_t op,
|
||||
const cairo_pattern_t *pattern,
|
||||
void *dst,
|
||||
cairo_antialias_t antialias,
|
||||
const cairo_composite_rectangles_t *rects);
|
||||
cairo_antialias_t antialias);
|
||||
|
||||
cairo_warn cairo_int_status_t
|
||||
(*copy_page) (void *surface);
|
||||
|
|
@ -1965,6 +1964,18 @@ _cairo_surface_composite_trapezoids (cairo_operator_t op,
|
|||
int ntraps,
|
||||
cairo_region_t *clip_region);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
_cairo_surface_composite_trapezoids_as_polygon (cairo_surface_t *surface,
|
||||
cairo_operator_t op,
|
||||
const cairo_pattern_t *pattern,
|
||||
cairo_antialias_t antialias,
|
||||
int src_x, int src_y,
|
||||
int dst_x, int dst_y,
|
||||
int width, int height,
|
||||
cairo_trapezoid_t *traps,
|
||||
int num_traps,
|
||||
cairo_region_t *clip_region);
|
||||
|
||||
cairo_private cairo_span_renderer_t *
|
||||
_cairo_surface_create_span_renderer (cairo_operator_t op,
|
||||
const cairo_pattern_t *pattern,
|
||||
|
|
@ -1977,8 +1988,7 @@ cairo_private cairo_bool_t
|
|||
_cairo_surface_check_span_renderer (cairo_operator_t op,
|
||||
const cairo_pattern_t *pattern,
|
||||
cairo_surface_t *dst,
|
||||
cairo_antialias_t antialias,
|
||||
const cairo_composite_rectangles_t *rects);
|
||||
cairo_antialias_t antialias);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
_cairo_surface_acquire_source_image (cairo_surface_t *surface,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue