Commit ff99eb7c authored by Tor Lillqvist's avatar Tor Lillqvist Committed by Tor Lillqvist

Add an extra parameter so that we don't have to do unnecessary settings to

2000-02-13  Tor Lillqvist  <tml@iki.fi>

* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Add an extra parameter
so that we don't have to do unnecessary settings to the HDC.

* gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkimage-win32.c: Corresponding changes to the calls of
gdk_gc_predraw.

* gdk/win32/gdkdrawable-win32.c: Special-casing for GdkGCs where
the fill style is GDK_OPAQUE_STIPPLED. In those cases we construct
GDI paths, call WidenPath to get the outline of the stroken path,
and then fill the outline (with the brush that was built from the
stipple).

* gdk/win32/gdkgc-win32.c: Factor out common code from
_gdk_win32_gc_new and gdk_win32_gc_set_values into
gdk_win32_gc_values_to_win32values.

* gdk/win32/gdkmain-win32.c (gdk_win32_last_error_string,
gdk_win32_api_failed): New functions for error logging.

* gdk/win32/gdkprivate-win32.h: Declare them, and a macro
WIN32_API_FAILED to call them, passing function or file name and
line number.

* gdk/win32/*.c: Use the WIN32_API_FAILED macro.

* gdk/win32/gdkprivate-win32.h: Store just the pixel values from
GdkColor for foreground and background in GdkGCWin32Data.

* gdk/makefile.cygwin: Link in the resource object separately.

* gdk/win32/rc/gdk.rc
* gtk/gtk.rc (New file)
* gdk/win32/makefile.cygwin
* gtk/makefile.cygwin: Update build number in DLLs automatically,
as in GLib.
parent ef03cb52
2000-02-13 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Add an extra parameter
so that we don't have to do unnecessary settings to the HDC.
* gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkimage-win32.c: Corresponding changes to the calls of
gdk_gc_predraw.
* gdk/win32/gdkdrawable-win32.c: Special-casing for GdkGCs where
the fill style is GDK_OPAQUE_STIPPLED. In those cases we construct
GDI paths, call WidenPath to get the outline of the stroken path,
and then fill the outline (with the brush that was built from the
stipple).
* gdk/win32/gdkgc-win32.c: Factor out common code from
_gdk_win32_gc_new and gdk_win32_gc_set_values into
gdk_win32_gc_values_to_win32values.
* gdk/win32/gdkmain-win32.c (gdk_win32_last_error_string,
gdk_win32_api_failed): New functions for error logging.
* gdk/win32/gdkprivate-win32.h: Declare them, and a macro
WIN32_API_FAILED to call them, passing function or file name and
line number.
* gdk/win32/*.c: Use the WIN32_API_FAILED macro.
* gdk/win32/gdkprivate-win32.h: Store just the pixel values from
GdkColor for foreground and background in GdkGCWin32Data.
* gdk/makefile.cygwin: Link in the resource object separately.
* gdk/win32/rc/gdk.rc
* gtk/gtk.rc (New file)
* gdk/win32/makefile.cygwin
* gtk/makefile.cygwin: Update build number in DLLs automatically,
as in GLib.
Sun Feb 13 08:54:45 2000 Tim Janik <timj@gtk.org>
* gdk/gdkcursor.h (struct _GdkCursor): s/refcount/ref_count/.
......
2000-02-13 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Add an extra parameter
so that we don't have to do unnecessary settings to the HDC.
* gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkimage-win32.c: Corresponding changes to the calls of
gdk_gc_predraw.
* gdk/win32/gdkdrawable-win32.c: Special-casing for GdkGCs where
the fill style is GDK_OPAQUE_STIPPLED. In those cases we construct
GDI paths, call WidenPath to get the outline of the stroken path,
and then fill the outline (with the brush that was built from the
stipple).
* gdk/win32/gdkgc-win32.c: Factor out common code from
_gdk_win32_gc_new and gdk_win32_gc_set_values into
gdk_win32_gc_values_to_win32values.
* gdk/win32/gdkmain-win32.c (gdk_win32_last_error_string,
gdk_win32_api_failed): New functions for error logging.
* gdk/win32/gdkprivate-win32.h: Declare them, and a macro
WIN32_API_FAILED to call them, passing function or file name and
line number.
* gdk/win32/*.c: Use the WIN32_API_FAILED macro.
* gdk/win32/gdkprivate-win32.h: Store just the pixel values from
GdkColor for foreground and background in GdkGCWin32Data.
* gdk/makefile.cygwin: Link in the resource object separately.
* gdk/win32/rc/gdk.rc
* gtk/gtk.rc (New file)
* gdk/win32/makefile.cygwin
* gtk/makefile.cygwin: Update build number in DLLs automatically,
as in GLib.
Sun Feb 13 08:54:45 2000 Tim Janik <timj@gtk.org>
* gdk/gdkcursor.h (struct _GdkCursor): s/refcount/ref_count/.
......
2000-02-13 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Add an extra parameter
so that we don't have to do unnecessary settings to the HDC.
* gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkimage-win32.c: Corresponding changes to the calls of
gdk_gc_predraw.
* gdk/win32/gdkdrawable-win32.c: Special-casing for GdkGCs where
the fill style is GDK_OPAQUE_STIPPLED. In those cases we construct
GDI paths, call WidenPath to get the outline of the stroken path,
and then fill the outline (with the brush that was built from the
stipple).
* gdk/win32/gdkgc-win32.c: Factor out common code from
_gdk_win32_gc_new and gdk_win32_gc_set_values into
gdk_win32_gc_values_to_win32values.
* gdk/win32/gdkmain-win32.c (gdk_win32_last_error_string,
gdk_win32_api_failed): New functions for error logging.
* gdk/win32/gdkprivate-win32.h: Declare them, and a macro
WIN32_API_FAILED to call them, passing function or file name and
line number.
* gdk/win32/*.c: Use the WIN32_API_FAILED macro.
* gdk/win32/gdkprivate-win32.h: Store just the pixel values from
GdkColor for foreground and background in GdkGCWin32Data.
* gdk/makefile.cygwin: Link in the resource object separately.
* gdk/win32/rc/gdk.rc
* gtk/gtk.rc (New file)
* gdk/win32/makefile.cygwin
* gtk/makefile.cygwin: Update build number in DLLs automatically,
as in GLib.
Sun Feb 13 08:54:45 2000 Tim Janik <timj@gtk.org>
* gdk/gdkcursor.h (struct _GdkCursor): s/refcount/ref_count/.
......
2000-02-13 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Add an extra parameter
so that we don't have to do unnecessary settings to the HDC.
* gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkimage-win32.c: Corresponding changes to the calls of
gdk_gc_predraw.
* gdk/win32/gdkdrawable-win32.c: Special-casing for GdkGCs where
the fill style is GDK_OPAQUE_STIPPLED. In those cases we construct
GDI paths, call WidenPath to get the outline of the stroken path,
and then fill the outline (with the brush that was built from the
stipple).
* gdk/win32/gdkgc-win32.c: Factor out common code from
_gdk_win32_gc_new and gdk_win32_gc_set_values into
gdk_win32_gc_values_to_win32values.
* gdk/win32/gdkmain-win32.c (gdk_win32_last_error_string,
gdk_win32_api_failed): New functions for error logging.
* gdk/win32/gdkprivate-win32.h: Declare them, and a macro
WIN32_API_FAILED to call them, passing function or file name and
line number.
* gdk/win32/*.c: Use the WIN32_API_FAILED macro.
* gdk/win32/gdkprivate-win32.h: Store just the pixel values from
GdkColor for foreground and background in GdkGCWin32Data.
* gdk/makefile.cygwin: Link in the resource object separately.
* gdk/win32/rc/gdk.rc
* gtk/gtk.rc (New file)
* gdk/win32/makefile.cygwin
* gtk/makefile.cygwin: Update build number in DLLs automatically,
as in GLib.
Sun Feb 13 08:54:45 2000 Tim Janik <timj@gtk.org>
* gdk/gdkcursor.h (struct _GdkCursor): s/refcount/ref_count/.
......
2000-02-13 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Add an extra parameter
so that we don't have to do unnecessary settings to the HDC.
* gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkimage-win32.c: Corresponding changes to the calls of
gdk_gc_predraw.
* gdk/win32/gdkdrawable-win32.c: Special-casing for GdkGCs where
the fill style is GDK_OPAQUE_STIPPLED. In those cases we construct
GDI paths, call WidenPath to get the outline of the stroken path,
and then fill the outline (with the brush that was built from the
stipple).
* gdk/win32/gdkgc-win32.c: Factor out common code from
_gdk_win32_gc_new and gdk_win32_gc_set_values into
gdk_win32_gc_values_to_win32values.
* gdk/win32/gdkmain-win32.c (gdk_win32_last_error_string,
gdk_win32_api_failed): New functions for error logging.
* gdk/win32/gdkprivate-win32.h: Declare them, and a macro
WIN32_API_FAILED to call them, passing function or file name and
line number.
* gdk/win32/*.c: Use the WIN32_API_FAILED macro.
* gdk/win32/gdkprivate-win32.h: Store just the pixel values from
GdkColor for foreground and background in GdkGCWin32Data.
* gdk/makefile.cygwin: Link in the resource object separately.
* gdk/win32/rc/gdk.rc
* gtk/gtk.rc (New file)
* gdk/win32/makefile.cygwin
* gtk/makefile.cygwin: Update build number in DLLs automatically,
as in GLib.
Sun Feb 13 08:54:45 2000 Tim Janik <timj@gtk.org>
* gdk/gdkcursor.h (struct _GdkCursor): s/refcount/ref_count/.
......
2000-02-13 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Add an extra parameter
so that we don't have to do unnecessary settings to the HDC.
* gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkimage-win32.c: Corresponding changes to the calls of
gdk_gc_predraw.
* gdk/win32/gdkdrawable-win32.c: Special-casing for GdkGCs where
the fill style is GDK_OPAQUE_STIPPLED. In those cases we construct
GDI paths, call WidenPath to get the outline of the stroken path,
and then fill the outline (with the brush that was built from the
stipple).
* gdk/win32/gdkgc-win32.c: Factor out common code from
_gdk_win32_gc_new and gdk_win32_gc_set_values into
gdk_win32_gc_values_to_win32values.
* gdk/win32/gdkmain-win32.c (gdk_win32_last_error_string,
gdk_win32_api_failed): New functions for error logging.
* gdk/win32/gdkprivate-win32.h: Declare them, and a macro
WIN32_API_FAILED to call them, passing function or file name and
line number.
* gdk/win32/*.c: Use the WIN32_API_FAILED macro.
* gdk/win32/gdkprivate-win32.h: Store just the pixel values from
GdkColor for foreground and background in GdkGCWin32Data.
* gdk/makefile.cygwin: Link in the resource object separately.
* gdk/win32/rc/gdk.rc
* gtk/gtk.rc (New file)
* gdk/win32/makefile.cygwin
* gtk/makefile.cygwin: Update build number in DLLs automatically,
as in GLib.
Sun Feb 13 08:54:45 2000 Tim Janik <timj@gtk.org>
* gdk/gdkcursor.h (struct _GdkCursor): s/refcount/ref_count/.
......
2000-02-13 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkgc-win32.c (gdk_gc_predraw): Add an extra parameter
so that we don't have to do unnecessary settings to the HDC.
* gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkimage-win32.c: Corresponding changes to the calls of
gdk_gc_predraw.
* gdk/win32/gdkdrawable-win32.c: Special-casing for GdkGCs where
the fill style is GDK_OPAQUE_STIPPLED. In those cases we construct
GDI paths, call WidenPath to get the outline of the stroken path,
and then fill the outline (with the brush that was built from the
stipple).
* gdk/win32/gdkgc-win32.c: Factor out common code from
_gdk_win32_gc_new and gdk_win32_gc_set_values into
gdk_win32_gc_values_to_win32values.
* gdk/win32/gdkmain-win32.c (gdk_win32_last_error_string,
gdk_win32_api_failed): New functions for error logging.
* gdk/win32/gdkprivate-win32.h: Declare them, and a macro
WIN32_API_FAILED to call them, passing function or file name and
line number.
* gdk/win32/*.c: Use the WIN32_API_FAILED macro.
* gdk/win32/gdkprivate-win32.h: Store just the pixel values from
GdkColor for foreground and background in GdkGCWin32Data.
* gdk/makefile.cygwin: Link in the resource object separately.
* gdk/win32/rc/gdk.rc
* gtk/gtk.rc (New file)
* gdk/win32/makefile.cygwin
* gtk/makefile.cygwin: Update build number in DLLs automatically,
as in GLib.
Sun Feb 13 08:54:45 2000 Tim Janik <timj@gtk.org>
* gdk/gdkcursor.h (struct _GdkCursor): s/refcount/ref_count/.
......
......@@ -48,7 +48,7 @@ gdk_OBJECTS = \
gdkconfig.h : gdkconfig.h.win32
$(CP) gdkconfig.h.win32 gdkconfig.h
gdk-$(GTK_VER).dll : $(gdk_OBJECTS) gdk.def win32/libgdk-win32.a
gdk-$(GTK_VER).dll : $(gdk_OBJECTS) gdk.def win32/libgdk-win32.a win32/gdk-win32res.o
$(GLIB)/build-dll gdk $(GTK_VER) gdk.def $(gdk_OBJECTS) -L win32 -lgdk-win32 -lwntab32x -L $(GLIB) -lglib-$(GLIB_VER) -lgdi32 -luser32 -limm32 -lshell32 -lole32 -luuid $(LDFLAGS) win32/gdk-win32res.o
.SUFFIXES: .c .o .i
......
......@@ -87,8 +87,7 @@ alloc_color_cells(Colormap colormap,
#ifdef SOME_STRANGE_BUG
if (!ResizePalette (colormap->palette, colormap->size + nmore))
{
g_warning ("alloc_color_cells: ResizePalette to %d failed",
colormap->size + nmore);
WIN32_API_FAILED ("ResizePalette")
return FALSE;
}
g_print("alloc_color_cells: %#x to %d\n",
......@@ -205,7 +204,7 @@ alloc_color(Colormap colormap,
/* It was a free'd entry anyway, so we can use it, and
set it to the correct color. */
if (SetPaletteEntries (colormap->palette, index, 1, &entry) == 0)
g_warning ("alloc_color: SetPaletteEntries #1 failed");
WIN32_API_FAILED ("SetPaletteEntries #1");
}
else
{
......@@ -218,7 +217,7 @@ alloc_color(Colormap colormap,
/* A free slot, use it. */
if (SetPaletteEntries (colormap->palette,
index, 1, &entry) == 0)
g_warning ("alloc_color: SetPaletteEntries #2 failed");
WIN32_API_FAILED ("SetPaletteEntries #2");
index = i;
break;
}
......@@ -238,10 +237,9 @@ alloc_color(Colormap colormap,
index = colormap->size;
colormap->size++;
if (!ResizePalette (colormap->palette, colormap->size))
g_warning ("alloc_color: ResizePalette to %d failed",
colormap->size);
WIN32_API_FAILED ("ResizePalette");
if (SetPaletteEntries (colormap->palette, index, 1, &entry) == 0)
g_warning ("alloc_color: SetPaletteEntries #3 failed");
WIN32_API_FAILED ("SetPaletteEntries #3");
}
}
}
......@@ -329,7 +327,7 @@ free_colors (Colormap colormap,
if (SetPaletteEntries (colormap->palette, lowestpixel,
highestpixel - lowestpixel + 1,
entries + lowestpixel) == 0)
g_warning ("free_colors: SetPaletteEntries failed");
WIN32_API_FAILED ("SetPaletteEntries");
#endif
colormap->stale = TRUE;
#if 0
......@@ -1553,7 +1551,7 @@ gdk_colormap_change (GdkColormap *colormap,
if (SetPaletteEntries (private->xcolormap->palette,
0, ncolors, palette) == 0)
g_warning ("gdk_colormap_change: SetPaletteEntries failed");
WIN32_API_FAILED ("SetPaletteEntries");
private->xcolormap->stale = TRUE;
break;
......@@ -1860,7 +1858,7 @@ gdk_colormap_alloc_colors_private (GdkColormap *colormap,
if (SetPaletteEntries (private->xcolormap->palette,
0, nstore, store) == 0)
g_warning ("gdk_colormap_alloc_colors_private: SetPaletteEntries failed");
WIN32_API_FAILED ("SetPaletteEntries");
private->xcolormap->stale = TRUE;
g_free (store);
......@@ -2118,7 +2116,7 @@ gdk_color_change (GdkColormap *colormap,
if (SetPaletteEntries (private->xcolormap->palette,
color->pixel, 1, &xcolor) == 0)
g_warning ("gdk_color_change: SetPaletteEntries failed");
WIN32_API_FAILED ("SetPaletteEntries");
private->xcolormap->stale = TRUE;
return TRUE;
......@@ -2215,12 +2213,12 @@ gdk_colormap_cmp (Colormap *a,
return (*a == *b);
}
char *
gchar *
gdk_color_to_string (const GdkColor *color)
{
static char buf[100];
sprintf (buf, "(%.04x,%.04x,%.04x): %.06x",
sprintf (buf, "(%.04x,%.04x,%.04x):%.06x",
color->red, color->green, color->blue, color->pixel);
return buf;
......
......@@ -117,7 +117,7 @@ gdk_cursor_new (GdkCursorType cursor_type)
{
xcursor = LoadCursor (gdk_DLLInstance, cursors[i].name);
if (xcursor == NULL)
g_warning ("gdk_cursor_new: LoadCursor failed");
WIN32_API_FAILED ("LoadCursor");
GDK_NOTE (MISC, g_print ("gdk_cursor_new: %#x %d\n",
xcursor, cursor_type));
}
......@@ -132,7 +132,7 @@ gdk_cursor_new (GdkCursorType cursor_type)
private->xcursor = xcursor;
cursor = (GdkCursor*) private;
cursor->type = cursor_type;
cursor->refcount = 1;
cursor->ref_count = 1;
return cursor;
}
......@@ -268,7 +268,7 @@ _gdk_cursor_destroy (GdkCursor *cursor)
if (cursor->type == GDK_CURSOR_IS_PIXMAP)
if (!DestroyIcon (private->xcursor))
g_warning ("_gdk_cursor_destroy: DestroyIcon failed");
WIN32_API_FAILED ("DestroyIcon");
g_free (private);
}
......@@ -934,7 +934,7 @@ gdk_window_register_dnd (GdkWindow *window)
context = target_context_new ();
hres = CoLockObjectExternal ((IUnknown *) &context->idt, TRUE, FALSE);
if (!SUCCEEDED (hres))
g_warning ("gdk_window_register_dnd: CoLockObjectExternal failed");
WIN32_API_FAILED ("CoLockObjectExternal");
else
{
hres = RegisterDragDrop (GDK_DRAWABLE_XID (window), &context->idt);
......@@ -944,7 +944,7 @@ gdk_window_register_dnd (GdkWindow *window)
CoLockObjectExternal ((IUnknown *) &context->idt, FALSE, FALSE);
}
else if (!SUCCEEDED (hres))
g_warning ("gdk_window_register_dnd: RegisterDragDrop failed");
WIN32_API_FAILED ("RegisterDragDrop");
else
{
gdk_window_add_filter (window, gdk_destroy_filter, &context->idt);
......
......@@ -163,8 +163,8 @@ gdk_drawable_set_colormap (GdkDrawable *drawable,
drawable_private->colormap = colormap;
gdk_colormap_ref (drawable_private->colormap);
if (GDK_IS_WINDOW (drawable) &&
drawable_private->window_type != GDK_WINDOW_TOPLEVEL)
if (GDK_IS_WINDOW (drawable)
&& drawable_private->window_type != GDK_WINDOW_TOPLEVEL)
gdk_window_add_colormap_windows (drawable);
}
}
......@@ -186,20 +186,20 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
gint width,
gint height)
{
GdkGCPrivate *gc_private;
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc;
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private);
HDC hdc;
HGDIOBJ oldpen, oldbrush;
gc_private = (GdkGCPrivate*) gc;
hdc = gdk_gc_predraw (drawable, gc_private);
GDK_NOTE (MISC, g_print ("gdk_draw_rectangle: %#x (%d) %s%dx%d@+%d+%d\n",
GDK_NOTE (MISC, g_print ("gdk_win32_draw_rectangle: %#x (%d) %s%dx%d@+%d+%d\n",
GDK_DRAWABLE_XID (drawable),
gc_private,
(filled ? "fill " : ""),
width, height, x, y));
hdc = gdk_gc_predraw (drawable, gc_private,
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
#if 0
{
HBRUSH hbr = GetCurrentObject (hdc, OBJ_BRUSH);
......@@ -219,20 +219,62 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
}
#endif
if (filled)
oldpen = SelectObject (hdc, GetStockObject (NULL_PEN));
if (gc_data->fill_style == GDK_OPAQUE_STIPPLED)
{
if (!BeginPath (hdc))
WIN32_API_FAILED ("BeginPath");
else
{
/* Win9x doesn't support Rectangle calls in a path,
* thus use Polyline.
*/
POINT pts[4];
pts[0].x = x;
pts[0].y = y;
pts[1].x = x + width + 1;
pts[1].y = y;
pts[2].x = x + width + 1;
pts[2].y = y + height + 1;
pts[3].x = x;
pts[3].y = y + height + 1;
MoveToEx (hdc, x, y, NULL);
if (!Polyline (hdc, pts, 4))
WIN32_API_FAILED ("Polyline");
if (!CloseFigure (hdc))
WIN32_API_FAILED ("CloseFigure");
if (!EndPath (hdc))
WIN32_API_FAILED ("EndPath");
if (!filled)
if (!WidenPath (hdc))
WIN32_API_FAILED ("WidenPath");
if (!FillPath (hdc))
WIN32_API_FAILED ("FillPath");
}
}
else
oldbrush = SelectObject (hdc, GetStockObject (HOLLOW_BRUSH));
{
if (filled)
oldpen = SelectObject (hdc, GetStockObject (NULL_PEN));
else
oldbrush = SelectObject (hdc, GetStockObject (HOLLOW_BRUSH));
if (!Rectangle (hdc, x, y, x+width+1, y+height+1))
g_warning ("gdk_draw_rectangle: Rectangle failed");
if (!Rectangle (hdc, x, y, x+width+1, y+height+1))
WIN32_API_FAILED ("Rectangle");
if (filled)
SelectObject (hdc, oldpen);
else
SelectObject (hdc, oldbrush);
if (filled)
SelectObject (hdc, oldpen);
else
SelectObject (hdc, oldbrush);
}
gdk_gc_postdraw (drawable, gc_private);
gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
}
static void
......@@ -258,7 +300,8 @@ gdk_win32_draw_arc (GdkDrawable *drawable,
if (width != 0 && height != 0 && angle2 != 0)
{
hdc = gdk_gc_predraw (drawable, gc_private);
hdc = gdk_gc_predraw (drawable, gc_private,
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
if (angle2 >= 360*64)
{
......@@ -280,6 +323,8 @@ gdk_win32_draw_arc (GdkDrawable *drawable,
nYStartArc = y + height/2 + -100. * sin((angle1+angle2)/64.*2.*G_PI/360.);
}
/* GDK_OPAQUE_STIPPLED arcs not implemented. */
if (filled)
{
GDK_NOTE (MISC, g_print ("...Pie(hdc,%d,%d,%d,%d,%d,%d,%d,%d)\n",
......@@ -298,7 +343,8 @@ gdk_win32_draw_arc (GdkDrawable *drawable,
Arc (hdc, x, y, x+width, y+height,
nXStartArc, nYStartArc, nXEndArc, nYEndArc);
}
gdk_gc_postdraw (drawable, gc_private);
gdk_gc_postdraw (drawable, gc_private,
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
}
}
......@@ -309,22 +355,22 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
GdkGCPrivate *gc_private;
GdkGCPrivate *gc_private = (GdkGCPrivate*) gc;
GdkGCWin32Data *gc_data = GDK_GC_WIN32DATA (gc_private);
HDC hdc;
POINT *pts;
int i;
gc_private = (GdkGCPrivate*) gc;
GDK_NOTE (MISC, g_print ("gdk_draw_polygon: %#x (%d) %d\n",
GDK_NOTE (MISC, g_print ("gdk_win32_draw_polygon: %#x (%d) %d\n",
GDK_DRAWABLE_XID (drawable), gc_private,
npoints));
if (npoints < 2)
return;
hdc = gdk_gc_predraw (drawable, gc_private);
pts = g_malloc ((npoints+1) * sizeof (POINT));
hdc = gdk_gc_predraw (drawable, gc_private,
GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
pts = g_new (POINT, npoints+1);
for (i = 0; i < npoints; i++)
{
......@@ -332,25 +378,57 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
pts[i].y = points[i].y;
}
if ((points[0].x != points[npoints-1].x) ||
(points[0].y != points[npoints-1].y))
if (gc_data->fill_style == GDK_OPAQUE_STIPPLED)
{
pts[npoints].x = points[0].x;
pts[npoints].y = points[0].y;
npoints++;
}
if (filled)
{
if (!Polygon (hdc, pts, npoints))
g_warning ("gdk_draw_polygon: Polygon failed");
if (!BeginPath (hdc))
WIN32_API_FAILED ("BeginPath");
else
{
MoveToEx (hdc, points[0].x, points[0].y, NULL);
if (pts[0].x == pts[npoints-1].x && pts[0].y == pts[npoints-1].y)
npoints--;
if (!Polyline (hdc, pts, 4))
WIN32_API_FAILED ("Polyline");
if (!CloseFigure (hdc))
WIN32_API_FAILED ("CloseFigure");
if (!EndPath (hdc))
WIN32_API_FAILED ("EndPath");
if (!filled)
if (!WidenPath (hdc))
WIN32_API_FAILED ("WidenPath");
if (!FillPath (hdc))
WIN32_API_FAILED ("FillPath");
}
}
else
{
if (!Polyline (hdc, pts, npoints))
g_warning ("gdk_draw_polygon: Polyline failed");