win32-printing: Do not clip and paint with an empty path

For non solid patterns _fill and _show_glyphs sets a clip
path then paints the pattern. Previously if the path is empty
SelectClipPath did not set clip. This was probably the cause
of bug 13657 where the entire page was black.

Fix this by not painting anything if the path is empty.
This commit is contained in:
Adrian Johnson 2008-01-11 22:07:26 +10:30
parent 7ef4caaf11
commit 2574cc35b3
2 changed files with 7 additions and 2 deletions

View file

@ -874,6 +874,7 @@ _cairo_win32_printing_surface_path_line_to (void *closure, cairo_point_t *point)
{
win32_path_info_t *path_info = closure;
path_info->surface->path_empty = FALSE;
if (path_info->surface->has_ctm) {
double x, y;
@ -899,6 +900,7 @@ _cairo_win32_printing_surface_path_curve_to (void *closure,
win32_path_info_t *path_info = closure;
POINT points[3];
path_info->surface->path_empty = FALSE;
if (path_info->surface->has_ctm) {
double x, y;
@ -1244,6 +1246,7 @@ _cairo_win32_printing_surface_fill (void *abstract_surface,
assert (_cairo_win32_printing_surface_operation_supported (surface, op, source));
surface->path_empty = TRUE;
BeginPath (surface->dc);
status = _cairo_win32_printing_surface_emit_path (surface, path);
EndPath (surface->dc);
@ -1266,7 +1269,7 @@ _cairo_win32_printing_surface_fill (void *abstract_surface,
FillPath (surface->dc);
_cairo_win32_printing_surface_done_solid_brush (surface);
} else {
} else if (surface->path_empty == FALSE) {
SaveDC (surface->dc);
SelectClipPath (surface->dc, RGN_AND);
status = _cairo_win32_printing_surface_paint_pattern (surface, source);
@ -1358,6 +1361,7 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac
old_ctm = surface->ctm;
old_has_ctm = surface->has_ctm;
surface->has_ctm = TRUE;
surface->path_empty = TRUE;
BeginPath (surface->dc);
for (i = 0; i < num_glyphs; i++) {
status = _cairo_scaled_glyph_lookup (scaled_font,
@ -1373,7 +1377,7 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac
EndPath (surface->dc);
surface->ctm = old_ctm;
surface->has_ctm = old_has_ctm;
if (status == CAIRO_STATUS_SUCCESS) {
if (status == CAIRO_STATUS_SUCCESS && surface->path_empty == FALSE) {
if (source->type == CAIRO_PATTERN_TYPE_SOLID) {
status = _cairo_win32_printing_surface_select_solid_brush (surface, source);
if (status)

View file

@ -83,6 +83,7 @@ typedef struct _cairo_win32_surface {
/* printing surface bits */
cairo_paginated_mode_t paginated_mode;
cairo_content_t content;
cairo_bool_t path_empty;
cairo_bool_t has_ctm;
cairo_matrix_t ctm;
int clip_saved_dc;