[cairo-commit] cairo/src cairo_gl_surface.c,1.7,1.8
David Reveman
commit at pdx.freedesktop.org
Tue May 11 05:31:18 PDT 2004
Committed by: davidr
Update of /cvs/cairo/cairo/src
In directory pdx:/tmp/cvs-serv27990/src
Modified Files:
cairo_gl_surface.c
Log Message:
Better surface pattern support
Index: cairo_gl_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_gl_surface.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** a/cairo_gl_surface.c 1 May 2004 12:50:46 -0000 1.7
--- b/cairo_gl_surface.c 11 May 2004 12:31:16 -0000 1.8
***************
*** 65,68 ****
--- 65,69 ----
long int hints;
int owns_surface;
+ unsigned short opacity;
cairo_pattern_t pattern;
***************
*** 91,97 ****
#define CAIRO_GL_COMPOSITE_TRAPEZOIDS_SUPPORT(surface) \
! ((surface->format->stencil_size < \
! ((surface->hints & GLITZ_HINT_CLIPPING_MASK)? 2: 1)) && \
! (!CAIRO_GL_OFFSCREEN_SUPPORT (surface)))
#define CAIRO_GL_SURFACE_IS_OFFSCREEN(surface) \
--- 92,98 ----
#define CAIRO_GL_COMPOSITE_TRAPEZOIDS_SUPPORT(surface) \
! ((surface->format->stencil_size >= \
! ((surface->hints & GLITZ_HINT_CLIPPING_MASK)? 2: 1)) || \
! CAIRO_GL_OFFSCREEN_SUPPORT (surface))
#define CAIRO_GL_SURFACE_IS_OFFSCREEN(surface) \
***************
*** 547,554 ****
--- 548,559 ----
}
+ glitz_surface_set_polyopacity (dst->surface, src->opacity);
+
glitz_composite_trapezoids (_glitz_operator (operator),
src->surface, dst->surface,
x_src, y_src, (glitz_trapezoid_t *) traps,
num_traps);
+
+ glitz_surface_set_polyopacity (dst->surface, 0xffff);
if (src_clone)
***************
*** 606,611 ****
{
cairo_gl_surface_t *surface = abstract_surface;
! glitz_surface_t *programmatic = NULL;
! cairo_gl_surface_t *gl_surface;
switch (pattern->type) {
--- 611,616 ----
{
cairo_gl_surface_t *surface = abstract_surface;
! glitz_surface_t *source = NULL;
! cairo_gl_surface_t *src;
switch (pattern->type) {
***************
*** 618,622 ****
color.alpha = pattern->color.alpha_short;
! programmatic = glitz_surface_create_solid (&color);
} break;
case CAIRO_PATTERN_LINEAR:
--- 623,627 ----
color.alpha = pattern->color.alpha_short;
! source = glitz_surface_create_solid (&color);
} break;
case CAIRO_PATTERN_LINEAR:
***************
*** 685,690 ****
stop.y = _cairo_fixed_from_double (pattern->u.linear.point1.y);
! programmatic =
! glitz_surface_create_linear (&start, &stop, color_range);
} else {
glitz_point_fixed_t center;
--- 690,694 ----
stop.y = _cairo_fixed_from_double (pattern->u.linear.point1.y);
! source = glitz_surface_create_linear (&start, &stop, color_range);
} else {
glitz_point_fixed_t center;
***************
*** 693,697 ****
center.y = _cairo_fixed_from_double (pattern->u.radial.center1.y);
! programmatic = glitz_surface_create_radial
(¢er,
_cairo_fixed_from_double (pattern->u.radial.radius0),
--- 697,701 ----
center.y = _cairo_fixed_from_double (pattern->u.radial.center1.y);
! source = glitz_surface_create_radial
(¢er,
_cairo_fixed_from_double (pattern->u.radial.radius0),
***************
*** 703,718 ****
} break;
case CAIRO_PATTERN_SURFACE:
return CAIRO_INT_STATUS_UNSUPPORTED;
break;
}
! if (!programmatic)
return CAIRO_STATUS_NO_MEMORY;
! gl_surface = (cairo_gl_surface_t *)
! _cairo_gl_surface_create (programmatic, 1);
! if (!gl_surface) {
! glitz_surface_destroy (programmatic);
!
return CAIRO_STATUS_NO_MEMORY;
}
--- 707,754 ----
} break;
case CAIRO_PATTERN_SURFACE:
+ if (CAIRO_GL_COMPOSITE_TRAPEZOIDS_SUPPORT (surface)) {
+ cairo_gl_surface_t *src_clone = NULL;
+ cairo_surface_t *generic_src = pattern->u.surface.surface;
+
+ src = (cairo_gl_surface_t *) generic_src;
+ if (generic_src->backend != surface->base.backend) {
+ src_clone =
+ _cairo_gl_surface_clone_similar (generic_src, surface,
+ CAIRO_FORMAT_ARGB32);
+ if (!src_clone)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+ } else {
+ src_clone = (cairo_gl_surface_t *)
+ _cairo_gl_surface_create (src->surface, 0);
+ if (!src_clone)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ cairo_surface_set_filter
+ (&src_clone->base, cairo_surface_get_filter (generic_src));
+
+ cairo_surface_set_matrix (&src_clone->base,
+ &generic_src->matrix);
+ }
+
+ cairo_surface_set_repeat (&src_clone->base, generic_src->repeat);
+
+ src_clone->opacity = (unsigned short)
+ (pattern->color.alpha * 0xffff);
+
+ pattern->source = &src_clone->base;
+
+ return CAIRO_STATUS_SUCCESS;
+ }
return CAIRO_INT_STATUS_UNSUPPORTED;
break;
}
! if (!source)
return CAIRO_STATUS_NO_MEMORY;
! src = (cairo_gl_surface_t *) _cairo_gl_surface_create (source, 1);
! if (!src) {
! glitz_surface_destroy (source);
!
return CAIRO_STATUS_NO_MEMORY;
}
***************
*** 720,729 ****
if (pattern->type == CAIRO_PATTERN_LINEAR ||
pattern->type == CAIRO_PATTERN_RADIAL)
! cairo_surface_set_matrix (&gl_surface->base, &pattern->matrix);
!
! _cairo_pattern_init_copy (&gl_surface->pattern, pattern);
! gl_surface->pattern_box = *box;
! pattern->source = &gl_surface->base;
return CAIRO_STATUS_SUCCESS;
--- 756,765 ----
if (pattern->type == CAIRO_PATTERN_LINEAR ||
pattern->type == CAIRO_PATTERN_RADIAL)
! cairo_surface_set_matrix (&src->base, &pattern->matrix);
! _cairo_pattern_init_copy (&src->pattern, pattern);
! src->pattern_box = *box;
!
! pattern->source = &src->base;
return CAIRO_STATUS_SUCCESS;
***************
*** 818,821 ****
--- 854,858 ----
crsurface->hints = glitz_surface_get_hints (surface);
crsurface->owns_surface = owns_surface;
+ crsurface->opacity = 0xffff;
return (cairo_surface_t *) crsurface;
More information about the cairo-commit
mailing list