mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 05:18:01 +02:00
Offset the src pattern by (0,0)->CTM. This fixes test/translate-show-surface.
Use unsigned cahr* to match new prototype for cairo_image_surface_create_for_data.
This commit is contained in:
parent
8f7ea593ba
commit
8f6fc777d1
3 changed files with 26 additions and 4 deletions
|
|
@ -1,3 +1,12 @@
|
|||
2005-04-12 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* src/cairo-gstate.c (_cairo_gstate_show_surface): Offset the src
|
||||
pattern by (0,0)->CTM. This fixes test/translate-show-surface.
|
||||
|
||||
* src/cairo-glitz-surface.c
|
||||
(_cairo_glitz_surface_composite_trapezoids): Use unsigned cahr* to
|
||||
match new prototype for cairo_image_surface_create_for_data.
|
||||
|
||||
2005-04-11 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* test/.cvsignore:
|
||||
|
|
|
|||
|
|
@ -1111,7 +1111,7 @@ _cairo_glitz_surface_composite_trapezoids (cairo_operator_t op,
|
|||
else
|
||||
{
|
||||
cairo_image_surface_t *image;
|
||||
char *ptr;
|
||||
unsigned char *ptr;
|
||||
int stride;
|
||||
|
||||
stride = (width + 3) & -4;
|
||||
|
|
@ -1125,7 +1125,7 @@ _cairo_glitz_surface_composite_trapezoids (cairo_operator_t op,
|
|||
memset (data, 0, stride * height);
|
||||
|
||||
/* using negative stride */
|
||||
ptr = (char *) data + stride * (height - 1);
|
||||
ptr = (unsigned char *) data + stride * (height - 1);
|
||||
|
||||
image = (cairo_image_surface_t *)
|
||||
cairo_image_surface_create_for_data (ptr,
|
||||
|
|
|
|||
|
|
@ -2016,6 +2016,8 @@ _cairo_gstate_show_surface (cairo_gstate_t *gstate,
|
|||
cairo_surface_pattern_t pattern;
|
||||
cairo_box_t pattern_extents;
|
||||
cairo_rectangle_t extents;
|
||||
double origin_x, origin_y;
|
||||
int src_x, src_y;
|
||||
|
||||
cairo_surface_get_matrix (surface, &image_to_user);
|
||||
cairo_matrix_invert (&image_to_user);
|
||||
|
|
@ -2058,6 +2060,17 @@ _cairo_gstate_show_surface (cairo_gstate_t *gstate,
|
|||
pattern_extents.p2.y = _cairo_fixed_from_double (backend_y + backend_height);
|
||||
_cairo_box_round_to_rectangle (&pattern_extents, &extents);
|
||||
|
||||
/* XXX: This offset here isn't very clean, and it isn't even doing
|
||||
* a perfect job, (there are some rounding issues with
|
||||
* cairo_show_surface under the influence of cairo_scale). But it
|
||||
* does address the bug demonstrated in test/translate-show-surface.
|
||||
* And, this whole cairo_show_surface thing is going to be
|
||||
* disappearing soon anyway. */
|
||||
origin_x = origin_y = 0.0;
|
||||
_cairo_gstate_user_to_device (gstate, &origin_x, &origin_y);
|
||||
src_x = (int) (origin_x + 0.5);
|
||||
src_y = (int) (origin_y + 0.5);
|
||||
|
||||
if (gstate->clip.surface)
|
||||
{
|
||||
_cairo_rectangle_intersect (&extents, &gstate->clip.rect);
|
||||
|
|
@ -2073,7 +2086,7 @@ _cairo_gstate_show_surface (cairo_gstate_t *gstate,
|
|||
&pattern.base,
|
||||
&clip_pattern.base,
|
||||
gstate->surface,
|
||||
0, 0,
|
||||
src_x, src_y,
|
||||
0, 0,
|
||||
extents.x, extents.y,
|
||||
extents.width, extents.height);
|
||||
|
|
@ -2094,7 +2107,7 @@ _cairo_gstate_show_surface (cairo_gstate_t *gstate,
|
|||
&pattern.base,
|
||||
NULL,
|
||||
gstate->surface,
|
||||
0, 0,
|
||||
src_x, src_y,
|
||||
0, 0,
|
||||
extents.x, extents.y,
|
||||
extents.width, extents.height);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue