[cairo-commit]
cairo/src cairo_gl_surface.c, 1.1, 1.2 cairo_gstate.c,
1.45, 1.46 cairo_pattern.c, 1.3, 1.4 cairo_surface.c, 1.26,
1.27 cairoint.h, 1.56, 1.57
David Reveman
commit at pdx.freedesktop.org
Thu Apr 22 02:22:38 PDT 2004
Committed by: davidr
Update of /cvs/cairo/cairo/src
In directory pdx:/tmp/cvs-serv9204/src
Modified Files:
cairo_gl_surface.c cairo_gstate.c cairo_pattern.c
cairo_surface.c cairoint.h
Log Message:
Fixed pattern source offset
Index: cairo_gl_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_gl_surface.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/cairo_gl_surface.c 9 Apr 2004 21:19:47 -0000 1.1
--- b/cairo_gl_surface.c 22 Apr 2004 09:22:36 -0000 1.2
***************
*** 585,590 ****
glitz_surface_t *programmatic = NULL;
cairo_gl_surface_t *gl_surface;
! double x = floor (_cairo_fixed_to_double (box->p1.x));
! double y = floor (_cairo_fixed_to_double (box->p1.y));
switch (pattern->type) {
--- 585,592 ----
glitz_surface_t *programmatic = NULL;
cairo_gl_surface_t *gl_surface;
! double bbox_x = floor (_cairo_fixed_to_double (box->p1.x));
! double bbox_y = floor (_cairo_fixed_to_double (box->p1.y));
! double x = bbox_x + pattern->source_offset.x;
! double y = bbox_y + pattern->source_offset.y;
switch (pattern->type) {
***************
*** 716,722 ****
pattern->source = &gl_surface->base;
! _cairo_pattern_add_source_offset (pattern,
! floor (_cairo_fixed_to_double (box->p1.x)),
! floor (_cairo_fixed_to_double (box->p1.y)));
return CAIRO_STATUS_SUCCESS;
--- 718,722 ----
pattern->source = &gl_surface->base;
! _cairo_pattern_set_source_offset (pattern, bbox_x, bbox_y);
return CAIRO_STATUS_SUCCESS;
Index: cairo_gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_gstate.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** a/cairo_gstate.c 6 Apr 2004 16:36:12 -0000 1.45
--- b/cairo_gstate.c 22 Apr 2004 09:22:36 -0000 1.46
***************
*** 1281,1284 ****
--- 1281,1288 ----
_cairo_pattern_transform (pattern, &gstate->ctm, &gstate->ctm_inverse);
+ _cairo_pattern_set_source_offset (pattern,
+ gstate->pattern_offset.x,
+ gstate->pattern_offset.y);
+
status = _cairo_surface_create_pattern (gstate->surface, pattern, extents);
if (status) {
***************
*** 1289,1296 ****
if (pattern->type == CAIRO_PATTERN_SURFACE)
_cairo_pattern_prepare_surface (pattern);
-
- _cairo_pattern_add_source_offset (pattern,
- gstate->pattern_offset.x,
- gstate->pattern_offset.y);
return CAIRO_STATUS_SUCCESS;
--- 1293,1296 ----
Index: cairo_pattern.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_pattern.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/cairo_pattern.c 20 Apr 2004 19:35:44 -0000 1.3
--- b/cairo_pattern.c 22 Apr 2004 09:22:36 -0000 1.4
***************
*** 337,345 ****
void
! _cairo_pattern_add_source_offset (cairo_pattern_t *pattern,
double x, double y)
{
! pattern->source_offset.x += x;
! pattern->source_offset.y += y;
}
--- 337,345 ----
void
! _cairo_pattern_set_source_offset (cairo_pattern_t *pattern,
double x, double y)
{
! pattern->source_offset.x = x;
! pattern->source_offset.y = y;
}
***************
*** 657,684 ****
case CAIRO_PATTERN_RADIAL: {
char *data;
! int width = ceil (_cairo_fixed_to_double (box->p2.x)) -
! floor (_cairo_fixed_to_double (box->p1.x));
! int height = ceil (_cairo_fixed_to_double (box->p2.y)) -
! floor (_cairo_fixed_to_double (box->p1.y));
data = malloc (width * height * 4);
if (!data)
return NULL;
!
! _cairo_pattern_add_source_offset (pattern,
! floor (_cairo_fixed_to_double (box->p1.x)),
! floor (_cairo_fixed_to_double (box->p1.y)));
!
if (pattern->type == CAIRO_PATTERN_RADIAL)
_cairo_image_data_set_radial (pattern,
! pattern->source_offset.x,
! pattern->source_offset.y,
data, width, height);
else
_cairo_image_data_set_linear (pattern,
! pattern->source_offset.x,
! pattern->source_offset.y,
data, width, height);
surface = cairo_image_surface_create_for_data (data,
CAIRO_FORMAT_ARGB32,
--- 657,682 ----
case CAIRO_PATTERN_RADIAL: {
char *data;
! int x = floor (_cairo_fixed_to_double (box->p1.x));
! int y = floor (_cairo_fixed_to_double (box->p1.y));
! int width = ceil (_cairo_fixed_to_double (box->p2.x)) - x;
! int height = ceil (_cairo_fixed_to_double (box->p2.y)) - y;
data = malloc (width * height * 4);
if (!data)
return NULL;
!
if (pattern->type == CAIRO_PATTERN_RADIAL)
_cairo_image_data_set_radial (pattern,
! pattern->source_offset.x + x,
! pattern->source_offset.y + y,
data, width, height);
else
_cairo_image_data_set_linear (pattern,
! pattern->source_offset.x + x,
! pattern->source_offset.y + y,
data, width, height);
+ _cairo_pattern_set_source_offset (pattern, x, y);
+
surface = cairo_image_surface_create_for_data (data,
CAIRO_FORMAT_ARGB32,
Index: cairo_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_surface.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** a/cairo_surface.c 9 Apr 2004 21:19:47 -0000 1.26
--- b/cairo_surface.c 22 Apr 2004 09:22:36 -0000 1.27
***************
*** 425,432 ****
/* handle pattern opacity */
if (pattern->color.alpha != 1.0) {
! int width = ceil (_cairo_fixed_to_double (box->p2.x)) -
! floor (_cairo_fixed_to_double (box->p1.x));
! int height = ceil (_cairo_fixed_to_double (box->p2.y)) -
! floor (_cairo_fixed_to_double (box->p1.y));
cairo_pattern_t alpha;
--- 425,432 ----
/* handle pattern opacity */
if (pattern->color.alpha != 1.0) {
! int x = floor (_cairo_fixed_to_double (box->p1.x));
! int y = floor (_cairo_fixed_to_double (box->p1.y));
! int width = ceil (_cairo_fixed_to_double (box->p2.x)) - x;
! int height = ceil (_cairo_fixed_to_double (box->p2.y)) - y;
cairo_pattern_t alpha;
***************
*** 463,469 ****
if (status == CAIRO_STATUS_SUCCESS) {
! _cairo_pattern_add_source_offset (pattern,
! floor (_cairo_fixed_to_double (box->p1.x)),
! floor (_cairo_fixed_to_double (box->p1.y)));
} else
cairo_surface_destroy (pattern->source);
--- 463,469 ----
if (status == CAIRO_STATUS_SUCCESS) {
! _cairo_pattern_set_source_offset (pattern,
! pattern->source_offset.x + x,
! pattern->source_offset.y + y);
} else
cairo_surface_destroy (pattern->source);
Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** a/cairoint.h 20 Apr 2004 19:35:44 -0000 1.56
--- b/cairoint.h 22 Apr 2004 09:22:36 -0000 1.57
***************
*** 1336,1340 ****
extern void __internal_linkage
! _cairo_pattern_add_source_offset (cairo_pattern_t *pattern,
double x, double y);
--- 1336,1340 ----
extern void __internal_linkage
! _cairo_pattern_set_source_offset (cairo_pattern_t *pattern,
double x, double y);
More information about the cairo-commit
mailing list