Fixes from David Reveman:

Don't save to surface part of the union when the pattern isn't a surface pattern. (_cairo_pattern_get_surface): Create the new surface at the width and height of the source.
Add cairo-ft-private.h
This commit is contained in:
Owen Taylor 2005-01-30 11:28:14 +00:00
parent a24f2f909e
commit dca785faaf
4 changed files with 71 additions and 63 deletions

View file

@ -1,3 +1,15 @@
2005-01-30 Owen Taylor <otaylor@redhat.com>
Fixes from David Reveman:
* src/cairo_pattern.c (_cairo_pattern_save/restore_surface): Don't
save to surface part of the union when the pattern isn't a surface
pattern.
(_cairo_pattern_get_surface): Create the new surface at the width
and height of the source.
* src/Makefile.am (libcairo_ft_sources): Add cairo-ft-private.h
2005-01-28 Kristian Høgsberg <krh@redhat.com>
* src/cairo_png_surface.c (_cairo_png_surface_composite): Update

View file

@ -41,7 +41,7 @@ endif
if CAIRO_HAS_FT_FONT
libcairo_ft_headers = cairo-ft.h
libcairo_ft_sources = cairo_ft_font.c
libcairo_ft_sources = cairo_ft_font.c cairo-ft-private.h
endif
# These names match automake style variable definition conventions so

View file

@ -332,44 +332,42 @@ void
_cairo_pattern_prepare_surface (cairo_pattern_t *pattern,
cairo_surface_t *surface)
{
cairo_matrix_t device_to_source;
cairo_matrix_t user_to_source;
/* should the surface matrix interface be remove from the API?
for now we multiple the surface matrix with the pattern matrix */
if (pattern->type == CAIRO_PATTERN_SURFACE) {
cairo_surface_get_matrix (pattern->u.surface.surface, &user_to_source);
cairo_matrix_multiply (&device_to_source, &pattern->matrix,
&user_to_source);
cairo_surface_set_matrix (surface, &device_to_source);
if (pattern->type == CAIRO_PATTERN_SURFACE)
{
/* storing original surface matrix in pattern */
cairo_surface_get_matrix (pattern->u.surface.surface,
&pattern->u.surface.save_matrix);
/* set pattern matrix */
cairo_surface_set_matrix (surface, &pattern->matrix);
/* storing original surface repeat mode in pattern */
pattern->u.surface.save_repeat = surface->repeat;
/* what do we do with extend types pad and reflect? */
if (pattern->extend == CAIRO_EXTEND_REPEAT || surface->repeat == 1)
cairo_surface_set_repeat (surface, 1);
else
cairo_surface_set_repeat (surface, 0);
/* storing original surface filter in pattern */
pattern->u.surface.save_filter = cairo_surface_get_filter (surface);
cairo_surface_set_filter (surface, pattern->filter);
}
/* storing original surface matrix in pattern */
pattern->u.surface.save_matrix = user_to_source;
/* storing original surface repeat mode in pattern */
pattern->u.surface.save_repeat = surface->repeat;
/* what do we do with extend types pad and reflect? */
if (pattern->extend == CAIRO_EXTEND_REPEAT || surface->repeat == 1)
cairo_surface_set_repeat (surface, 1);
else
cairo_surface_set_repeat (surface, 0);
/* storing original surface filter in pattern */
pattern->u.surface.save_filter = cairo_surface_get_filter (surface);
cairo_surface_set_filter (surface, pattern->filter);
}
void
_cairo_pattern_restore_surface (cairo_pattern_t *pattern,
cairo_surface_t *surface)
{
cairo_surface_set_matrix (surface, &pattern->u.surface.save_matrix);
cairo_surface_set_repeat (surface, pattern->u.surface.save_repeat);
cairo_surface_set_filter (surface, pattern->u.surface.save_filter);
if (pattern->type == CAIRO_PATTERN_SURFACE)
{
cairo_surface_set_matrix (surface, &pattern->u.surface.save_matrix);
cairo_surface_set_repeat (surface, pattern->u.surface.save_repeat);
cairo_surface_set_filter (surface, pattern->u.surface.save_filter);
}
}
#define INTERPOLATE_COLOR_NEAREST(c1, c2, factor) \
@ -816,7 +814,7 @@ _cairo_pattern_get_surface (cairo_pattern_t *pattern,
surface = cairo_surface_create_similar (dst,
CAIRO_FORMAT_ARGB32,
width, height);
image->width, image->height);
if (surface == NULL)
return NULL;

View file

@ -332,44 +332,42 @@ void
_cairo_pattern_prepare_surface (cairo_pattern_t *pattern,
cairo_surface_t *surface)
{
cairo_matrix_t device_to_source;
cairo_matrix_t user_to_source;
/* should the surface matrix interface be remove from the API?
for now we multiple the surface matrix with the pattern matrix */
if (pattern->type == CAIRO_PATTERN_SURFACE) {
cairo_surface_get_matrix (pattern->u.surface.surface, &user_to_source);
cairo_matrix_multiply (&device_to_source, &pattern->matrix,
&user_to_source);
cairo_surface_set_matrix (surface, &device_to_source);
if (pattern->type == CAIRO_PATTERN_SURFACE)
{
/* storing original surface matrix in pattern */
cairo_surface_get_matrix (pattern->u.surface.surface,
&pattern->u.surface.save_matrix);
/* set pattern matrix */
cairo_surface_set_matrix (surface, &pattern->matrix);
/* storing original surface repeat mode in pattern */
pattern->u.surface.save_repeat = surface->repeat;
/* what do we do with extend types pad and reflect? */
if (pattern->extend == CAIRO_EXTEND_REPEAT || surface->repeat == 1)
cairo_surface_set_repeat (surface, 1);
else
cairo_surface_set_repeat (surface, 0);
/* storing original surface filter in pattern */
pattern->u.surface.save_filter = cairo_surface_get_filter (surface);
cairo_surface_set_filter (surface, pattern->filter);
}
/* storing original surface matrix in pattern */
pattern->u.surface.save_matrix = user_to_source;
/* storing original surface repeat mode in pattern */
pattern->u.surface.save_repeat = surface->repeat;
/* what do we do with extend types pad and reflect? */
if (pattern->extend == CAIRO_EXTEND_REPEAT || surface->repeat == 1)
cairo_surface_set_repeat (surface, 1);
else
cairo_surface_set_repeat (surface, 0);
/* storing original surface filter in pattern */
pattern->u.surface.save_filter = cairo_surface_get_filter (surface);
cairo_surface_set_filter (surface, pattern->filter);
}
void
_cairo_pattern_restore_surface (cairo_pattern_t *pattern,
cairo_surface_t *surface)
{
cairo_surface_set_matrix (surface, &pattern->u.surface.save_matrix);
cairo_surface_set_repeat (surface, pattern->u.surface.save_repeat);
cairo_surface_set_filter (surface, pattern->u.surface.save_filter);
if (pattern->type == CAIRO_PATTERN_SURFACE)
{
cairo_surface_set_matrix (surface, &pattern->u.surface.save_matrix);
cairo_surface_set_repeat (surface, pattern->u.surface.save_repeat);
cairo_surface_set_filter (surface, pattern->u.surface.save_filter);
}
}
#define INTERPOLATE_COLOR_NEAREST(c1, c2, factor) \
@ -816,7 +814,7 @@ _cairo_pattern_get_surface (cairo_pattern_t *pattern,
surface = cairo_surface_create_similar (dst,
CAIRO_FORMAT_ARGB32,
width, height);
image->width, image->height);
if (surface == NULL)
return NULL;