1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/cairo/disable-subpixel-antialiasing.patch Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,519 @@ 1.4 +# HG changeset patch 1.5 +# User Robert O'Callahan <robert@ocallahan.org> 1.6 +# Date 1294019288 -46800 1.7 +# Node ID 8857392e37aea7475ed6d8ee4b45023e1233bcec 1.8 +# Parent c53f60831c43cca397dfed8adf8d350aeec7d3ca 1.9 +Bug 363861. Part 2: Introduce cairo_surface_get/set_subpixel_antialiasing. r=jrmuizel,sr=vlad,a=blocking 1.10 + 1.11 +diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c 1.12 +--- a/gfx/cairo/cairo/src/cairo-quartz-surface.c 1.13 ++++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c 1.14 +@@ -2473,16 +2473,17 @@ _cairo_quartz_surface_show_glyphs (void 1.15 + cairo_int_status_t rv = CAIRO_STATUS_SUCCESS; 1.16 + cairo_quartz_drawing_state_t state; 1.17 + float xprev, yprev; 1.18 + int i; 1.19 + CGFontRef cgfref = NULL; 1.20 + 1.21 + cairo_bool_t isClipping = FALSE; 1.22 + cairo_bool_t didForceFontSmoothing = FALSE; 1.23 ++ cairo_antialias_t effective_antialiasing; 1.24 + 1.25 + if (IS_EMPTY(surface)) 1.26 + return CAIRO_STATUS_SUCCESS; 1.27 + 1.28 + if (num_glyphs <= 0) 1.29 + return CAIRO_STATUS_SUCCESS; 1.30 + 1.31 + if (cairo_scaled_font_get_type (scaled_font) != CAIRO_FONT_TYPE_QUARTZ) 1.32 +@@ -2514,16 +2515,22 @@ _cairo_quartz_surface_show_glyphs (void 1.33 + goto BAIL; 1.34 + } 1.35 + 1.36 + /* this doesn't addref */ 1.37 + cgfref = _cairo_quartz_scaled_font_get_cg_font_ref (scaled_font); 1.38 + CGContextSetFont (state.context, cgfref); 1.39 + CGContextSetFontSize (state.context, 1.0); 1.40 + 1.41 ++ effective_antialiasing = scaled_font->options.antialias; 1.42 ++ if (effective_antialiasing == CAIRO_ANTIALIAS_SUBPIXEL && 1.43 ++ !surface->base.permit_subpixel_antialiasing) { 1.44 ++ effective_antialiasing = CAIRO_ANTIALIAS_GRAY; 1.45 ++ } 1.46 ++ 1.47 + switch (scaled_font->options.antialias) { 1.48 + case CAIRO_ANTIALIAS_SUBPIXEL: 1.49 + CGContextSetShouldAntialias (state.context, TRUE); 1.50 + CGContextSetShouldSmoothFonts (state.context, TRUE); 1.51 + if (CGContextSetAllowsFontSmoothingPtr && 1.52 + !CGContextGetAllowsFontSmoothingPtr (state.context)) 1.53 + { 1.54 + didForceFontSmoothing = TRUE; 1.55 +diff --git a/gfx/cairo/cairo/src/cairo-surface-private.h b/gfx/cairo/cairo/src/cairo-surface-private.h 1.56 +--- a/gfx/cairo/cairo/src/cairo-surface-private.h 1.57 ++++ b/gfx/cairo/cairo/src/cairo-surface-private.h 1.58 +@@ -58,16 +58,17 @@ struct _cairo_surface { 1.59 + 1.60 + cairo_reference_count_t ref_count; 1.61 + cairo_status_t status; 1.62 + unsigned int unique_id; 1.63 + 1.64 + unsigned finished : 1; 1.65 + unsigned is_clear : 1; 1.66 + unsigned has_font_options : 1; 1.67 ++ unsigned permit_subpixel_antialiasing : 1; 1.68 + 1.69 + cairo_user_data_array_t user_data; 1.70 + cairo_user_data_array_t mime_data; 1.71 + 1.72 + cairo_matrix_t device_transform; 1.73 + cairo_matrix_t device_transform_inverse; 1.74 + 1.75 + /* The actual resolution of the device, in dots per inch. */ 1.76 +diff --git a/gfx/cairo/cairo/src/cairo-surface.c b/gfx/cairo/cairo/src/cairo-surface.c 1.77 +--- a/gfx/cairo/cairo/src/cairo-surface.c 1.78 ++++ b/gfx/cairo/cairo/src/cairo-surface.c 1.79 +@@ -49,17 +49,18 @@ const cairo_surface_t name = { \ 1.80 + NULL, /* backend */ \ 1.81 + CAIRO_SURFACE_TYPE_IMAGE, /* type */ \ 1.82 + CAIRO_CONTENT_COLOR, /* content */ \ 1.83 + CAIRO_REFERENCE_COUNT_INVALID, /* ref_count */ \ 1.84 + status, /* status */ \ 1.85 + 0, /* unique id */ \ 1.86 + FALSE, /* finished */ \ 1.87 + TRUE, /* is_clear */ \ 1.88 +- FALSE, /* has_font_options */ \ 1.89 ++ FALSE, /* has_font_options */ \ 1.90 ++ FALSE, /* permit_subpixel_antialiasing */ \ 1.91 + { 0, 0, 0, NULL, }, /* user_data */ \ 1.92 + { 0, 0, 0, NULL, }, /* mime_data */ \ 1.93 + { 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 }, /* device_transform */ \ 1.94 + { 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 }, /* device_transform_inverse */ \ 1.95 + 0.0, /* x_resolution */ \ 1.96 + 0.0, /* y_resolution */ \ 1.97 + 0.0, /* x_fallback_resolution */ \ 1.98 + 0.0, /* y_fallback_resolution */ \ 1.99 +@@ -342,46 +343,48 @@ _cairo_surface_init (cairo_surface_t * 1.100 + surface->content = content; 1.101 + surface->type = backend->type; 1.102 + 1.103 + CAIRO_REFERENCE_COUNT_INIT (&surface->ref_count, 1); 1.104 + surface->status = CAIRO_STATUS_SUCCESS; 1.105 + surface->unique_id = _cairo_surface_allocate_unique_id (); 1.106 + surface->finished = FALSE; 1.107 + surface->is_clear = FALSE; 1.108 ++ surface->has_font_options = FALSE; 1.109 ++ surface->permit_subpixel_antialiasing = TRUE; 1.110 + 1.111 + _cairo_user_data_array_init (&surface->user_data); 1.112 + _cairo_user_data_array_init (&surface->mime_data); 1.113 + 1.114 + cairo_matrix_init_identity (&surface->device_transform); 1.115 + cairo_matrix_init_identity (&surface->device_transform_inverse); 1.116 + 1.117 + surface->x_resolution = CAIRO_SURFACE_RESOLUTION_DEFAULT; 1.118 + surface->y_resolution = CAIRO_SURFACE_RESOLUTION_DEFAULT; 1.119 + 1.120 + surface->x_fallback_resolution = CAIRO_SURFACE_FALLBACK_RESOLUTION_DEFAULT; 1.121 + surface->y_fallback_resolution = CAIRO_SURFACE_FALLBACK_RESOLUTION_DEFAULT; 1.122 + 1.123 + _cairo_array_init (&surface->snapshots, sizeof (cairo_surface_t *)); 1.124 + surface->snapshot_of = NULL; 1.125 +- 1.126 +- surface->has_font_options = FALSE; 1.127 + } 1.128 + 1.129 + static void 1.130 + _cairo_surface_copy_similar_properties (cairo_surface_t *surface, 1.131 + cairo_surface_t *other) 1.132 + { 1.133 + if (other->has_font_options || other->backend != surface->backend) { 1.134 + cairo_font_options_t options; 1.135 + 1.136 + cairo_surface_get_font_options (other, &options); 1.137 + _cairo_surface_set_font_options (surface, &options); 1.138 + } 1.139 + 1.140 ++ surface->permit_subpixel_antialiasing = other->permit_subpixel_antialiasing; 1.141 ++ 1.142 + cairo_surface_set_fallback_resolution (surface, 1.143 + other->x_fallback_resolution, 1.144 + other->y_fallback_resolution); 1.145 + } 1.146 + 1.147 + cairo_surface_t * 1.148 + _cairo_surface_create_similar_scratch (cairo_surface_t *other, 1.149 + cairo_content_t content, 1.150 +@@ -2482,16 +2485,67 @@ cairo_surface_has_show_text_glyphs (cair 1.151 + 1.152 + if (surface->backend->has_show_text_glyphs) 1.153 + return surface->backend->has_show_text_glyphs (surface); 1.154 + else 1.155 + return surface->backend->show_text_glyphs != NULL; 1.156 + } 1.157 + slim_hidden_def (cairo_surface_has_show_text_glyphs); 1.158 + 1.159 ++/** 1.160 ++ * cairo_surface_set_subpixel_antialiasing: 1.161 ++ * @surface: a #cairo_surface_t 1.162 ++ * 1.163 ++ * Sets whether the surface permits subpixel antialiasing. By default, 1.164 ++ * surfaces permit subpixel antialiasing. 1.165 ++ * 1.166 ++ * Enabling subpixel antialiasing for CONTENT_COLOR_ALPHA surfaces generally 1.167 ++ * requires that the pixels in the areas under a subpixel antialiasing 1.168 ++ * operation already be opaque. 1.169 ++ * 1.170 ++ * Since: 1.12 1.171 ++ **/ 1.172 ++void 1.173 ++cairo_surface_set_subpixel_antialiasing (cairo_surface_t *surface, 1.174 ++ cairo_subpixel_antialiasing_t enabled) 1.175 ++{ 1.176 ++ if (surface->status) 1.177 ++ return; 1.178 ++ 1.179 ++ if (surface->finished) { 1.180 ++ _cairo_surface_set_error (surface, CAIRO_STATUS_SURFACE_FINISHED); 1.181 ++ return; 1.182 ++ } 1.183 ++ 1.184 ++ surface->permit_subpixel_antialiasing = 1.185 ++ enabled == CAIRO_SUBPIXEL_ANTIALIASING_ENABLED; 1.186 ++} 1.187 ++slim_hidden_def (cairo_surface_set_subpixel_antialiasing); 1.188 ++ 1.189 ++/** 1.190 ++ * cairo_surface_get_subpixel_antialiasing: 1.191 ++ * @surface: a #cairo_surface_t 1.192 ++ * 1.193 ++ * Gets whether the surface supports subpixel antialiasing. By default, 1.194 ++ * CAIRO_CONTENT_COLOR surfaces support subpixel antialiasing but other 1.195 ++ * surfaces do not. 1.196 ++ * 1.197 ++ * Since: 1.12 1.198 ++ **/ 1.199 ++cairo_subpixel_antialiasing_t 1.200 ++cairo_surface_get_subpixel_antialiasing (cairo_surface_t *surface) 1.201 ++{ 1.202 ++ if (surface->status) 1.203 ++ return CAIRO_SUBPIXEL_ANTIALIASING_DISABLED; 1.204 ++ 1.205 ++ return surface->permit_subpixel_antialiasing ? 1.206 ++ CAIRO_SUBPIXEL_ANTIALIASING_ENABLED : CAIRO_SUBPIXEL_ANTIALIASING_DISABLED; 1.207 ++} 1.208 ++slim_hidden_def (cairo_surface_get_subpixel_antialiasing); 1.209 ++ 1.210 + /* Note: the backends may modify the contents of the glyph array as long as 1.211 + * they do not return %CAIRO_INT_STATUS_UNSUPPORTED. This makes it possible to 1.212 + * avoid copying the array again and again, and edit it in-place. 1.213 + * Backends are in fact free to use the array as a generic buffer as they 1.214 + * see fit. 1.215 + * 1.216 + * For show_glyphs backend method, and NOT for show_text_glyphs method, 1.217 + * when they do return UNSUPPORTED, they may adjust remaining_glyphs to notify 1.218 +diff --git a/gfx/cairo/cairo/src/cairo-win32-font.c b/gfx/cairo/cairo/src/cairo-win32-font.c 1.219 +--- a/gfx/cairo/cairo/src/cairo-win32-font.c 1.220 ++++ b/gfx/cairo/cairo/src/cairo-win32-font.c 1.221 +@@ -1380,16 +1380,17 @@ _cairo_win32_scaled_font_show_glyphs (vo 1.222 + cairo_win32_surface_t *surface = (cairo_win32_surface_t *)generic_surface; 1.223 + cairo_status_t status; 1.224 + 1.225 + if (width == 0 || height == 0) 1.226 + return CAIRO_STATUS_SUCCESS; 1.227 + 1.228 + if (_cairo_surface_is_win32 (generic_surface) && 1.229 + surface->format == CAIRO_FORMAT_RGB24 && 1.230 ++ (generic_surface->permit_subpixel_antialiasing || scaled_font->quality != CLEARTYPE_QUALITY) && 1.231 + op == CAIRO_OPERATOR_OVER && 1.232 + _cairo_pattern_is_opaque_solid (pattern)) { 1.233 + 1.234 + cairo_solid_pattern_t *solid_pattern = (cairo_solid_pattern_t *)pattern; 1.235 + 1.236 + /* When compositing OVER on a GDI-understood surface, with a 1.237 + * solid opaque color, we can just call ExtTextOut directly. 1.238 + */ 1.239 +@@ -1411,16 +1412,18 @@ _cairo_win32_scaled_font_show_glyphs (vo 1.240 + * surface by drawing the the glyphs onto a DIB, black-on-white then 1.241 + * inverting. GDI outputs gamma-corrected images so inverted black-on-white 1.242 + * is very different from white-on-black. We favor the more common 1.243 + * case where the final output is dark-on-light. 1.244 + */ 1.245 + cairo_win32_surface_t *tmp_surface; 1.246 + cairo_surface_t *mask_surface; 1.247 + cairo_surface_pattern_t mask; 1.248 ++ cairo_bool_t use_subpixel_antialiasing = 1.249 ++ scaled_font->quality == CLEARTYPE_QUALITY && generic_surface->permit_subpixel_antialiasing; 1.250 + RECT r; 1.251 + 1.252 + tmp_surface = (cairo_win32_surface_t *)cairo_win32_surface_create_with_dib (CAIRO_FORMAT_ARGB32, width, height); 1.253 + if (tmp_surface->base.status) 1.254 + return tmp_surface->base.status; 1.255 + 1.256 + r.left = 0; 1.257 + r.top = 0; 1.258 +@@ -1432,17 +1435,17 @@ _cairo_win32_scaled_font_show_glyphs (vo 1.259 + scaled_font, RGB (0, 0, 0), 1.260 + dest_x, dest_y, 1.261 + glyphs, num_glyphs); 1.262 + if (status) { 1.263 + cairo_surface_destroy (&tmp_surface->base); 1.264 + return status; 1.265 + } 1.266 + 1.267 +- if (scaled_font->quality == CLEARTYPE_QUALITY) { 1.268 ++ if (use_subpixel_antialiasing) { 1.269 + /* For ClearType, we need a 4-channel mask. If we are compositing on 1.270 + * a surface with alpha, we need to compute the alpha channel of 1.271 + * the mask (we just copy the green channel). But for a destination 1.272 + * surface without alpha the alpha channel of the mask is ignored 1.273 + */ 1.274 + 1.275 + if (surface->format != CAIRO_FORMAT_RGB24) 1.276 + _compute_argb32_mask_alpha (tmp_surface); 1.277 +@@ -1460,17 +1463,17 @@ _cairo_win32_scaled_font_show_glyphs (vo 1.278 + 1.279 + /* For op == OVER, no-cleartype, a possible optimization here is to 1.280 + * draw onto an intermediate ARGB32 surface and alpha-blend that with the 1.281 + * destination 1.282 + */ 1.283 + _cairo_pattern_init_for_surface (&mask, mask_surface); 1.284 + cairo_surface_destroy (mask_surface); 1.285 + 1.286 +- if (scaled_font->quality == CLEARTYPE_QUALITY) 1.287 ++ if (use_subpixel_antialiasing) 1.288 + mask.base.has_component_alpha = TRUE; 1.289 + 1.290 + status = _cairo_surface_composite (op, pattern, 1.291 + &mask.base, 1.292 + &surface->base, 1.293 + source_x, source_y, 1.294 + 0, 0, 1.295 + dest_x, dest_y, 1.296 +diff --git a/gfx/cairo/cairo/src/cairo-xlib-surface.c b/gfx/cairo/cairo/src/cairo-xlib-surface.c 1.297 +--- a/gfx/cairo/cairo/src/cairo-xlib-surface.c 1.298 ++++ b/gfx/cairo/cairo/src/cairo-xlib-surface.c 1.299 +@@ -3570,16 +3570,17 @@ typedef struct _cairo_xlib_font_glyphset 1.300 + GlyphSet glyphset; 1.301 + cairo_format_t format; 1.302 + XRenderPictFormat *xrender_format; 1.303 + cairo_xlib_font_glyphset_free_glyphs_t *pending_free_glyphs; 1.304 + } cairo_xlib_font_glyphset_info_t; 1.305 + 1.306 + typedef struct _cairo_xlib_surface_font_private { 1.307 + cairo_scaled_font_t *scaled_font; 1.308 ++ cairo_scaled_font_t *grayscale_font; 1.309 + cairo_xlib_hook_t close_display_hook; 1.310 + cairo_xlib_display_t *display; 1.311 + cairo_xlib_font_glyphset_info_t glyphset_info[NUM_GLYPHSETS]; 1.312 + } cairo_xlib_surface_font_private_t; 1.313 + 1.314 + /* callback from CloseDisplay */ 1.315 + static void 1.316 + _cairo_xlib_surface_remove_scaled_font (cairo_xlib_display_t *display, 1.317 +@@ -3599,16 +3600,20 @@ _cairo_xlib_surface_remove_scaled_font ( 1.318 + 1.319 + _cairo_scaled_font_reset_cache (scaled_font); 1.320 + CAIRO_MUTEX_UNLOCK (scaled_font->mutex); 1.321 + 1.322 + if (font_private != NULL) { 1.323 + Display *dpy; 1.324 + int i; 1.325 + 1.326 ++ if (font_private->grayscale_font) { 1.327 ++ cairo_scaled_font_destroy (font_private->grayscale_font); 1.328 ++ } 1.329 ++ 1.330 + dpy = _cairo_xlib_display_get_dpy (display); 1.331 + for (i = 0; i < NUM_GLYPHSETS; i++) { 1.332 + cairo_xlib_font_glyphset_info_t *glyphset_info; 1.333 + 1.334 + glyphset_info = &font_private->glyphset_info[i]; 1.335 + if (glyphset_info->glyphset) 1.336 + XRenderFreeGlyphSet (dpy, glyphset_info->glyphset); 1.337 + 1.338 +@@ -3629,16 +3634,17 @@ _cairo_xlib_surface_font_init (Display 1.339 + cairo_status_t status; 1.340 + int i; 1.341 + 1.342 + font_private = malloc (sizeof (cairo_xlib_surface_font_private_t)); 1.343 + if (unlikely (font_private == NULL)) 1.344 + return _cairo_error (CAIRO_STATUS_NO_MEMORY); 1.345 + 1.346 + font_private->scaled_font = scaled_font; 1.347 ++ font_private->grayscale_font = NULL; 1.348 + status = _cairo_xlib_display_get (dpy, &font_private->display); 1.349 + if (unlikely (status)) { 1.350 + free (font_private); 1.351 + return status; 1.352 + } 1.353 + 1.354 + /* initialize and hook into the CloseDisplay callback */ 1.355 + font_private->close_display_hook.func = 1.356 +@@ -3671,16 +3677,20 @@ _cairo_xlib_surface_scaled_font_fini (ca 1.357 + { 1.358 + cairo_xlib_surface_font_private_t *font_private; 1.359 + 1.360 + font_private = scaled_font->surface_private; 1.361 + if (font_private != NULL) { 1.362 + cairo_xlib_display_t *display; 1.363 + int i; 1.364 + 1.365 ++ if (font_private->grayscale_font) { 1.366 ++ cairo_scaled_font_destroy (font_private->grayscale_font); 1.367 ++ } 1.368 ++ 1.369 + display = font_private->display; 1.370 + _cairo_xlib_remove_close_display_hook (display, 1.371 + &font_private->close_display_hook); 1.372 + 1.373 + for (i = 0; i < NUM_GLYPHSETS; i++) { 1.374 + cairo_xlib_font_glyphset_info_t *glyphset_info; 1.375 + 1.376 + glyphset_info = &font_private->glyphset_info[i]; 1.377 +@@ -4417,16 +4427,62 @@ _cairo_xlib_surface_owns_font (cairo_xli 1.378 + (font_private != NULL && font_private->display != dst->display)) 1.379 + { 1.380 + return FALSE; 1.381 + } 1.382 + 1.383 + return TRUE; 1.384 + } 1.385 + 1.386 ++/* Gets a grayscale version of scaled_font. The grayscale version is cached 1.387 ++ * in our surface_private data. 1.388 ++ */ 1.389 ++static cairo_scaled_font_t * 1.390 ++_cairo_xlib_get_grayscale_font (cairo_xlib_surface_t *dst, 1.391 ++ cairo_scaled_font_t *scaled_font) 1.392 ++{ 1.393 ++ cairo_xlib_surface_font_private_t *font_private = scaled_font->surface_private; 1.394 ++ cairo_bool_t needs_font; 1.395 ++ 1.396 ++ if (font_private == NULL) { 1.397 ++ cairo_status_t status = _cairo_xlib_surface_font_init (dst->dpy, scaled_font); 1.398 ++ if (unlikely (status)) 1.399 ++ return _cairo_scaled_font_create_in_error (status); 1.400 ++ font_private = scaled_font->surface_private; 1.401 ++ } 1.402 ++ 1.403 ++ CAIRO_MUTEX_LOCK (scaled_font->mutex); 1.404 ++ needs_font = !font_private->grayscale_font; 1.405 ++ CAIRO_MUTEX_UNLOCK (scaled_font->mutex); 1.406 ++ 1.407 ++ if (needs_font) { 1.408 ++ cairo_font_options_t options; 1.409 ++ cairo_scaled_font_t *new_font; 1.410 ++ 1.411 ++ options = scaled_font->options; 1.412 ++ options.antialias = CAIRO_ANTIALIAS_GRAY; 1.413 ++ new_font = cairo_scaled_font_create (scaled_font->font_face, 1.414 ++ &scaled_font->font_matrix, 1.415 ++ &scaled_font->ctm, &options); 1.416 ++ 1.417 ++ CAIRO_MUTEX_LOCK (scaled_font->mutex); 1.418 ++ if (!font_private->grayscale_font) { 1.419 ++ font_private->grayscale_font = new_font; 1.420 ++ new_font = NULL; 1.421 ++ } 1.422 ++ CAIRO_MUTEX_UNLOCK (scaled_font->mutex); 1.423 ++ 1.424 ++ if (new_font) { 1.425 ++ cairo_scaled_font_destroy (new_font); 1.426 ++ } 1.427 ++ } 1.428 ++ 1.429 ++ return font_private->grayscale_font; 1.430 ++} 1.431 ++ 1.432 + static cairo_int_status_t 1.433 + _cairo_xlib_surface_show_glyphs (void *abstract_dst, 1.434 + cairo_operator_t op, 1.435 + const cairo_pattern_t *src_pattern, 1.436 + cairo_glyph_t *glyphs, 1.437 + int num_glyphs, 1.438 + cairo_scaled_font_t *scaled_font, 1.439 + cairo_clip_t *clip, 1.440 +@@ -4475,16 +4531,21 @@ _cairo_xlib_surface_show_glyphs (void 1.441 + 1.442 + operation = _categorize_composite_operation (dst, op, src_pattern, TRUE); 1.443 + if (operation == DO_UNSUPPORTED) 1.444 + return UNSUPPORTED ("unsupported op"); 1.445 + 1.446 + if (! _cairo_xlib_surface_owns_font (dst, scaled_font)) 1.447 + return UNSUPPORTED ("unowned font"); 1.448 + 1.449 ++ if (!dst->base.permit_subpixel_antialiasing && 1.450 ++ scaled_font->options.antialias == CAIRO_ANTIALIAS_SUBPIXEL) { 1.451 ++ scaled_font = _cairo_xlib_get_grayscale_font (dst, scaled_font); 1.452 ++ } 1.453 ++ 1.454 + X_DEBUG ((dst->dpy, "show_glyphs (dst=%x)", (unsigned int) dst->drawable)); 1.455 + 1.456 + if (clip_region != NULL && 1.457 + cairo_region_num_rectangles (clip_region) == 1) 1.458 + { 1.459 + cairo_rectangle_int_t glyph_extents; 1.460 + const cairo_rectangle_int_t *clip_extents; 1.461 + 1.462 +diff --git a/gfx/cairo/cairo/src/cairo.h b/gfx/cairo/cairo/src/cairo.h 1.463 +--- a/gfx/cairo/cairo/src/cairo.h 1.464 ++++ b/gfx/cairo/cairo/src/cairo.h 1.465 +@@ -2101,16 +2101,35 @@ cairo_public void 1.466 + cairo_surface_copy_page (cairo_surface_t *surface); 1.467 + 1.468 + cairo_public void 1.469 + cairo_surface_show_page (cairo_surface_t *surface); 1.470 + 1.471 + cairo_public cairo_bool_t 1.472 + cairo_surface_has_show_text_glyphs (cairo_surface_t *surface); 1.473 + 1.474 ++/** 1.475 ++ * _cairo_subpixel_antialiasing_t: 1.476 ++ * @CAIRO_SUBPIXEL_ANTIALIASING_ENABLED: subpixel antialiasing is enabled 1.477 ++ * for this surface. 1.478 ++ * @CAIRO_SUBPIXEL_ANTIALIASING_DISABLED: subpixel antialiasing is disabled 1.479 ++ * for this surface. 1.480 ++ */ 1.481 ++typedef enum _cairo_subpixel_antialiasing_t { 1.482 ++ CAIRO_SUBPIXEL_ANTIALIASING_ENABLED, 1.483 ++ CAIRO_SUBPIXEL_ANTIALIASING_DISABLED 1.484 ++} cairo_subpixel_antialiasing_t; 1.485 ++ 1.486 ++cairo_public void 1.487 ++cairo_surface_set_subpixel_antialiasing (cairo_surface_t *surface, 1.488 ++ cairo_subpixel_antialiasing_t enabled); 1.489 ++ 1.490 ++cairo_public cairo_subpixel_antialiasing_t 1.491 ++cairo_surface_get_subpixel_antialiasing (cairo_surface_t *surface); 1.492 ++ 1.493 + /* Image-surface functions */ 1.494 + 1.495 + /** 1.496 + * cairo_format_t: 1.497 + * @CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with 1.498 + * alpha in the upper 8 bits, then red, then green, then blue. 1.499 + * The 32-bit quantities are stored native-endian. Pre-multiplied 1.500 + * alpha is used. (That is, 50% transparent red is 0x80800000, 1.501 +diff --git a/gfx/cairo/cairo/src/cairoint.h b/gfx/cairo/cairo/src/cairoint.h 1.502 +--- a/gfx/cairo/cairo/src/cairoint.h 1.503 ++++ b/gfx/cairo/cairo/src/cairoint.h 1.504 +@@ -2750,16 +2750,18 @@ slim_hidden_proto (cairo_surface_destroy 1.505 + slim_hidden_proto (cairo_surface_finish); 1.506 + slim_hidden_proto (cairo_surface_flush); 1.507 + slim_hidden_proto (cairo_surface_get_content); 1.508 + slim_hidden_proto (cairo_surface_get_device_offset); 1.509 + slim_hidden_proto (cairo_surface_get_font_options); 1.510 + slim_hidden_proto (cairo_surface_get_mime_data); 1.511 + slim_hidden_proto (cairo_surface_get_type); 1.512 + slim_hidden_proto (cairo_surface_has_show_text_glyphs); 1.513 ++slim_hidden_proto (cairo_surface_set_subpixel_antialiasing); 1.514 ++slim_hidden_proto (cairo_surface_get_subpixel_antialiasing); 1.515 + slim_hidden_proto (cairo_surface_mark_dirty_rectangle); 1.516 + slim_hidden_proto_no_warn (cairo_surface_reference); 1.517 + slim_hidden_proto (cairo_surface_set_device_offset); 1.518 + slim_hidden_proto (cairo_surface_set_fallback_resolution); 1.519 + slim_hidden_proto (cairo_surface_set_mime_data); 1.520 + slim_hidden_proto (cairo_surface_show_page); 1.521 + slim_hidden_proto (cairo_surface_status); 1.522 + slim_hidden_proto (cairo_text_cluster_allocate);