Merge branch 'surface-font-options' into cairo
|
|
@ -163,6 +163,25 @@ _cairo_paginated_surface_finish (void *abstract_surface)
|
|||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_paginated_surface_create_image_surface (void *abstract_surface,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
cairo_paginated_surface_t *surface = abstract_surface;
|
||||
cairo_surface_t *image;
|
||||
cairo_font_options_t options;
|
||||
|
||||
image = _cairo_image_surface_create_with_content (surface->content,
|
||||
width,
|
||||
height);
|
||||
|
||||
cairo_surface_get_font_options (surface, &options);
|
||||
_cairo_surface_set_font_options (image, &options);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_paginated_surface_acquire_source_image (void *abstract_surface,
|
||||
cairo_image_surface_t **image_out,
|
||||
|
|
@ -174,9 +193,9 @@ _cairo_paginated_surface_acquire_source_image (void *abstract_surface,
|
|||
|
||||
_cairo_surface_get_extents (surface->target, &extents);
|
||||
|
||||
image = _cairo_image_surface_create_with_content (surface->content,
|
||||
extents.width,
|
||||
extents.height);
|
||||
image = _cairo_paginated_surface_create_image_surface (surface,
|
||||
extents.width,
|
||||
extents.height);
|
||||
|
||||
_cairo_meta_surface_replay (surface->meta, image);
|
||||
|
||||
|
|
@ -221,9 +240,9 @@ _paint_page (cairo_paginated_surface_t *surface)
|
|||
double y_scale = surface->base.y_fallback_resolution / 72.0;
|
||||
cairo_matrix_t matrix;
|
||||
|
||||
image = _cairo_image_surface_create_with_content (surface->content,
|
||||
surface->width * x_scale,
|
||||
surface->height * y_scale);
|
||||
image = _cairo_paginated_surface_create_image_surface (surface,
|
||||
surface->width * x_scale,
|
||||
surface->height * y_scale);
|
||||
_cairo_surface_set_device_scale (image, x_scale, y_scale);
|
||||
|
||||
_cairo_meta_surface_replay (surface->meta, image);
|
||||
|
|
@ -460,9 +479,9 @@ _cairo_paginated_surface_snapshot (void *abstract_other)
|
|||
|
||||
_cairo_surface_get_extents (other->target, &extents);
|
||||
|
||||
surface = _cairo_image_surface_create_with_content (other->content,
|
||||
extents.width,
|
||||
extents.height);
|
||||
surface = _cairo_paginated_surface_create_image_surface (other,
|
||||
extents.width,
|
||||
extents.height);
|
||||
|
||||
_cairo_meta_surface_replay (other->meta, surface);
|
||||
|
||||
|
|
|
|||
|
|
@ -454,19 +454,6 @@ _cairo_pdf_surface_clear (cairo_pdf_surface_t *surface)
|
|||
_cairo_array_truncate (&surface->streams, 0);
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_pdf_surface_create_similar (void *abstract_src,
|
||||
cairo_content_t content,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
cairo_format_t format = _cairo_format_from_content (content);
|
||||
|
||||
/* Just return an image for now, until PDF surface can be used
|
||||
* as source. */
|
||||
return cairo_image_surface_create (format, width, height);
|
||||
}
|
||||
|
||||
static cairo_pdf_resource_t
|
||||
_cairo_pdf_surface_open_stream (cairo_pdf_surface_t *surface,
|
||||
const char *fmt,
|
||||
|
|
@ -2646,7 +2633,7 @@ _cairo_pdf_surface_set_paginated_mode (void *abstract_surface,
|
|||
|
||||
static const cairo_surface_backend_t cairo_pdf_surface_backend = {
|
||||
CAIRO_SURFACE_TYPE_PDF,
|
||||
_cairo_pdf_surface_create_similar,
|
||||
NULL, /* create_similar */
|
||||
_cairo_pdf_surface_finish,
|
||||
NULL, /* acquire_source_image */
|
||||
NULL, /* release_source_image */
|
||||
|
|
|
|||
|
|
@ -1140,19 +1140,6 @@ cairo_ps_surface_dsc_begin_page_setup (cairo_surface_t *surface)
|
|||
}
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_ps_surface_create_similar (void *abstract_src,
|
||||
cairo_content_t content,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
cairo_format_t format = _cairo_format_from_content (content);
|
||||
|
||||
/* Just return an image for now, until PS surface can be used
|
||||
* as source. */
|
||||
return cairo_image_surface_create (format, width, height);
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_ps_surface_finish (void *abstract_surface)
|
||||
{
|
||||
|
|
@ -2127,7 +2114,7 @@ _cairo_ps_surface_set_paginated_mode (void *abstract_surface,
|
|||
|
||||
static const cairo_surface_backend_t cairo_ps_surface_backend = {
|
||||
CAIRO_SURFACE_TYPE_PS,
|
||||
_cairo_ps_surface_create_similar,
|
||||
NULL, /* create_similar */
|
||||
_cairo_ps_surface_finish,
|
||||
NULL, /* acquire_source_image */
|
||||
NULL, /* release_source_image */
|
||||
|
|
|
|||
|
|
@ -237,6 +237,8 @@ _cairo_surface_init (cairo_surface_t *surface,
|
|||
surface->current_clip_serial = 0;
|
||||
|
||||
surface->is_snapshot = FALSE;
|
||||
|
||||
surface->has_font_options = FALSE;
|
||||
}
|
||||
|
||||
cairo_surface_t *
|
||||
|
|
@ -245,15 +247,28 @@ _cairo_surface_create_similar_scratch (cairo_surface_t *other,
|
|||
int width,
|
||||
int height)
|
||||
{
|
||||
cairo_surface_t *surface = NULL;
|
||||
cairo_font_options_t options;
|
||||
|
||||
cairo_format_t format = _cairo_format_from_content (content);
|
||||
|
||||
if (other->status)
|
||||
return (cairo_surface_t*) &_cairo_surface_nil;
|
||||
|
||||
if (other->backend->create_similar)
|
||||
return other->backend->create_similar (other, content, width, height);
|
||||
else
|
||||
return cairo_image_surface_create (format, width, height);
|
||||
surface = other->backend->create_similar (other, content, width, height);
|
||||
|
||||
if (!surface)
|
||||
surface = cairo_image_surface_create (format, width, height);
|
||||
|
||||
cairo_surface_get_font_options (other, &options);
|
||||
_cairo_surface_set_font_options (surface, &options);
|
||||
|
||||
cairo_surface_set_fallback_resolution (surface,
|
||||
other->x_fallback_resolution,
|
||||
other->y_fallback_resolution);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -264,9 +279,12 @@ _cairo_surface_create_similar_scratch (cairo_surface_t *other,
|
|||
* @height: height of the new surface (in device-space units)
|
||||
*
|
||||
* Create a new surface that is as compatible as possible with an
|
||||
* existing surface. The new surface will use the same backend as
|
||||
* @other unless that is not possible for some reason. The type of the
|
||||
* returned surface may be examined with cairo_surface_get_type().
|
||||
* existing surface. For example the new surface will have the same
|
||||
* fallback resolution and font options as @other. Generally, the new
|
||||
* surface will also use the same backend as @other, unless that is
|
||||
* not possible for some reason. The type of the returned surface may
|
||||
* be examined with cairo_surface_get_type().
|
||||
*
|
||||
* Initially the surface contents are all 0 (transparent if contents
|
||||
* have transparency, black otherwise.)
|
||||
*
|
||||
|
|
@ -505,6 +523,33 @@ cairo_surface_set_user_data (cairo_surface_t *surface,
|
|||
key, user_data, destroy);
|
||||
}
|
||||
|
||||
/**
|
||||
* _cairo_surface_set_font_options:
|
||||
* @surface: a #cairo_surface_t
|
||||
* @options: a #cairo_font_options_t object that contains the
|
||||
* options to use for this surface instead of backend's default
|
||||
* font options.
|
||||
*
|
||||
* Sets the default font rendering options for the surface.
|
||||
* This is useful to correctly propagate default font options when
|
||||
* falling back to an image surface in a backend implementation.
|
||||
* This affects the options returned in cairo_surface_get_font_options().
|
||||
*
|
||||
* If @options is %NULL the surface options are reset to those of
|
||||
* the backend default.
|
||||
**/
|
||||
void
|
||||
_cairo_surface_set_font_options (cairo_surface_t *surface,
|
||||
cairo_font_options_t *options)
|
||||
{
|
||||
if (options) {
|
||||
surface->has_font_options = TRUE;
|
||||
_cairo_font_options_init_copy (&surface->font_options, options);
|
||||
} else {
|
||||
surface->has_font_options = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* cairo_surface_get_font_options:
|
||||
* @surface: a #cairo_surface_t
|
||||
|
|
@ -521,11 +566,17 @@ void
|
|||
cairo_surface_get_font_options (cairo_surface_t *surface,
|
||||
cairo_font_options_t *options)
|
||||
{
|
||||
if (!surface->finished && surface->backend->get_font_options) {
|
||||
surface->backend->get_font_options (surface, options);
|
||||
} else {
|
||||
_cairo_font_options_init_default (options);
|
||||
if (!surface->has_font_options) {
|
||||
surface->has_font_options = TRUE;
|
||||
|
||||
if (!surface->finished && surface->backend->get_font_options) {
|
||||
surface->backend->get_font_options (surface, &surface->font_options);
|
||||
} else {
|
||||
_cairo_font_options_init_default (&surface->font_options);
|
||||
}
|
||||
}
|
||||
|
||||
_cairo_font_options_init_copy (options, &surface->font_options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -221,10 +221,11 @@ _cairo_xlib_surface_create_similar_with_format (void *abstract_src,
|
|||
|
||||
/* As a good first approximation, if the display doesn't have even
|
||||
* the most elementary RENDER operation, then we're better off
|
||||
* using image surfaces for all temporary operations
|
||||
* using image surfaces for all temporary operations, so return NULL
|
||||
* and let the fallback code happen.
|
||||
*/
|
||||
if (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE(src)) {
|
||||
return cairo_image_surface_create (format, width, height);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pix = XCreatePixmap (dpy, RootWindowOfScreen (src->screen),
|
||||
|
|
|
|||
|
|
@ -932,6 +932,14 @@ struct _cairo_surface {
|
|||
|
||||
/* A "snapshot" surface is immutable. See _cairo_surface_snapshot. */
|
||||
cairo_bool_t is_snapshot;
|
||||
|
||||
/*
|
||||
* Surface font options, falling back to backend's default options,
|
||||
* and set using _cairo_surface_set_font_options(), and propagated by
|
||||
* cairo_surface_create_similar().
|
||||
*/
|
||||
cairo_bool_t has_font_options;
|
||||
cairo_font_options_t font_options;
|
||||
};
|
||||
|
||||
struct _cairo_image_surface {
|
||||
|
|
@ -1709,6 +1717,10 @@ _cairo_surface_init (cairo_surface_t *surface,
|
|||
const cairo_surface_backend_t *backend,
|
||||
cairo_content_t content);
|
||||
|
||||
void
|
||||
_cairo_surface_set_font_options (cairo_surface_t *surface,
|
||||
cairo_font_options_t *options);
|
||||
|
||||
cairo_private cairo_clip_mode_t
|
||||
_cairo_surface_get_clip_mode (cairo_surface_t *surface);
|
||||
|
||||
|
|
|
|||
|
|
@ -92,9 +92,12 @@ buffer_diff_core (unsigned char *_buf_a,
|
|||
for (channel = 0; channel < 4; channel++) {
|
||||
unsigned char value_a = (row_a[x] >> (channel*8));
|
||||
unsigned char value_b = (row_b[x] >> (channel*8));
|
||||
double diff;
|
||||
unsigned char diff;
|
||||
diff = value_a - value_b;
|
||||
diff_pixel |= (unsigned char)(128 + diff / 3.0) << (channel*8);
|
||||
diff *= 4; /* emphasize */
|
||||
if (diff > 255)
|
||||
diff = 255;
|
||||
diff_pixel |= diff << (channel*8);
|
||||
}
|
||||
|
||||
pixels_changed++;
|
||||
|
|
@ -226,8 +229,7 @@ image_diff (const char *filename_a,
|
|||
* (should use cairo_image_surface_create_from_png, should save
|
||||
* loaded buffers for re-use).
|
||||
*
|
||||
* 2) Vlad has an outstanding patch against buffer-diff.c and I think
|
||||
* this will be kinder to his merge pain.
|
||||
* 2) There is a second reason no more.
|
||||
*/
|
||||
int
|
||||
image_diff_flattened (const char *filename_a,
|
||||
|
|
@ -242,7 +244,8 @@ image_diff_flattened (const char *filename_a,
|
|||
unsigned int width_a, height_a, stride_a;
|
||||
unsigned int width_b, height_b, stride_b;
|
||||
unsigned char *buf_a, *buf_b, *buf_diff;
|
||||
unsigned char *b_flat;
|
||||
unsigned char *a_flat, *b_flat;
|
||||
cairo_surface_t *buf_a_surface, *a_flat_surface;
|
||||
cairo_surface_t *buf_b_surface, *b_flat_surface;
|
||||
cairo_t *cr;
|
||||
read_png_status_t status;
|
||||
|
|
@ -275,33 +278,50 @@ image_diff_flattened (const char *filename_a,
|
|||
return -1;
|
||||
}
|
||||
|
||||
buf_a_surface = cairo_image_surface_create_for_data (buf_a,
|
||||
CAIRO_FORMAT_ARGB32,
|
||||
width_a + ax, height_a + ay,
|
||||
stride_a);
|
||||
buf_b_surface = cairo_image_surface_create_for_data (buf_b,
|
||||
CAIRO_FORMAT_ARGB32,
|
||||
width_b + bx, height_b + bx,
|
||||
width_b + bx, height_b + by,
|
||||
stride_b);
|
||||
|
||||
buf_diff = xcalloc (stride_a * height_a, 1);
|
||||
|
||||
b_flat = xcalloc (stride_a * height_a, 1);
|
||||
a_flat = xcalloc (stride_a * height_a, 1);
|
||||
b_flat = xcalloc (stride_b * height_b, 1);
|
||||
|
||||
a_flat_surface = cairo_image_surface_create_for_data (a_flat,
|
||||
CAIRO_FORMAT_ARGB32,
|
||||
width_a, height_a,
|
||||
stride_a);
|
||||
cairo_surface_set_device_offset (a_flat_surface, -ax, -ay);
|
||||
b_flat_surface = cairo_image_surface_create_for_data (b_flat,
|
||||
CAIRO_FORMAT_ARGB32,
|
||||
width_b, height_b,
|
||||
stride_b);
|
||||
cairo_surface_set_device_offset (b_flat_surface, -bx, -by);
|
||||
|
||||
cr = cairo_create (b_flat_surface);
|
||||
cr = cairo_create (a_flat_surface);
|
||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||
cairo_paint (cr);
|
||||
cairo_set_source_surface (cr, buf_a_surface, 0, 0);
|
||||
cairo_paint (cr);
|
||||
cairo_destroy (cr);
|
||||
cairo_surface_destroy (a_flat_surface);
|
||||
cairo_surface_destroy (buf_a_surface);
|
||||
|
||||
cr = cairo_create (b_flat_surface);
|
||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||
cairo_paint (cr);
|
||||
cairo_set_source_surface (cr, buf_b_surface, 0, 0);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
cairo_surface_destroy (b_flat_surface);
|
||||
cairo_surface_destroy (buf_b_surface);
|
||||
|
||||
pixels_changed = buffer_diff (buf_a + (ay * stride_a) + ax * 4,
|
||||
pixels_changed = buffer_diff (a_flat,
|
||||
b_flat,
|
||||
buf_diff,
|
||||
width_a, height_a,
|
||||
|
|
@ -317,6 +337,7 @@ image_diff_flattened (const char *filename_a,
|
|||
|
||||
free (buf_a);
|
||||
free (buf_b);
|
||||
free (a_flat);
|
||||
free (b_flat);
|
||||
free (buf_diff);
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,19 @@ typedef enum cairo_internal_surface_type {
|
|||
CAIRO_INTERNAL_SURFACE_TYPE_TEST_PAGINATED
|
||||
} cairo_internal_surface_type_t;
|
||||
|
||||
static const char *vector_ignored_tests[] = {
|
||||
/* We can't match the results of tests that depend on
|
||||
* CAIRO_ANTIALIAS_NONE/SUBPIXEL for vector backends
|
||||
* (nor do we care). */
|
||||
"ft-text-antialias-none",
|
||||
"rectangle-rounding-error",
|
||||
"text-antialias-gray",
|
||||
"text-antialias-none",
|
||||
"text-antialias-subpixel",
|
||||
"unantialiased-shapes",
|
||||
NULL
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define vsnprintf _vsnprintf
|
||||
#define access _access
|
||||
|
|
@ -180,7 +193,7 @@ static void
|
|||
xunlink (const char *pathname)
|
||||
{
|
||||
if (unlink (pathname) < 0 && errno != ENOENT) {
|
||||
cairo_test_log (" Error: Cannot remove %s: %s\n",
|
||||
cairo_test_log ("Error: Cannot remove %s: %s\n",
|
||||
pathname, strerror (errno));
|
||||
exit (1);
|
||||
}
|
||||
|
|
@ -1156,6 +1169,11 @@ create_ps_surface (cairo_test_t *test,
|
|||
int height = test->height;
|
||||
ps_target_closure_t *ptc;
|
||||
cairo_surface_t *surface;
|
||||
int i;
|
||||
|
||||
for (i = 0; vector_ignored_tests[i] != NULL; i++)
|
||||
if (strcmp (test->name, vector_ignored_tests[i]) == 0)
|
||||
return NULL;
|
||||
|
||||
/* Sanitize back to a real cairo_content_t value. */
|
||||
if (content == CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED)
|
||||
|
|
@ -1219,7 +1237,7 @@ ps_surface_write_to_png (cairo_surface_t *surface, const char *filename)
|
|||
}
|
||||
|
||||
cairo_surface_finish (surface);
|
||||
sprintf (command, "gs -q -r72 -g%dx%d -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -sOutputFile=%s %s",
|
||||
sprintf (command, "gs -q -r72 -g%dx%d -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pngalpha -sOutputFile=%s %s",
|
||||
ptc->width, ptc->height, filename, ptc->filename);
|
||||
if (system (command) == 0)
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
|
@ -1240,15 +1258,6 @@ cleanup_ps (void *closure)
|
|||
#if CAIRO_HAS_PDF_SURFACE && CAIRO_CAN_TEST_PDF_SURFACE
|
||||
#include "cairo-pdf.h"
|
||||
|
||||
static const char *pdf_ignored_tests[] = {
|
||||
/* We can't match the results of tests that depend on
|
||||
* CAIRO_ANTIALIAS_NONE, (nor do we care). */
|
||||
"ft-text-antialias-none",
|
||||
"rectangle-rounding-error",
|
||||
"unantialiased-shapes",
|
||||
NULL
|
||||
};
|
||||
|
||||
cairo_user_data_key_t pdf_closure_key;
|
||||
|
||||
typedef struct _pdf_target_closure
|
||||
|
|
@ -1270,8 +1279,8 @@ create_pdf_surface (cairo_test_t *test,
|
|||
cairo_surface_t *surface;
|
||||
int i;
|
||||
|
||||
for (i = 0; pdf_ignored_tests[i] != NULL; i++)
|
||||
if (strcmp (test->name, pdf_ignored_tests[i]) == 0)
|
||||
for (i = 0; vector_ignored_tests[i] != NULL; i++)
|
||||
if (strcmp (test->name, vector_ignored_tests[i]) == 0)
|
||||
return NULL;
|
||||
|
||||
/* Sanitize back to a real cairo_content_t value. */
|
||||
|
|
@ -1359,14 +1368,6 @@ cleanup_pdf (void *closure)
|
|||
#if CAIRO_HAS_SVG_SURFACE && CAIRO_CAN_TEST_SVG_SURFACE
|
||||
#include "cairo-svg.h"
|
||||
|
||||
static const char *svg_ignored_tests[] = {
|
||||
/* rectangle-rounding-error uses CAIRO_ANTIALIAS_NONE,
|
||||
* which is not supported */
|
||||
"ft-text-antialias-none",
|
||||
"rectangle-rounding-error",
|
||||
NULL
|
||||
};
|
||||
|
||||
cairo_user_data_key_t svg_closure_key;
|
||||
|
||||
typedef struct _svg_target_closure
|
||||
|
|
@ -1387,8 +1388,8 @@ create_svg_surface (cairo_test_t *test,
|
|||
svg_target_closure_t *ptc;
|
||||
cairo_surface_t *surface;
|
||||
|
||||
for (i = 0; svg_ignored_tests[i] != NULL; i++)
|
||||
if (strcmp (test->name, svg_ignored_tests[i]) == 0)
|
||||
for (i = 0; vector_ignored_tests[i] != NULL; i++)
|
||||
if (strcmp (test->name, vector_ignored_tests[i]) == 0)
|
||||
return NULL;
|
||||
|
||||
*closure = ptc = xmalloc (sizeof (svg_target_closure_t));
|
||||
|
|
@ -1469,6 +1470,63 @@ cleanup_svg (void *closure)
|
|||
}
|
||||
#endif /* CAIRO_HAS_SVG_SURFACE && CAIRO_CAN_TEST_SVG_SURFACE */
|
||||
|
||||
const char *
|
||||
cairo_ref_name_for_test_target_format (const char *test_name,
|
||||
const char *target_name,
|
||||
const char *format)
|
||||
{
|
||||
char *ref_name = NULL;
|
||||
|
||||
/* First look for a target/format-specific reference image. */
|
||||
xasprintf (&ref_name, "%s/%s-%s-%s%s", srcdir,
|
||||
test_name,
|
||||
target_name,
|
||||
format,
|
||||
CAIRO_TEST_REF_SUFFIX);
|
||||
if (access (ref_name, F_OK) != 0)
|
||||
free (ref_name);
|
||||
else
|
||||
goto done;
|
||||
|
||||
/* Next, look for taget-specifc reference image. */
|
||||
xasprintf (&ref_name, "%s/%s-%s%s", srcdir,
|
||||
test_name,
|
||||
target_name,
|
||||
CAIRO_TEST_REF_SUFFIX);
|
||||
if (access (ref_name, F_OK) != 0)
|
||||
free (ref_name);
|
||||
else
|
||||
goto done;
|
||||
|
||||
/* Next, look for format-specifc reference image. */
|
||||
xasprintf (&ref_name, "%s/%s-%s%s", srcdir,
|
||||
test_name,
|
||||
format,
|
||||
CAIRO_TEST_REF_SUFFIX);
|
||||
if (access (ref_name, F_OK) != 0)
|
||||
free (ref_name);
|
||||
else
|
||||
goto done;
|
||||
|
||||
/* Finally, look for the standard reference image. */
|
||||
xasprintf (&ref_name, "%s/%s%s", srcdir,
|
||||
test_name,
|
||||
CAIRO_TEST_REF_SUFFIX);
|
||||
if (access (ref_name, F_OK) != 0)
|
||||
free (ref_name);
|
||||
else
|
||||
goto done;
|
||||
|
||||
xasprintf (&ref_name, "/dev/null");
|
||||
cairo_test_log ("Error: Cannot find reference image for %s/%s-%s-%s%s\n",srcdir,
|
||||
test_name,
|
||||
target_name,
|
||||
CAIRO_TEST_REF_SUFFIX);
|
||||
|
||||
done:
|
||||
return ref_name;
|
||||
}
|
||||
|
||||
static cairo_test_status_t
|
||||
cairo_test_for_target (cairo_test_t *test,
|
||||
cairo_test_target_t *target,
|
||||
|
|
@ -1478,41 +1536,29 @@ cairo_test_for_target (cairo_test_t *test,
|
|||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
char *png_name, *ref_name, *diff_name, *offset_str;
|
||||
char *format;
|
||||
cairo_test_status_t ret;
|
||||
cairo_content_t expected_content;
|
||||
cairo_font_options_t *font_options;
|
||||
const char *format;
|
||||
|
||||
/* Get the strings ready that we'll need. */
|
||||
format = _cairo_test_content_name (target->content);
|
||||
|
||||
if (dev_offset)
|
||||
xasprintf (&offset_str, "-%d", dev_offset);
|
||||
else
|
||||
offset_str = strdup("");
|
||||
|
||||
xasprintf (&png_name, "%s-%s-%s%s%s", test->name,
|
||||
target->name, format, offset_str, CAIRO_TEST_PNG_SUFFIX);
|
||||
|
||||
/* First look for a target/format-specific reference image. */
|
||||
xasprintf (&ref_name, "%s/%s-%s-%s%s", srcdir, test->name,
|
||||
target->name, format, CAIRO_TEST_REF_SUFFIX);
|
||||
if (access (ref_name, F_OK) != 0) {
|
||||
free (ref_name);
|
||||
|
||||
/* Next, look for format-specifc reference image. */
|
||||
xasprintf (&ref_name, "%s/%s-%s%s", srcdir, test->name,
|
||||
format,CAIRO_TEST_REF_SUFFIX);
|
||||
|
||||
if (access (ref_name, F_OK) != 0) {
|
||||
free (ref_name);
|
||||
|
||||
/* Finally, look for the standard reference image. */
|
||||
xasprintf (&ref_name, "%s/%s%s", srcdir, test->name,
|
||||
CAIRO_TEST_REF_SUFFIX);
|
||||
}
|
||||
}
|
||||
xasprintf (&diff_name, "%s-%s-%s%s%s", test->name,
|
||||
target->name, format, offset_str, CAIRO_TEST_DIFF_SUFFIX);
|
||||
xasprintf (&png_name, "%s-%s-%s%s%s",
|
||||
test->name,
|
||||
target->name,
|
||||
format,
|
||||
offset_str, CAIRO_TEST_PNG_SUFFIX);
|
||||
ref_name = cairo_ref_name_for_test_target_format (test->name, target->name, format);
|
||||
xasprintf (&diff_name, "%s-%s-%s%s%s",
|
||||
test->name,
|
||||
target->name,
|
||||
format,
|
||||
offset_str, CAIRO_TEST_DIFF_SUFFIX);
|
||||
|
||||
/* Run the actual drawing code. */
|
||||
if (test->width && test->height) {
|
||||
|
|
@ -1567,6 +1613,15 @@ cairo_test_for_target (cairo_test_t *test,
|
|||
cairo_paint (cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
/* Set all components of font_options to avoid backend differences
|
||||
* and reduce number of needed reference images. */
|
||||
font_options = cairo_font_options_create ();
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
cairo_font_options_set_hint_metrics (font_options, CAIRO_HINT_METRICS_ON);
|
||||
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
|
||||
cairo_set_font_options (cr, font_options);
|
||||
cairo_font_options_destroy (font_options);
|
||||
|
||||
status = (test->draw) (cr, test->width, test->height);
|
||||
|
||||
/* Then, check all the different ways it could fail. */
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 995 B After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 170 B After Width: | Height: | Size: 240 B |
|
Before Width: | Height: | Size: 280 B After Width: | Height: | Size: 322 B |
|
Before Width: | Height: | Size: 488 B After Width: | Height: | Size: 651 B |
|
|
@ -144,7 +144,6 @@ draw (cairo_t *cr, int width, int height)
|
|||
{
|
||||
int j, x, y;
|
||||
cairo_operator_t op;
|
||||
cairo_font_options_t *font_options;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
|
|
@ -152,14 +151,6 @@ draw (cairo_t *cr, int width, int height)
|
|||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, 0.9 * HEIGHT);
|
||||
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
|
||||
|
||||
cairo_set_font_options (cr, font_options);
|
||||
cairo_font_options_destroy (font_options);
|
||||
|
||||
for (j = 0; j < ARRAY_SIZE (draw_funcs); j++) {
|
||||
for (op = CAIRO_OPERATOR_CLEAR; op < N_OPERATORS; op++) {
|
||||
x = op * (WIDTH + PAD) + PAD;
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 460 B After Width: | Height: | Size: 575 B |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 170 B After Width: | Height: | Size: 204 B |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 272 B After Width: | Height: | Size: 319 B |
|
Before Width: | Height: | Size: 197 B After Width: | Height: | Size: 264 B |
|
Before Width: | Height: | Size: 509 B After Width: | Height: | Size: 509 B |
|
Before Width: | Height: | Size: 509 B |
|
Before Width: | Height: | Size: 243 B After Width: | Height: | Size: 310 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 2.2 KiB |
BIN
test/font-matrix-translation-ps-argb32-ref.png
Normal file
|
After Width: | Height: | Size: 785 B |
BIN
test/font-matrix-translation-svg-ref.png
Normal file
|
After Width: | Height: | Size: 970 B |
|
|
@ -64,7 +64,6 @@ box_text (cairo_t *cr, const char *utf8, double x, double y)
|
|||
static cairo_test_status_t
|
||||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
cairo_font_options_t *font_options;
|
||||
cairo_text_extents_t extents;
|
||||
cairo_matrix_t matrix;
|
||||
|
||||
|
|
@ -76,14 +75,6 @@ draw (cairo_t *cr, int width, int height)
|
|||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
|
||||
|
||||
cairo_set_font_options (cr, font_options);
|
||||
cairo_font_options_destroy (font_options);
|
||||
|
||||
cairo_translate (cr, PAD, PAD);
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ draw (cairo_t *cr, int width, int height)
|
|||
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
cairo_get_font_options (cr, font_options);
|
||||
|
||||
scaled_font = cairo_scaled_font_create (font_face,
|
||||
&font_matrix,
|
||||
&ctm,
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 335 B After Width: | Height: | Size: 335 B |
|
|
@ -55,8 +55,7 @@ create_scaled_font (cairo_t * cr)
|
|||
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
/* disable hinting */
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
cairo_get_font_options (cr, font_options);
|
||||
|
||||
pattern = FcPatternCreate ();
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 725 B After Width: | Height: | Size: 804 B |
|
Before Width: | Height: | Size: 298 B After Width: | Height: | Size: 644 B |
|
Before Width: | Height: | Size: 834 B After Width: | Height: | Size: 907 B |
|
Before Width: | Height: | Size: 799 B |
BIN
test/ft-text-vertical-layout-svg-ref.png
Normal file
|
After Width: | Height: | Size: 880 B |
|
Before Width: | Height: | Size: 808 B |
|
|
@ -55,10 +55,7 @@ create_scaled_font (cairo_t * cr)
|
|||
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
/* disable hinting */
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
/* enable antialias and override screen settings */
|
||||
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
|
||||
cairo_get_font_options (cr, font_options);
|
||||
|
||||
pattern = FcPatternCreate ();
|
||||
|
||||
|
|
@ -102,7 +99,7 @@ draw (cairo_t *cr, int width, int height)
|
|||
{
|
||||
cairo_text_extents_t extents;
|
||||
cairo_scaled_font_t * scaled_font;
|
||||
static char black[] = "AB", blue[] = "cd";
|
||||
static char black[] = "AB", blue[] = "AB";
|
||||
|
||||
/* We draw in the default black, so paint white first. */
|
||||
cairo_save (cr);
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 591 B After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
|
@ -61,8 +61,6 @@ cairo_test_t test = {
|
|||
static cairo_test_status_t
|
||||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
cairo_font_options_t *font_options;
|
||||
|
||||
/* We draw in the default black, so paint white first. */
|
||||
cairo_save (cr);
|
||||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
|
||||
|
|
@ -76,14 +74,6 @@ draw (cairo_t *cr, int width, int height)
|
|||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
|
||||
|
||||
cairo_set_font_options (cr, font_options);
|
||||
cairo_font_options_destroy (font_options);
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 0, 0); /* black */
|
||||
|
||||
cairo_move_to (cr, 1, TEXT_SIZE);
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 355 B |
|
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 244 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 1,000 B After Width: | Height: | Size: 1,000 B |
|
Before Width: | Height: | Size: 1,000 B |
|
Before Width: | Height: | Size: 316 B After Width: | Height: | Size: 559 B |
|
|
@ -159,21 +159,12 @@ static cairo_test_status_t
|
|||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
int i, j, x, y;
|
||||
cairo_font_options_t *font_options;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
|
||||
|
||||
cairo_set_font_options (cr, font_options);
|
||||
cairo_font_options_destroy (font_options);
|
||||
|
||||
for (j = 0; j < ARRAY_SIZE (draw_funcs); j++) {
|
||||
for (i = 0; i < ARRAY_SIZE (pattern_funcs); i++) {
|
||||
x = i * (WIDTH + PAD) + PAD;
|
||||
|
|
|
|||
|
|
@ -198,21 +198,12 @@ static cairo_test_status_t
|
|||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
int i, j, x, y;
|
||||
cairo_font_options_t *font_options;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
|
||||
|
||||
cairo_set_font_options (cr, font_options);
|
||||
cairo_font_options_destroy (font_options);
|
||||
|
||||
for (j = 0; j < ARRAY_SIZE (draw_funcs); j++) {
|
||||
for (i = 0; i < ARRAY_SIZE (pattern_funcs); i++) {
|
||||
x = i * (WIDTH + PAD) + PAD;
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 505 B After Width: | Height: | Size: 505 B |
|
Before Width: | Height: | Size: 505 B |
|
Before Width: | Height: | Size: 516 B After Width: | Height: | Size: 516 B |
|
Before Width: | Height: | Size: 516 B |
|
Before Width: | Height: | Size: 322 B After Width: | Height: | Size: 442 B |
BIN
test/pixman-rotate-svg-argb32-ref.png
Normal file
|
After Width: | Height: | Size: 258 B |
BIN
test/pixman-rotate-svg-rgb24-ref.png
Normal file
|
After Width: | Height: | Size: 358 B |
|
Before Width: | Height: | Size: 258 B |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 481 B After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 3 KiB |
BIN
test/select-font-face-svg-ref.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 3 KiB |
|
|
@ -39,23 +39,12 @@ cairo_test_t test = {
|
|||
static cairo_test_status_t
|
||||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
cairo_font_options_t *font_options;
|
||||
|
||||
/* We draw in the default black, so paint white first. */
|
||||
cairo_save (cr);
|
||||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
|
||||
cairo_paint (cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
cairo_font_options_set_hint_metrics (font_options, CAIRO_HINT_METRICS_OFF);
|
||||
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
|
||||
|
||||
cairo_set_font_options (cr, font_options);
|
||||
cairo_font_options_destroy (font_options);
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 0, 0); /* black */
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Serif",
|
||||
|
|
|
|||
|
|
@ -91,7 +91,6 @@ static cairo_test_status_t
|
|||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
cairo_glyph_t glyphs[NUM_GLYPHS];
|
||||
cairo_font_options_t *font_options;
|
||||
int i;
|
||||
|
||||
/* Initialize our giant array of glyphs. */
|
||||
|
|
@ -110,14 +109,6 @@ draw (cairo_t *cr, int width, int height)
|
|||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
|
||||
|
||||
cairo_set_font_options (cr, font_options);
|
||||
cairo_font_options_destroy (font_options);
|
||||
|
||||
cairo_show_glyphs (cr, glyphs, NUM_GLYPHS);
|
||||
|
||||
return CAIRO_TEST_SUCCESS;
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 602 B After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
|
@ -39,8 +39,6 @@ cairo_test_t test = {
|
|||
static cairo_test_status_t
|
||||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
cairo_font_options_t *font_options;
|
||||
|
||||
/* We draw in the default black, so paint white first. */
|
||||
cairo_save (cr);
|
||||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
|
||||
|
|
@ -52,14 +50,6 @@ draw (cairo_t *cr, int width, int height)
|
|||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
|
||||
|
||||
cairo_set_font_options (cr, font_options);
|
||||
cairo_font_options_destroy (font_options);
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 0, 0); /* black */
|
||||
|
||||
cairo_move_to (cr, 0, TEXT_SIZE);
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 950 B |
|
Before Width: | Height: | Size: 310 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1 KiB |
|
|
@ -57,12 +57,9 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
cairo_get_font_options (cr, font_options);
|
||||
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
|
||||
|
||||
cairo_set_font_options (cr, font_options);
|
||||
cairo_font_options_destroy (font_options);
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 0, 0); /* black */
|
||||
cairo_text_extents (cr, black, &extents);
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 950 B |
|
Before Width: | Height: | Size: 310 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1 KiB |
|
|
@ -57,12 +57,9 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
cairo_get_font_options (cr, font_options);
|
||||
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_NONE);
|
||||
|
||||
cairo_set_font_options (cr, font_options);
|
||||
cairo_font_options_destroy (font_options);
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 0, 0); /* black */
|
||||
cairo_text_extents (cr, black, &extents);
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 950 B |
|
Before Width: | Height: | Size: 310 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1 KiB |
|
|
@ -53,16 +53,12 @@ draw (cairo_t *cr, int width, int height)
|
|||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size (cr, TEXT_SIZE);
|
||||
|
||||
/* Sub-pixel antialiasing with unhinted glyphs can be pretty ugly
|
||||
* (bad color fringing). The reason we turn off hints here is to
|
||||
* try to get repeatable glyph shapes on multiple systems, not for
|
||||
* any aesthetic reason. */
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
cairo_get_font_options (cr, font_options);
|
||||
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_SUBPIXEL);
|
||||
cairo_font_options_set_subpixel_order (font_options, CAIRO_SUBPIXEL_ORDER_RGB);
|
||||
cairo_set_font_options (cr, font_options);
|
||||
|
||||
cairo_font_options_destroy (font_options);
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 0, 0); /* black */
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
|
@ -40,17 +40,8 @@ cairo_test_t test = {
|
|||
static cairo_test_status_t
|
||||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
cairo_font_options_t *font_options;
|
||||
cairo_pattern_t *pat;
|
||||
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
|
||||
|
||||
cairo_set_font_options (cr, font_options);
|
||||
cairo_font_options_destroy (font_options);
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
|
|
|
|||
|
|
@ -110,9 +110,8 @@ draw (cairo_t *cr, int width, int height)
|
|||
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
cairo_get_font_options (cr, font_options);
|
||||
cairo_font_options_set_hint_metrics (font_options, CAIRO_HINT_METRICS_OFF);
|
||||
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
|
||||
|
||||
cairo_set_font_options (cr, font_options);
|
||||
cairo_font_options_destroy (font_options);
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 420 B |
|
Before Width: | Height: | Size: 4 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
|
@ -145,21 +145,12 @@ static cairo_test_status_t
|
|||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
int i, j, x, y;
|
||||
cairo_font_options_t *font_options;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
cairo_select_font_face (cr, "Bitstream Vera Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
CAIRO_FONT_WEIGHT_NORMAL);
|
||||
|
||||
font_options = cairo_font_options_create ();
|
||||
|
||||
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
|
||||
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
|
||||
|
||||
cairo_set_font_options (cr, font_options);
|
||||
cairo_font_options_destroy (font_options);
|
||||
|
||||
for (j = 0; j < ARRAY_SIZE (draw_funcs); j++) {
|
||||
for (i = 0; i < ARRAY_SIZE (operators); i++) {
|
||||
x = i * (WIDTH + PAD) + PAD;
|
||||
|
|
|
|||