mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-04 21:08:10 +02:00
quartz-font: Silence 0x0 CGContext warning
Silence Quartz complaints about operations on empty contexts: <Error>: CGContextSetFont: invalid context 0x0 <Error>: CGContextSetFontSize: invalid context 0x0 <Error>: CGContextSetTextMatrix: invalid context 0x0 <Error>: CGContextSetAlpha: invalid context 0x0 <Error>: CGContextShowGlyphsAtPoint: invalid context 0x0
This commit is contained in:
parent
1687e61694
commit
f40e3b09a1
1 changed files with 41 additions and 34 deletions
|
|
@ -673,44 +673,51 @@ _cairo_quartz_init_glyph_surface (cairo_quartz_scaled_font_t *font,
|
|||
if (surface->base.status)
|
||||
return surface->base.status;
|
||||
|
||||
cgContext = CGBitmapContextCreate (surface->data,
|
||||
surface->width,
|
||||
surface->height,
|
||||
8,
|
||||
surface->stride,
|
||||
NULL,
|
||||
kCGImageAlphaOnly);
|
||||
if (surface->width != 0 && surface->height != 0) {
|
||||
cgContext = CGBitmapContextCreate (surface->data,
|
||||
surface->width,
|
||||
surface->height,
|
||||
8,
|
||||
surface->stride,
|
||||
NULL,
|
||||
kCGImageAlphaOnly);
|
||||
|
||||
CGContextSetFont (cgContext, font_face->cgFont);
|
||||
CGContextSetFontSize (cgContext, 1.0);
|
||||
CGContextSetTextMatrix (cgContext, textMatrix);
|
||||
if (cgContext == NULL) {
|
||||
cairo_surface_destroy (surface);
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
}
|
||||
|
||||
switch (font->base.options.antialias) {
|
||||
case CAIRO_ANTIALIAS_SUBPIXEL:
|
||||
CGContextSetShouldAntialias (cgContext, TRUE);
|
||||
CGContextSetShouldSmoothFonts (cgContext, TRUE);
|
||||
if (CGContextSetAllowsFontSmoothingPtr &&
|
||||
!CGContextGetAllowsFontSmoothingPtr (cgContext))
|
||||
CGContextSetAllowsFontSmoothingPtr (cgContext, TRUE);
|
||||
break;
|
||||
case CAIRO_ANTIALIAS_NONE:
|
||||
CGContextSetShouldAntialias (cgContext, FALSE);
|
||||
break;
|
||||
case CAIRO_ANTIALIAS_GRAY:
|
||||
CGContextSetShouldAntialias (cgContext, TRUE);
|
||||
CGContextSetShouldSmoothFonts (cgContext, FALSE);
|
||||
break;
|
||||
case CAIRO_ANTIALIAS_DEFAULT:
|
||||
default:
|
||||
/* Don't do anything */
|
||||
break;
|
||||
CGContextSetFont (cgContext, font_face->cgFont);
|
||||
CGContextSetFontSize (cgContext, 1.0);
|
||||
CGContextSetTextMatrix (cgContext, textMatrix);
|
||||
|
||||
switch (font->base.options.antialias) {
|
||||
case CAIRO_ANTIALIAS_SUBPIXEL:
|
||||
CGContextSetShouldAntialias (cgContext, TRUE);
|
||||
CGContextSetShouldSmoothFonts (cgContext, TRUE);
|
||||
if (CGContextSetAllowsFontSmoothingPtr &&
|
||||
!CGContextGetAllowsFontSmoothingPtr (cgContext))
|
||||
CGContextSetAllowsFontSmoothingPtr (cgContext, TRUE);
|
||||
break;
|
||||
case CAIRO_ANTIALIAS_NONE:
|
||||
CGContextSetShouldAntialias (cgContext, FALSE);
|
||||
break;
|
||||
case CAIRO_ANTIALIAS_GRAY:
|
||||
CGContextSetShouldAntialias (cgContext, TRUE);
|
||||
CGContextSetShouldSmoothFonts (cgContext, FALSE);
|
||||
break;
|
||||
case CAIRO_ANTIALIAS_DEFAULT:
|
||||
default:
|
||||
/* Don't do anything */
|
||||
break;
|
||||
}
|
||||
|
||||
CGContextSetAlpha (cgContext, 1.0);
|
||||
CGContextShowGlyphsAtPoint (cgContext, - glyphOrigin.x, - glyphOrigin.y, &glyph, 1);
|
||||
|
||||
CGContextRelease (cgContext);
|
||||
}
|
||||
|
||||
CGContextSetAlpha (cgContext, 1.0);
|
||||
CGContextShowGlyphsAtPoint (cgContext, - glyphOrigin.x, - glyphOrigin.y, &glyph, 1);
|
||||
|
||||
CGContextRelease (cgContext);
|
||||
|
||||
cairo_surface_set_device_offset (&surface->base,
|
||||
- glyphOrigin.x,
|
||||
height + glyphOrigin.y);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue