mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 498428. Try to updating cairo again. r=joe
Try the update without a patch suspected of causing the Tsvg regression.
This commit is contained in:
parent
3b6026f4db
commit
f436ac4b7e
@ -77,3 +77,45 @@ cairo_debug_reset_static_data (void)
|
||||
|
||||
CAIRO_MUTEX_FINALIZE ();
|
||||
}
|
||||
|
||||
#if HAVE_VALGRIND
|
||||
#include <memcheck.h>
|
||||
|
||||
void
|
||||
_cairo_debug_check_image_surface_is_defined (const cairo_surface_t *surface)
|
||||
{
|
||||
const cairo_image_surface_t *image = (cairo_image_surface_t *) surface;
|
||||
const uint8_t *bits;
|
||||
int row, width;
|
||||
|
||||
if (surface == NULL)
|
||||
return;
|
||||
|
||||
if (! RUNNING_ON_VALGRIND)
|
||||
return;
|
||||
|
||||
bits = image->data;
|
||||
switch (image->format) {
|
||||
case CAIRO_FORMAT_A1:
|
||||
width = (image->width + 7)/8;
|
||||
break;
|
||||
case CAIRO_FORMAT_A8:
|
||||
width = image->width;
|
||||
break;
|
||||
case CAIRO_FORMAT_RGB24:
|
||||
case CAIRO_FORMAT_ARGB32:
|
||||
width = image->width*4;
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED;
|
||||
return;
|
||||
}
|
||||
|
||||
for (row = 0; row < image->height; row++) {
|
||||
VALGRIND_CHECK_MEM_IS_DEFINED (bits, width);
|
||||
/* and then silence any future valgrind warnings */
|
||||
VALGRIND_MAKE_MEM_DEFINED (bits, width);
|
||||
bits += image->stride;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -486,24 +486,26 @@ _cairo_ft_unscaled_font_create_for_pattern (FcPattern *pattern,
|
||||
FcResult ret;
|
||||
|
||||
ret = FcPatternGetFTFace (pattern, FC_FT_FACE, 0, &font_face);
|
||||
switch ((int) ret) {
|
||||
case FcResultMatch:
|
||||
if (ret == FcResultMatch)
|
||||
goto DONE;
|
||||
if (ret == FcResultOutOfMemory)
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
|
||||
ret = FcPatternGetString (pattern, FC_FILE, 0, (FcChar8 **) &filename);
|
||||
if (ret == FcResultOutOfMemory)
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
if (ret == FcResultMatch) {
|
||||
/* If FC_INDEX is not set, we just use 0 */
|
||||
ret = FcPatternGetInteger (pattern, FC_INDEX, 0, &id);
|
||||
if (ret == FcResultOutOfMemory)
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
|
||||
goto DONE;
|
||||
case FcResultOutOfMemory:
|
||||
break;
|
||||
default:
|
||||
if (FcPatternGetString (pattern, FC_FILE, 0,
|
||||
(FcChar8 **) &filename) == FcResultMatch)
|
||||
{
|
||||
/* If FC_INDEX is not set, we just use 0 */
|
||||
if (FcPatternGetInteger (pattern,
|
||||
FC_INDEX, 0, &id) != FcResultOutOfMemory)
|
||||
goto DONE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
/* The pattern contains neither a face nor a filename, resolve it later. */
|
||||
*out = NULL;
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
||||
DONE:
|
||||
return _cairo_ft_unscaled_font_create_internal (font_face != NULL,
|
||||
@ -1000,6 +1002,8 @@ _get_bitmap_surface (FT_Bitmap *bitmap,
|
||||
|
||||
_cairo_image_surface_assume_ownership_of_data ((*surface));
|
||||
|
||||
_cairo_debug_check_image_surface_is_defined (&(*surface)->base);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -569,7 +569,7 @@ cairo_image_surface_get_format (cairo_surface_t *surface)
|
||||
|
||||
if (! _cairo_surface_is_image (surface)) {
|
||||
_cairo_error_throw (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
|
||||
return 0;
|
||||
return CAIRO_FORMAT_INVALID;
|
||||
}
|
||||
|
||||
return image_surface->format;
|
||||
@ -1586,15 +1586,18 @@ _cairo_image_analyze_transparency (cairo_image_surface_t *image)
|
||||
if (image->transparency != CAIRO_IMAGE_UNKNOWN)
|
||||
return image->transparency;
|
||||
|
||||
if (image->format == CAIRO_FORMAT_RGB24) {
|
||||
image->transparency = CAIRO_IMAGE_IS_OPAQUE;
|
||||
return CAIRO_IMAGE_IS_OPAQUE;
|
||||
if ((image->base.content & CAIRO_CONTENT_ALPHA) == 0)
|
||||
return image->transparency = CAIRO_IMAGE_IS_OPAQUE;
|
||||
|
||||
if ((image->base.content & CAIRO_CONTENT_COLOR) == 0) {
|
||||
if (image->format == CAIRO_FORMAT_A1)
|
||||
return image->transparency = CAIRO_IMAGE_HAS_BILEVEL_ALPHA;
|
||||
else
|
||||
return image->transparency = CAIRO_IMAGE_HAS_ALPHA;
|
||||
}
|
||||
|
||||
if (image->format != CAIRO_FORMAT_ARGB32) {
|
||||
image->transparency = CAIRO_IMAGE_HAS_ALPHA;
|
||||
return CAIRO_IMAGE_HAS_ALPHA;
|
||||
}
|
||||
if (image->format != CAIRO_FORMAT_ARGB32)
|
||||
return image->transparency = CAIRO_IMAGE_HAS_ALPHA;
|
||||
|
||||
image->transparency = CAIRO_IMAGE_IS_OPAQUE;
|
||||
for (y = 0; y < image->height; y++) {
|
||||
@ -1603,8 +1606,7 @@ _cairo_image_analyze_transparency (cairo_image_surface_t *image)
|
||||
for (x = 0; x < image->width; x++, pixel++) {
|
||||
int a = (*pixel & 0xff000000) >> 24;
|
||||
if (a > 0 && a < 255) {
|
||||
image->transparency = CAIRO_IMAGE_HAS_ALPHA;
|
||||
return CAIRO_IMAGE_HAS_ALPHA;
|
||||
return image->transparency = CAIRO_IMAGE_HAS_ALPHA;
|
||||
} else if (a == 0) {
|
||||
image->transparency = CAIRO_IMAGE_HAS_BILEVEL_ALPHA;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
#if HAVE_MEMFAULT
|
||||
#include <memfault.h>
|
||||
#define CAIRO_INJECT_FAULT() VALGRIND_INJECT_FAULT()
|
||||
#define CAIRO_INJECT_FAULT() MEMFAULT_INJECT_FAULT()
|
||||
#else
|
||||
#define CAIRO_INJECT_FAULT() 0
|
||||
#endif
|
||||
|
@ -123,6 +123,8 @@ cairo_status_to_string (cairo_status_t status)
|
||||
return "invalid value for an input #cairo_font_weight_t";
|
||||
case CAIRO_STATUS_INVALID_SIZE:
|
||||
return "invalid value for the size of the input (surface, pattern, etc.)";
|
||||
case CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED:
|
||||
return "user-font method not implemented";
|
||||
default:
|
||||
case CAIRO_STATUS_LAST_STATUS:
|
||||
return "<unknown error status>";
|
||||
|
@ -35,6 +35,7 @@
|
||||
* Carl D. Worth <cworth@cworth.org>
|
||||
*/
|
||||
|
||||
#define _BSD_SOURCE /* for hypot() */
|
||||
#include "cairoint.h"
|
||||
#include "cairo-path-fixed-private.h"
|
||||
|
||||
|
@ -1449,6 +1449,8 @@ _cairo_pattern_acquire_surface_for_gradient (const cairo_gradient_pattern_t *pat
|
||||
|
||||
pixman_image_unref (pixman_image);
|
||||
|
||||
_cairo_debug_check_image_surface_is_defined (&image->base);
|
||||
|
||||
status = _cairo_surface_clone_similar (dst, &image->base,
|
||||
0, 0, width, height,
|
||||
&clone_offset_x,
|
||||
|
@ -143,6 +143,7 @@ write_png (cairo_surface_t *surface,
|
||||
int i;
|
||||
cairo_status_t status;
|
||||
cairo_image_surface_t *image;
|
||||
cairo_image_surface_t * volatile clone;
|
||||
void *image_extra;
|
||||
png_struct *png;
|
||||
png_info *info;
|
||||
@ -166,40 +167,52 @@ write_png (cairo_surface_t *surface,
|
||||
goto BAIL1;
|
||||
}
|
||||
|
||||
rows = _cairo_malloc_ab (image->height, sizeof (png_byte*));
|
||||
/* Handle the various fallback formats (e.g. low bit-depth XServers)
|
||||
* by coercing them to a simpler format using pixman.
|
||||
*/
|
||||
if (image->format == CAIRO_FORMAT_INVALID) {
|
||||
clone = _cairo_image_surface_coerce (image,
|
||||
_cairo_format_from_content (image->base.content));
|
||||
status = clone->base.status;
|
||||
if (unlikely (status))
|
||||
goto BAIL1;
|
||||
} else
|
||||
clone = image;
|
||||
|
||||
rows = _cairo_malloc_ab (clone->height, sizeof (png_byte*));
|
||||
if (unlikely (rows == NULL)) {
|
||||
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
goto BAIL1;
|
||||
goto BAIL2;
|
||||
}
|
||||
|
||||
for (i = 0; i < image->height; i++)
|
||||
rows[i] = (png_byte *) image->data + i * image->stride;
|
||||
for (i = 0; i < clone->height; i++)
|
||||
rows[i] = (png_byte *) clone->data + i * clone->stride;
|
||||
|
||||
png = png_create_write_struct (PNG_LIBPNG_VER_STRING, &status,
|
||||
png_simple_error_callback,
|
||||
png_simple_warning_callback);
|
||||
if (unlikely (png == NULL)) {
|
||||
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
goto BAIL2;
|
||||
goto BAIL3;
|
||||
}
|
||||
|
||||
info = png_create_info_struct (png);
|
||||
if (unlikely (info == NULL)) {
|
||||
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
goto BAIL3;
|
||||
goto BAIL4;
|
||||
}
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
if (setjmp (png_jmpbuf (png)))
|
||||
goto BAIL3;
|
||||
goto BAIL4;
|
||||
#endif
|
||||
|
||||
png_set_write_fn (png, closure, write_func, png_simple_output_flush_fn);
|
||||
|
||||
switch (image->format) {
|
||||
switch (clone->format) {
|
||||
case CAIRO_FORMAT_ARGB32:
|
||||
depth = 8;
|
||||
if (_cairo_image_analyze_transparency (image) == CAIRO_IMAGE_IS_OPAQUE)
|
||||
if (_cairo_image_analyze_transparency (clone) == CAIRO_IMAGE_IS_OPAQUE)
|
||||
png_color_type = PNG_COLOR_TYPE_RGB;
|
||||
else
|
||||
png_color_type = PNG_COLOR_TYPE_RGB_ALPHA;
|
||||
@ -221,12 +234,12 @@ write_png (cairo_surface_t *surface,
|
||||
break;
|
||||
default:
|
||||
status = _cairo_error (CAIRO_STATUS_INVALID_FORMAT);
|
||||
goto BAIL3;
|
||||
goto BAIL4;
|
||||
}
|
||||
|
||||
png_set_IHDR (png, info,
|
||||
image->width,
|
||||
image->height, depth,
|
||||
clone->width,
|
||||
clone->height, depth,
|
||||
png_color_type,
|
||||
PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_DEFAULT,
|
||||
@ -259,10 +272,13 @@ write_png (cairo_surface_t *surface,
|
||||
png_write_image (png, rows);
|
||||
png_write_end (png, info);
|
||||
|
||||
BAIL3:
|
||||
BAIL4:
|
||||
png_destroy_write_struct (&png, &info);
|
||||
BAIL2:
|
||||
BAIL3:
|
||||
free (rows);
|
||||
BAIL2:
|
||||
if (clone != image)
|
||||
cairo_surface_destroy (&clone->base);
|
||||
BAIL1:
|
||||
_cairo_surface_release_source_image (surface, image, image_extra);
|
||||
|
||||
@ -638,6 +654,8 @@ read_png (struct png_read_closure_t *png_closure)
|
||||
_cairo_image_surface_assume_ownership_of_data ((cairo_image_surface_t*)surface);
|
||||
data = NULL;
|
||||
|
||||
_cairo_debug_check_image_surface_is_defined (surface);
|
||||
|
||||
status = _cairo_memory_stream_destroy (png_closure->png_data,
|
||||
&mime_data,
|
||||
&mime_data_length);
|
||||
|
@ -2409,6 +2409,9 @@ _cairo_scaled_glyph_set_surface (cairo_scaled_glyph_t *scaled_glyph,
|
||||
{
|
||||
if (scaled_glyph->surface != NULL)
|
||||
cairo_surface_destroy (&scaled_glyph->surface->base);
|
||||
|
||||
/* sanity check the backend glyph contents */
|
||||
_cairo_debug_check_image_surface_is_defined (&surface->base);
|
||||
scaled_glyph->surface = surface;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,10 @@
|
||||
|
||||
#include "cairo-skiplist-private.h"
|
||||
|
||||
#if HAVE_FFS
|
||||
#include <strings.h> /* ffs() */
|
||||
#endif
|
||||
|
||||
#define ELT_DATA(elt) (void *) ((char*) (elt) - list->data_size)
|
||||
#define NEXT_TO_ELT(next) (skip_elt_t *) ((char *) (next) - offsetof (skip_elt_t, next))
|
||||
|
||||
|
@ -1115,6 +1115,7 @@ _cairo_surface_fallback_snapshot (cairo_surface_t *surface)
|
||||
{
|
||||
cairo_surface_t *snapshot;
|
||||
cairo_status_t status;
|
||||
cairo_format_t format;
|
||||
cairo_surface_pattern_t pattern;
|
||||
cairo_image_surface_t *image;
|
||||
void *image_extra;
|
||||
@ -1124,7 +1125,14 @@ _cairo_surface_fallback_snapshot (cairo_surface_t *surface)
|
||||
if (unlikely (status))
|
||||
return _cairo_surface_create_in_error (status);
|
||||
|
||||
snapshot = cairo_image_surface_create (image->format,
|
||||
format = image->format;
|
||||
if (format == CAIRO_FORMAT_INVALID) {
|
||||
/* Non-standard images formats can be generated when retrieving
|
||||
* images from unusual xservers, for example.
|
||||
*/
|
||||
format = _cairo_format_from_content (image->base.content);
|
||||
}
|
||||
snapshot = cairo_image_surface_create (format,
|
||||
image->width,
|
||||
image->height);
|
||||
if (cairo_surface_status (snapshot)) {
|
||||
|
@ -79,6 +79,7 @@ static DEFINE_NIL_SURFACE(CAIRO_STATUS_TEMP_FILE_ERROR, _cairo_surface_nil_temp_
|
||||
static DEFINE_NIL_SURFACE(CAIRO_STATUS_READ_ERROR, _cairo_surface_nil_read_error);
|
||||
static DEFINE_NIL_SURFACE(CAIRO_STATUS_WRITE_ERROR, _cairo_surface_nil_write_error);
|
||||
static DEFINE_NIL_SURFACE(CAIRO_STATUS_INVALID_STRIDE, _cairo_surface_nil_invalid_stride);
|
||||
static DEFINE_NIL_SURFACE(CAIRO_STATUS_INVALID_SIZE, _cairo_surface_nil_invalid_size);
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_surface_copy_pattern_for_destination (const cairo_pattern_t **pattern,
|
||||
@ -1159,6 +1160,8 @@ _cairo_surface_acquire_source_image (cairo_surface_t *surface,
|
||||
cairo_image_surface_t **image_out,
|
||||
void **image_extra)
|
||||
{
|
||||
cairo_status_t status;
|
||||
|
||||
if (surface->status)
|
||||
return surface->status;
|
||||
|
||||
@ -1167,9 +1170,14 @@ _cairo_surface_acquire_source_image (cairo_surface_t *surface,
|
||||
if (surface->backend->acquire_source_image == NULL)
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
|
||||
return _cairo_surface_set_error (surface,
|
||||
surface->backend->acquire_source_image (surface,
|
||||
image_out, image_extra));
|
||||
status = surface->backend->acquire_source_image (surface,
|
||||
image_out, image_extra);
|
||||
if (unlikely (status))
|
||||
return _cairo_surface_set_error (surface, status);
|
||||
|
||||
_cairo_debug_check_image_surface_is_defined (&(*image_out)->base);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1228,6 +1236,8 @@ _cairo_surface_acquire_dest_image (cairo_surface_t *surface,
|
||||
cairo_rectangle_int_t *image_rect,
|
||||
void **image_extra)
|
||||
{
|
||||
cairo_status_t status;
|
||||
|
||||
if (surface->status)
|
||||
return surface->status;
|
||||
|
||||
@ -1236,12 +1246,17 @@ _cairo_surface_acquire_dest_image (cairo_surface_t *surface,
|
||||
if (surface->backend->acquire_dest_image == NULL)
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
|
||||
return _cairo_surface_set_error (surface,
|
||||
surface->backend->acquire_dest_image (surface,
|
||||
interest_rect,
|
||||
image_out,
|
||||
image_rect,
|
||||
image_extra));
|
||||
status = surface->backend->acquire_dest_image (surface,
|
||||
interest_rect,
|
||||
image_out,
|
||||
image_rect,
|
||||
image_extra);
|
||||
if (unlikely (status))
|
||||
return _cairo_surface_set_error (surface, status);
|
||||
|
||||
_cairo_debug_check_image_surface_is_defined (&(*image_out)->base);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1377,6 +1392,9 @@ _cairo_surface_clone_similar (cairo_surface_t *surface,
|
||||
clone_out);
|
||||
|
||||
if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
|
||||
if (_cairo_surface_is_image (src))
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
|
||||
/* First check to see if we can replay to a similar surface */
|
||||
if (_cairo_surface_is_meta (src)) {
|
||||
cairo_surface_t *similar;
|
||||
@ -1423,7 +1441,7 @@ _cairo_surface_clone_similar (cairo_surface_t *surface,
|
||||
}
|
||||
|
||||
/* If we're still unsupported, hit our fallback path to get a clone */
|
||||
if (status == CAIRO_INT_STATUS_UNSUPPORTED)
|
||||
if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
|
||||
status =
|
||||
_cairo_surface_fallback_clone_similar (surface, src,
|
||||
src_x, src_y,
|
||||
@ -1431,6 +1449,7 @@ _cairo_surface_clone_similar (cairo_surface_t *surface,
|
||||
clone_offset_x,
|
||||
clone_offset_y,
|
||||
clone_out);
|
||||
}
|
||||
|
||||
/* We should never get UNSUPPORTED here, so if we have an error, bail. */
|
||||
if (unlikely (status))
|
||||
@ -3015,6 +3034,8 @@ _cairo_surface_create_in_error (cairo_status_t status)
|
||||
return (cairo_surface_t *) &_cairo_surface_nil_temp_file_error;
|
||||
case CAIRO_STATUS_INVALID_STRIDE:
|
||||
return (cairo_surface_t *) &_cairo_surface_nil_invalid_stride;
|
||||
case CAIRO_STATUS_INVALID_SIZE:
|
||||
return (cairo_surface_t *) &_cairo_surface_nil_invalid_size;
|
||||
case CAIRO_STATUS_SUCCESS:
|
||||
case CAIRO_STATUS_LAST_STATUS:
|
||||
ASSERT_NOT_REACHED;
|
||||
@ -3041,7 +3062,7 @@ _cairo_surface_create_in_error (cairo_status_t status)
|
||||
case CAIRO_STATUS_INVALID_CLUSTERS:
|
||||
case CAIRO_STATUS_INVALID_SLANT:
|
||||
case CAIRO_STATUS_INVALID_WEIGHT:
|
||||
case CAIRO_STATUS_INVALID_SIZE:
|
||||
case CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED:
|
||||
default:
|
||||
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
|
||||
return (cairo_surface_t *) &_cairo_surface_nil;
|
||||
|
@ -118,7 +118,7 @@ _cairo_user_scaled_glyph_init (void *abstract_font,
|
||||
_cairo_scaled_glyph_index(scaled_glyph),
|
||||
cr, &extents);
|
||||
else
|
||||
status = CAIRO_STATUS_USER_FONT_ERROR;
|
||||
status = CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED;
|
||||
|
||||
if (status == CAIRO_STATUS_SUCCESS)
|
||||
status = cairo_status (cr);
|
||||
@ -260,12 +260,16 @@ _cairo_user_ucs4_to_index (void *abstract_font,
|
||||
status = face->scaled_font_methods.unicode_to_glyph (&scaled_font->base,
|
||||
ucs4, &glyph);
|
||||
|
||||
if (status == CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED)
|
||||
goto not_implemented;
|
||||
|
||||
if (status != CAIRO_STATUS_SUCCESS) {
|
||||
status = _cairo_scaled_font_set_error (&scaled_font->base, status);
|
||||
glyph = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
not_implemented:
|
||||
glyph = ucs4;
|
||||
}
|
||||
|
||||
@ -300,10 +304,11 @@ _cairo_user_text_to_glyphs (void *abstract_font,
|
||||
glyphs, num_glyphs,
|
||||
clusters, num_clusters, cluster_flags);
|
||||
|
||||
if (status != CAIRO_STATUS_SUCCESS)
|
||||
if (status != CAIRO_STATUS_SUCCESS &&
|
||||
status != CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED)
|
||||
return status;
|
||||
|
||||
if (*num_glyphs < 0) {
|
||||
if (status == CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED || *num_glyphs < 0) {
|
||||
if (orig_glyphs != *glyphs) {
|
||||
cairo_glyph_free (*glyphs);
|
||||
*glyphs = orig_glyphs;
|
||||
@ -434,6 +439,9 @@ _cairo_user_font_face_scaled_font_create (void *abstract_
|
||||
cr,
|
||||
&font_extents);
|
||||
|
||||
if (status == CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED)
|
||||
status = CAIRO_STATUS_SUCCESS;
|
||||
|
||||
if (status == CAIRO_STATUS_SUCCESS)
|
||||
status = cairo_status (cr);
|
||||
|
||||
|
@ -979,6 +979,19 @@ _cairo_win32_scaled_font_init_glyph_metrics (cairo_win32_scaled_font_t *scaled_f
|
||||
&metrics, 0, NULL, &matrix) == GDI_ERROR) {
|
||||
status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_init_glyph_metrics:GetGlyphOutlineW");
|
||||
memset (&metrics, 0, sizeof (GLYPHMETRICS));
|
||||
} else {
|
||||
if (metrics.gmBlackBoxX > 0 && scaled_font->base.options.antialias != CAIRO_ANTIALIAS_NONE) {
|
||||
/* The bounding box reported by Windows supposedly contains the glyph's "black" area;
|
||||
* however, antialiasing (especially with ClearType) means that the actual image that
|
||||
* needs to be rendered may "bleed" into the adjacent pixels, mainly on the right side.
|
||||
* To avoid clipping the glyphs when drawn by _cairo_surface_fallback_show_glyphs,
|
||||
* for example, or other code that uses glyph extents to determine the area to update,
|
||||
* we add a pixel of "slop" to left side of the nominal "black" area returned by GDI,
|
||||
* and two pixels to the right (as tests show some glyphs bleed into this column).
|
||||
*/
|
||||
metrics.gmptGlyphOrigin.x -= 1;
|
||||
metrics.gmBlackBoxX += 3;
|
||||
}
|
||||
}
|
||||
cairo_win32_scaled_font_done_font (&scaled_font->base);
|
||||
if (status)
|
||||
@ -1543,6 +1556,7 @@ _cairo_win32_scaled_font_index_to_ucs4 (void *abstract_font,
|
||||
goto exit1;
|
||||
}
|
||||
|
||||
*ucs4 = (uint32_t) -1;
|
||||
for (i = 0; i < glyph_set->cRanges; i++) {
|
||||
num_glyphs = glyph_set->ranges[i].cGlyphs;
|
||||
|
||||
|
@ -722,7 +722,7 @@ _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_surface_t *surf
|
||||
_cairo_matrix_to_win32_xform (&m, &xform);
|
||||
|
||||
if (! SetWorldTransform (surface->dc, &xform)) {
|
||||
status = _cairo_win32_print_gdi_error ("_win32_scaled_font_set_world_transform");
|
||||
status = _cairo_win32_print_gdi_error ("_cairo_win32_printing_surface_paint_image_pattern");
|
||||
goto CLEANUP_OPAQUE_IMAGE;
|
||||
}
|
||||
|
||||
@ -1451,6 +1451,7 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac
|
||||
* If we are printing a bitmap font, use fallback images to
|
||||
* ensure the font is not substituted.
|
||||
*/
|
||||
#if CAIRO_HAS_WIN32_FONT
|
||||
if (cairo_scaled_font_get_type (scaled_font) == CAIRO_FONT_TYPE_WIN32) {
|
||||
if (_cairo_win32_scaled_font_is_bitmap (scaled_font))
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
@ -1472,6 +1473,7 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac
|
||||
if (status)
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
||||
return _cairo_win32_printing_surface_analyze_operation (surface, op, source);
|
||||
}
|
||||
@ -1490,6 +1492,7 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac
|
||||
source = opaque;
|
||||
}
|
||||
|
||||
#if CAIRO_HAS_WIN32_FONT
|
||||
if (cairo_scaled_font_get_type (scaled_font) == CAIRO_FONT_TYPE_WIN32 &&
|
||||
source->type == CAIRO_PATTERN_TYPE_SOLID)
|
||||
{
|
||||
@ -1554,6 +1557,7 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac
|
||||
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
||||
SaveDC (surface->dc);
|
||||
old_ctm = surface->ctm;
|
||||
|
@ -208,7 +208,7 @@ _cairo_xlib_surface_create_similar (void *abstract_src,
|
||||
Pixmap pix;
|
||||
|
||||
if (width > XLIB_COORD_MAX || height > XLIB_COORD_MAX)
|
||||
return _cairo_surface_create_in_error (_cairo_error(CAIRO_STATUS_INVALID_SIZE));
|
||||
return NULL;
|
||||
|
||||
_cairo_xlib_display_notify (src->display);
|
||||
|
||||
@ -952,7 +952,8 @@ _draw_image_surface (cairo_xlib_surface_t *surface,
|
||||
ximage.blue_mask = surface->b_mask;
|
||||
ximage.xoffset = 0;
|
||||
|
||||
if (image_masks.red_mask == surface->r_mask &&
|
||||
if (image_masks.alpha_mask == surface->a_mask &&
|
||||
image_masks.red_mask == surface->r_mask &&
|
||||
image_masks.green_mask == surface->g_mask &&
|
||||
image_masks.blue_mask == surface->b_mask)
|
||||
{
|
||||
@ -1018,8 +1019,8 @@ _draw_image_surface (cairo_xlib_surface_t *surface,
|
||||
goto BAIL;
|
||||
}
|
||||
|
||||
rowstride = cairo_image_surface_get_stride (&image->base) >> 2;
|
||||
row = (uint32_t *) cairo_image_surface_get_data (&image->base);
|
||||
rowstride = image->stride >> 2;
|
||||
row = (uint32_t *) image->data;
|
||||
x0 = dst_x + surface->base.device_transform.x0;
|
||||
y0 = dst_y + surface->base.device_transform.y0;
|
||||
for (y = 0, y_off = y0 % ARRAY_LENGTH (dither_pattern);
|
||||
@ -1196,16 +1197,17 @@ _cairo_xlib_surface_clone_similar (void *abstract_surface,
|
||||
}
|
||||
} else if (_cairo_surface_is_image (src)) {
|
||||
cairo_image_surface_t *image_src = (cairo_image_surface_t *)src;
|
||||
|
||||
if (! CAIRO_FORMAT_VALID (image_src->format))
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
cairo_format_t format;
|
||||
|
||||
if (width > XLIB_COORD_MAX || height > XLIB_COORD_MAX)
|
||||
return _cairo_error (CAIRO_STATUS_INVALID_SIZE);
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
|
||||
format = image_src->format;
|
||||
if (format == CAIRO_FORMAT_INVALID)
|
||||
format = _cairo_format_from_content (image_src->base.content);
|
||||
clone = (cairo_xlib_surface_t *)
|
||||
_cairo_xlib_surface_create_similar_with_format (surface,
|
||||
image_src->format,
|
||||
format,
|
||||
width, height);
|
||||
if (clone == NULL)
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
|
@ -208,7 +208,6 @@ typedef struct _cairo_user_data_key {
|
||||
/**
|
||||
* cairo_status_t:
|
||||
* @CAIRO_STATUS_SUCCESS: no error has occurred
|
||||
*
|
||||
* @CAIRO_STATUS_NO_MEMORY: out of memory
|
||||
* @CAIRO_STATUS_INVALID_RESTORE: cairo_restore() called without matching cairo_save()
|
||||
* @CAIRO_STATUS_INVALID_POP_GROUP: no saved group to pop
|
||||
@ -241,7 +240,7 @@ typedef struct _cairo_user_data_key {
|
||||
* @CAIRO_STATUS_INVALID_SLANT: invalid value for an input #cairo_font_slant_t (Since 1.8)
|
||||
* @CAIRO_STATUS_INVALID_WEIGHT: invalid value for an input #cairo_font_weight_t (Since 1.8)
|
||||
* @CAIRO_STATUS_INVALID_SIZE: invalid value (typically too big) for a size (Since 1.10)
|
||||
*
|
||||
* @CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED: user-font method not implemented (Since 1.10)
|
||||
* @CAIRO_STATUS_LAST_STATUS: this is a special value indicating the number of
|
||||
* status values defined in this enumeration. When using this value, note
|
||||
* that the version of cairo at run-time may have additional status values
|
||||
@ -290,6 +289,7 @@ typedef enum _cairo_status {
|
||||
CAIRO_STATUS_INVALID_SLANT,
|
||||
CAIRO_STATUS_INVALID_WEIGHT,
|
||||
CAIRO_STATUS_INVALID_SIZE,
|
||||
CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED,
|
||||
|
||||
CAIRO_STATUS_LAST_STATUS
|
||||
} cairo_status_t;
|
||||
@ -1455,8 +1455,7 @@ cairo_user_font_face_create (void);
|
||||
* point and trying to use it for text operations in the callback will result
|
||||
* in deadlock.
|
||||
*
|
||||
* Returns: %CAIRO_STATUS_SUCCESS upon success, or
|
||||
* %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error.
|
||||
* Returns: %CAIRO_STATUS_SUCCESS upon success, or an error status on error.
|
||||
*
|
||||
* Since: 1.8
|
||||
**/
|
||||
@ -1557,7 +1556,8 @@ typedef cairo_status_t (*cairo_user_scaled_font_render_glyph_func_t) (cairo_scal
|
||||
* will free the allocated cluster array using cairo_text_cluster_free().
|
||||
*
|
||||
* The callback is optional. If @num_glyphs is negative upon
|
||||
* the callback returning, the unicode_to_glyph callback
|
||||
* the callback returning or if the return value
|
||||
* is %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED, the unicode_to_glyph callback
|
||||
* is tried. See #cairo_user_scaled_font_unicode_to_glyph_func_t.
|
||||
*
|
||||
* Note: While cairo does not impose any limitation on glyph indices,
|
||||
@ -1568,8 +1568,9 @@ typedef cairo_status_t (*cairo_user_scaled_font_render_glyph_func_t) (cairo_scal
|
||||
* are advised to use glyph 0 for such purposes and do not use that
|
||||
* glyph value for other purposes.
|
||||
*
|
||||
* Returns: %CAIRO_STATUS_SUCCESS upon success, or
|
||||
* %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error.
|
||||
* Returns: %CAIRO_STATUS_SUCCESS upon success,
|
||||
* %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED if fallback options should be tried,
|
||||
* or %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error.
|
||||
*
|
||||
* Since: 1.8
|
||||
**/
|
||||
@ -1602,8 +1603,9 @@ typedef cairo_status_t (*cairo_user_scaled_font_text_to_glyphs_func_t) (cairo_sc
|
||||
* complex scripts can be implemented using this callback.
|
||||
*
|
||||
* The callback is optional, and only used if text_to_glyphs callback is not
|
||||
* set or fails to return glyphs. If this callback is not set, an identity
|
||||
* mapping from Unicode code-points to glyph indices is assumed.
|
||||
* set or fails to return glyphs. If this callback is not set or if it returns
|
||||
* %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED, an identity mapping from Unicode
|
||||
* code-points to glyph indices is assumed.
|
||||
*
|
||||
* Note: While cairo does not impose any limitation on glyph indices,
|
||||
* some applications may assume that a glyph index fits in a 16-bit
|
||||
@ -1613,8 +1615,9 @@ typedef cairo_status_t (*cairo_user_scaled_font_text_to_glyphs_func_t) (cairo_sc
|
||||
* are advised to use glyph 0 for such purposes and do not use that
|
||||
* glyph value for other purposes.
|
||||
*
|
||||
* Returns: %CAIRO_STATUS_SUCCESS upon success, or
|
||||
* %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error.
|
||||
* Returns: %CAIRO_STATUS_SUCCESS upon success,
|
||||
* %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED if fallback options should be tried,
|
||||
* or %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error.
|
||||
*
|
||||
* Since: 1.8
|
||||
**/
|
||||
|
@ -85,7 +85,7 @@
|
||||
|
||||
CAIRO_BEGIN_DECLS
|
||||
|
||||
#if _WIN32 && !_WIN32_WCE // we don't have to worry about permissions on WinCE
|
||||
#if _WIN32 && !_WIN32_WCE /* Permissions on WinCE? No worries! */
|
||||
cairo_private FILE *
|
||||
_cairo_win32_tmpfile (void);
|
||||
#define tmpfile() _cairo_win32_tmpfile()
|
||||
@ -134,7 +134,7 @@ _cairo_win32_tmpfile (void);
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define cairo_container_of(ptr, type, member) ({ \
|
||||
const typeof(((type *) 0)->member) *mptr__ = (ptr); \
|
||||
const __typeof__ (((type *) 0)->member) *mptr__ = (ptr); \
|
||||
(type *) ((char *) mptr__ - offsetof (type, member)); \
|
||||
})
|
||||
#else
|
||||
@ -158,7 +158,7 @@ do { \
|
||||
assert (NOT_REACHED); \
|
||||
} while (0)
|
||||
#define COMPILE_TIME_ASSERT1(condition, line) \
|
||||
typedef int compile_time_assertion_at_line_##line##_failed [(condition)?1:-1];
|
||||
typedef int compile_time_assertion_at_line_##line##_failed [(condition)?1:-1]
|
||||
#define COMPILE_TIME_ASSERT0(condition, line) COMPILE_TIME_ASSERT1(condition, line)
|
||||
#define COMPILE_TIME_ASSERT(condition) COMPILE_TIME_ASSERT0(condition, __LINE__)
|
||||
|
||||
@ -497,7 +497,8 @@ struct _cairo_scaled_font_backend {
|
||||
unsigned char *buffer,
|
||||
unsigned long *length);
|
||||
|
||||
/* returns -1 if the unicode character could not be found for the glyph */
|
||||
/* ucs4 is set to -1 if the unicode character could not be found
|
||||
* for the glyph */
|
||||
cairo_warn cairo_int_status_t
|
||||
(*index_to_ucs4)(void *scaled_font,
|
||||
unsigned long index,
|
||||
@ -2753,4 +2754,15 @@ CAIRO_END_DECLS
|
||||
#include "cairo-malloc-private.h"
|
||||
#include "cairo-hash-private.h"
|
||||
|
||||
#if HAVE_VALGRIND
|
||||
|
||||
cairo_private void
|
||||
_cairo_debug_check_image_surface_is_defined (const cairo_surface_t *surface);
|
||||
|
||||
#else
|
||||
|
||||
#define _cairo_debug_check_image_surface_is_defined(X)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user