mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 01:48:07 +02:00
[win32] Clean up compiler warnings.
Fix up a few instances of unused status returns.
This commit is contained in:
parent
bee05467a5
commit
7e6ac74de1
3 changed files with 76 additions and 63 deletions
|
|
@ -233,23 +233,22 @@ _get_system_quality (void)
|
|||
* all be 0, and face_hfont is the result of calling CreateFontIndirectW on
|
||||
* logfont.
|
||||
*/
|
||||
static cairo_scaled_font_t *
|
||||
static cairo_status_t
|
||||
_win32_scaled_font_create (LOGFONTW *logfont,
|
||||
HFONT face_hfont,
|
||||
cairo_font_face_t *font_face,
|
||||
const cairo_matrix_t *font_matrix,
|
||||
const cairo_matrix_t *ctm,
|
||||
const cairo_font_options_t *options)
|
||||
const cairo_font_options_t *options,
|
||||
cairo_scaled_font_t **font_out)
|
||||
{
|
||||
cairo_win32_scaled_font_t *f;
|
||||
cairo_matrix_t scale;
|
||||
cairo_status_t status;
|
||||
|
||||
f = malloc (sizeof(cairo_win32_scaled_font_t));
|
||||
if (f == NULL) {
|
||||
_cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
return NULL;
|
||||
}
|
||||
if (f == NULL)
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
|
||||
f->logfont = *logfont;
|
||||
|
||||
|
|
@ -309,17 +308,17 @@ _win32_scaled_font_create (LOGFONTW *logfont,
|
|||
goto FAIL;
|
||||
|
||||
status = _cairo_win32_scaled_font_set_metrics (f);
|
||||
|
||||
if (status) {
|
||||
_cairo_scaled_font_fini (&f->base);
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
return &f->base;
|
||||
*font_out = &f->base;
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
||||
FAIL:
|
||||
free (f);
|
||||
return NULL;
|
||||
return status;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
|
|
@ -415,7 +414,7 @@ _win32_scaled_font_get_unscaled_hfont (cairo_win32_scaled_font_t *scaled_font,
|
|||
|
||||
otm = malloc (otm_size);
|
||||
if (!otm) {
|
||||
_cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -487,7 +486,6 @@ _cairo_win32_scaled_font_create_toy (cairo_toy_font_face_t *toy_face,
|
|||
cairo_scaled_font_t **scaled_font_out)
|
||||
{
|
||||
LOGFONTW logfont;
|
||||
cairo_scaled_font_t *scaled_font;
|
||||
uint16_t *face_name;
|
||||
int face_name_len;
|
||||
cairo_status_t status;
|
||||
|
|
@ -546,14 +544,9 @@ _cairo_win32_scaled_font_create_toy (cairo_toy_font_face_t *toy_face,
|
|||
if (!logfont.lfFaceName)
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
|
||||
scaled_font = _win32_scaled_font_create (&logfont, NULL, &toy_face->base,
|
||||
font_matrix, ctm, options);
|
||||
if (!scaled_font)
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
|
||||
*scaled_font_out = scaled_font;
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
return _win32_scaled_font_create (&logfont, NULL, &toy_face->base,
|
||||
font_matrix, ctm, options,
|
||||
scaled_font_out);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -695,7 +688,6 @@ _cairo_win32_scaled_font_text_to_glyphs (void *abstract_font,
|
|||
FAIL1:
|
||||
free (utf16);
|
||||
|
||||
_cairo_error (status);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -1021,6 +1013,7 @@ _add_glyph (cairo_glyph_state_t *state,
|
|||
static void
|
||||
_finish_glyphs (cairo_glyph_state_t *state)
|
||||
{
|
||||
/* ignore errors as we only call _finish_glyphs on the error path */
|
||||
_flush_glyphs (state);
|
||||
|
||||
_cairo_array_fini (&state->glyphs);
|
||||
|
|
@ -1223,9 +1216,14 @@ _cairo_win32_scaled_font_show_glyphs (void *abstract_font,
|
|||
r.bottom = height;
|
||||
FillRect (tmp_surface->dc, &r, GetStockObject (WHITE_BRUSH));
|
||||
|
||||
_draw_glyphs_on_surface (tmp_surface, scaled_font, RGB (0, 0, 0),
|
||||
dest_x, dest_y,
|
||||
glyphs, num_glyphs);
|
||||
status = _draw_glyphs_on_surface (tmp_surface,
|
||||
scaled_font, RGB (0, 0, 0),
|
||||
dest_x, dest_y,
|
||||
glyphs, num_glyphs);
|
||||
if (status) {
|
||||
cairo_surface_destroy (&tmp_surface->base);
|
||||
return status;
|
||||
}
|
||||
|
||||
if (scaled_font->quality == CLEARTYPE_QUALITY) {
|
||||
/* For ClearType, we need a 4-channel mask. If we are compositing on
|
||||
|
|
@ -1387,8 +1385,7 @@ _cairo_win32_scaled_font_init_glyph_path (cairo_win32_scaled_font_t *scaled_font
|
|||
GGO_NATIVE | glyph_index_option,
|
||||
&metrics, bytesGlyph, buffer, &matrix) == GDI_ERROR) {
|
||||
status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_glyph_path");
|
||||
free (buffer);
|
||||
goto CLEANUP_FONT;
|
||||
goto CLEANUP_BUFFER;
|
||||
}
|
||||
|
||||
while (ptr < buffer + bytesGlyph) {
|
||||
|
|
@ -1401,7 +1398,9 @@ _cairo_win32_scaled_font_init_glyph_path (cairo_win32_scaled_font_t *scaled_font
|
|||
header->pfxStart.x,
|
||||
header->pfxStart.y,
|
||||
&x, &y);
|
||||
_cairo_path_fixed_move_to (path, x, y);
|
||||
status = _cairo_path_fixed_move_to (path, x, y);
|
||||
if (status)
|
||||
goto CLEANUP_BUFFER;
|
||||
|
||||
while (ptr < endPoly) {
|
||||
TTPOLYCURVE *curve = (TTPOLYCURVE *)ptr;
|
||||
|
|
@ -1414,13 +1413,17 @@ _cairo_win32_scaled_font_init_glyph_path (cairo_win32_scaled_font_t *scaled_font
|
|||
points[i].x,
|
||||
points[i].y,
|
||||
&x, &y);
|
||||
_cairo_path_fixed_line_to (path, x, y);
|
||||
status = _cairo_path_fixed_line_to (path, x, y);
|
||||
if (status)
|
||||
goto CLEANUP_BUFFER;
|
||||
}
|
||||
break;
|
||||
case TT_PRIM_QSPLINE:
|
||||
for (i = 0; i < curve->cpfx - 1; i++) {
|
||||
cairo_fixed_t p1x, p1y, p2x, p2y, cx, cy, c1x, c1y, c2x, c2y;
|
||||
_cairo_path_fixed_get_current_point (path, &p1x, &p1y);
|
||||
status = _cairo_path_fixed_get_current_point (path, &p1x, &p1y);
|
||||
if (status)
|
||||
goto CLEANUP_BUFFER;
|
||||
_cairo_win32_transform_FIXED_to_fixed (&transform,
|
||||
points[i].x,
|
||||
points[i].y,
|
||||
|
|
@ -1447,7 +1450,9 @@ _cairo_win32_scaled_font_init_glyph_path (cairo_win32_scaled_font_t *scaled_font
|
|||
c2x = 2 * cx / 3 + p2x / 3;
|
||||
c2y = 2 * cy / 3 + p2y / 3;
|
||||
|
||||
_cairo_path_fixed_curve_to (path, c1x, c1y, c2x, c2y, p2x, p2y);
|
||||
status = _cairo_path_fixed_curve_to (path, c1x, c1y, c2x, c2y, p2x, p2y);
|
||||
if (status)
|
||||
goto CLEANUP_BUFFER;
|
||||
}
|
||||
break;
|
||||
case TT_PRIM_CSPLINE:
|
||||
|
|
@ -1465,13 +1470,17 @@ _cairo_win32_scaled_font_init_glyph_path (cairo_win32_scaled_font_t *scaled_font
|
|||
points[i + 2].x,
|
||||
points[i + 2].y,
|
||||
&x2, &y2);
|
||||
_cairo_path_fixed_curve_to (path, x, y, x1, y1, x2, y2);
|
||||
status = _cairo_path_fixed_curve_to (path, x, y, x1, y1, x2, y2);
|
||||
if (status)
|
||||
goto CLEANUP_BUFFER;
|
||||
}
|
||||
break;
|
||||
}
|
||||
ptr += sizeof(TTPOLYCURVE) + sizeof (POINTFX) * (curve->cpfx - 1);
|
||||
}
|
||||
_cairo_path_fixed_close_path (path);
|
||||
status = _cairo_path_fixed_close_path (path);
|
||||
if (status)
|
||||
goto CLEANUP_BUFFER;
|
||||
}
|
||||
free(buffer);
|
||||
|
||||
|
|
@ -1479,6 +1488,9 @@ _cairo_win32_scaled_font_init_glyph_path (cairo_win32_scaled_font_t *scaled_font
|
|||
&scaled_font->base,
|
||||
path);
|
||||
|
||||
CLEANUP_BUFFER:
|
||||
free (buffer);
|
||||
|
||||
CLEANUP_FONT:
|
||||
cairo_win32_scaled_font_done_font (&scaled_font->base);
|
||||
|
||||
|
|
@ -1550,14 +1562,11 @@ _cairo_win32_font_face_scaled_font_create (void *abstract_face,
|
|||
}
|
||||
}
|
||||
|
||||
*font = _win32_scaled_font_create (&font_face->logfont,
|
||||
hfont,
|
||||
&font_face->base,
|
||||
font_matrix, ctm, options);
|
||||
if (*font)
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
else
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
return _win32_scaled_font_create (&font_face->logfont,
|
||||
hfont,
|
||||
&font_face->base,
|
||||
font_matrix, ctm, options,
|
||||
font);
|
||||
}
|
||||
|
||||
static const cairo_font_face_backend_t _cairo_win32_font_face_backend = {
|
||||
|
|
@ -1592,7 +1601,7 @@ cairo_win32_font_face_create_for_logfontw_hfont (LOGFONTW *logfont, HFONT font)
|
|||
|
||||
font_face = malloc (sizeof (cairo_win32_font_face_t));
|
||||
if (!font_face) {
|
||||
_cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
|
||||
return (cairo_font_face_t *)&_cairo_font_face_nil;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -338,7 +338,9 @@ _cairo_win32_printing_surface_paint_surface_pattern (cairo_win32_surface_t *su
|
|||
bi.bmiHeader.biClrImportant = 0;
|
||||
|
||||
m = pattern->base.matrix;
|
||||
cairo_matrix_invert (&m);
|
||||
status = cairo_matrix_invert (&m);
|
||||
/* _cairo_pattern_set_matrix guarantees invertibility */
|
||||
assert (status == CAIRO_STATUS_SUCCESS);
|
||||
|
||||
SaveDC (surface->dc);
|
||||
SetGraphicsMode (surface->dc, GM_ADVANCED);
|
||||
|
|
@ -417,12 +419,15 @@ _cairo_win32_printing_surface_paint_linear_pattern (cairo_win32_surface_t *surfa
|
|||
cairo_extend_t extend;
|
||||
int range_start, range_stop, num_ranges, num_rects, stop;
|
||||
int total_verts, total_rects;
|
||||
cairo_status_t status;
|
||||
|
||||
extend = cairo_pattern_get_extend (&pattern->base.base);
|
||||
SaveDC (surface->dc);
|
||||
|
||||
mat = pattern->base.base.matrix;
|
||||
cairo_matrix_invert (&mat);
|
||||
status = cairo_matrix_invert (&mat);
|
||||
/* _cairo_pattern_set_matrix guarantees invertibility */
|
||||
assert (status == CAIRO_STATUS_SUCCESS);
|
||||
|
||||
p1x = _cairo_fixed_to_double (pattern->p1.x);
|
||||
p1y = _cairo_fixed_to_double (pattern->p1.y);
|
||||
|
|
@ -899,7 +904,7 @@ _cairo_win32_printing_surface_stroke (void *abstract_surface,
|
|||
/* Return to device space to paint the pattern */
|
||||
if (!ModifyWorldTransform (surface->dc, &xform, MWT_IDENTITY))
|
||||
return _cairo_win32_print_gdi_error ("_win32_surface_stroke:ModifyWorldTransform");
|
||||
_cairo_win32_printing_surface_paint_pattern (surface, source);
|
||||
status = _cairo_win32_printing_surface_paint_pattern (surface, source);
|
||||
}
|
||||
RestoreDC (surface->dc, -1);
|
||||
DeleteObject (pen);
|
||||
|
|
@ -949,13 +954,16 @@ _cairo_win32_printing_surface_fill (void *abstract_surface,
|
|||
}
|
||||
|
||||
if (source->type == CAIRO_PATTERN_TYPE_SOLID) {
|
||||
_cairo_win32_printing_surface_select_solid_brush (surface, source);
|
||||
status = _cairo_win32_printing_surface_select_solid_brush (surface, source);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
FillPath (surface->dc);
|
||||
_cairo_win32_printing_surface_done_solid_brush (surface);
|
||||
} else {
|
||||
SaveDC (surface->dc);
|
||||
SelectClipPath (surface->dc, RGN_AND);
|
||||
_cairo_win32_printing_surface_paint_pattern (surface, source);
|
||||
status = _cairo_win32_printing_surface_paint_pattern (surface, source);
|
||||
RestoreDC (surface->dc, -1);
|
||||
}
|
||||
|
||||
|
|
@ -1049,9 +1057,9 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac
|
|||
status = _cairo_win32_printing_surface_emit_path (surface, scaled_glyph->path);
|
||||
}
|
||||
EndPath (surface->dc);
|
||||
if (status == 0) {
|
||||
if (status == CAIRO_STATUS_SUCCESS) {
|
||||
SelectClipPath (surface->dc, RGN_AND);
|
||||
_cairo_win32_printing_surface_paint_pattern (surface, source);
|
||||
status = _cairo_win32_printing_surface_paint_pattern (surface, source);
|
||||
}
|
||||
RestoreDC (surface->dc, -1);
|
||||
|
||||
|
|
@ -1108,13 +1116,13 @@ cairo_win32_printing_surface_create (HDC hdc)
|
|||
if (GetClipBox (hdc, &rect) == ERROR) {
|
||||
_cairo_win32_print_gdi_error ("cairo_win32_surface_create");
|
||||
/* XXX: Can we make a more reasonable guess at the error cause here? */
|
||||
_cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
|
||||
return NIL_SURFACE;
|
||||
}
|
||||
|
||||
surface = malloc (sizeof (cairo_win32_surface_t));
|
||||
if (surface == NULL) {
|
||||
_cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
|
||||
return NIL_SURFACE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ _create_dc_and_bitmap (cairo_win32_surface_t *surface,
|
|||
cairo_format_t format,
|
||||
int width,
|
||||
int height,
|
||||
char **bits_out,
|
||||
unsigned char **bits_out,
|
||||
int *rowstride_out)
|
||||
{
|
||||
cairo_status_t status;
|
||||
|
|
@ -329,12 +329,12 @@ _cairo_win32_surface_create_for_dc (HDC original_dc,
|
|||
{
|
||||
cairo_status_t status;
|
||||
cairo_win32_surface_t *surface;
|
||||
char *bits;
|
||||
unsigned char *bits;
|
||||
int rowstride;
|
||||
|
||||
surface = malloc (sizeof (cairo_win32_surface_t));
|
||||
if (surface == NULL) {
|
||||
_cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
|
||||
return NIL_SURFACE;
|
||||
}
|
||||
|
||||
|
|
@ -376,13 +376,7 @@ _cairo_win32_surface_create_for_dc (HDC original_dc,
|
|||
if (surface)
|
||||
free (surface);
|
||||
|
||||
if (status == CAIRO_STATUS_NO_MEMORY) {
|
||||
_cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
return NIL_SURFACE;
|
||||
} else {
|
||||
_cairo_error (status);
|
||||
return NIL_SURFACE;
|
||||
}
|
||||
return NIL_SURFACE;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
|
|
@ -1440,7 +1434,9 @@ _cairo_win32_surface_set_clip_region (void *abstract_surface,
|
|||
unsigned int serial;
|
||||
|
||||
serial = _cairo_surface_allocate_clip_serial (surface->image);
|
||||
_cairo_surface_set_clip_region (surface->image, region, serial);
|
||||
status = _cairo_surface_set_clip_region (surface->image, region, serial);
|
||||
if (status)
|
||||
return status;
|
||||
}
|
||||
|
||||
/* The semantics we want is that any clip set by cairo combines
|
||||
|
|
@ -1724,7 +1720,7 @@ cairo_win32_surface_create (HDC hdc)
|
|||
if (clipBoxType == ERROR) {
|
||||
_cairo_win32_print_gdi_error ("cairo_win32_surface_create");
|
||||
/* XXX: Can we make a more reasonable guess at the error cause here? */
|
||||
_cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
|
||||
return NIL_SURFACE;
|
||||
}
|
||||
|
||||
|
|
@ -1742,7 +1738,7 @@ cairo_win32_surface_create (HDC hdc)
|
|||
format = CAIRO_FORMAT_A1;
|
||||
else {
|
||||
_cairo_win32_print_gdi_error("cairo_win32_surface_create(bad BITSPIXEL)");
|
||||
_cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
|
||||
return NIL_SURFACE;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1751,7 +1747,7 @@ cairo_win32_surface_create (HDC hdc)
|
|||
|
||||
surface = malloc (sizeof (cairo_win32_surface_t));
|
||||
if (surface == NULL) {
|
||||
_cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
|
||||
return NIL_SURFACE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue