diff options
author | Benjamin Otte <otte@redhat.com> | 2010-07-14 19:23:45 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-08-10 21:02:27 +0200 |
commit | e85dfc7cc4334430b7f95d7e97a10c6c9e3f1233 (patch) | |
tree | 6deb93bee0b6f94b5d46003eb1eaf93ff30047d6 | |
parent | d2b1da4e844f9674140a2793037e1d875835cac4 (diff) | |
download | gtk+-e85dfc7cc4334430b7f95d7e97a10c6c9e3f1233.tar.gz |
API: remove gdk_draw_polygon()
-rw-r--r-- | docs/reference/gdk/gdk3-sections.txt | 1 | ||||
-rw-r--r-- | docs/reference/gdk/tmpl/drawing.sgml | 11 | ||||
-rw-r--r-- | gdk/directfb/gdkdrawable-directfb.c | 75 | ||||
-rw-r--r-- | gdk/gdk.symbols | 1 | ||||
-rw-r--r-- | gdk/gdkdraw.c | 28 | ||||
-rw-r--r-- | gdk/gdkdrawable.h | 10 | ||||
-rw-r--r-- | gdk/gdkoffscreenwindow.c | 38 | ||||
-rw-r--r-- | gdk/gdkpixmap.c | 19 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 42 | ||||
-rw-r--r-- | gdk/quartz/gdkdrawable-quartz.c | 41 | ||||
-rw-r--r-- | gdk/win32/gdkdrawable-win32.c | 91 | ||||
-rw-r--r-- | gdk/x11/gdkdrawable-x11.c | 50 |
12 files changed, 0 insertions, 407 deletions
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt index 5963faeab1..413af2324d 100644 --- a/docs/reference/gdk/gdk3-sections.txt +++ b/docs/reference/gdk/gdk3-sections.txt @@ -341,7 +341,6 @@ gdk_draw_lines gdk_draw_segments GdkSegment gdk_draw_rectangle -gdk_draw_polygon gdk_draw_layout_line gdk_draw_layout_line_with_colors gdk_draw_layout diff --git a/docs/reference/gdk/tmpl/drawing.sgml b/docs/reference/gdk/tmpl/drawing.sgml index 46f63f56dd..19290892b4 100644 --- a/docs/reference/gdk/tmpl/drawing.sgml +++ b/docs/reference/gdk/tmpl/drawing.sgml @@ -208,17 +208,6 @@ function. @height: -<!-- ##### FUNCTION gdk_draw_polygon ##### --> -<para> -</para> - -@drawable: -@gc: -@filled: -@points: -@n_points: - - <!-- ##### FUNCTION gdk_draw_layout_line ##### --> <para> diff --git a/gdk/directfb/gdkdrawable-directfb.c b/gdk/directfb/gdkdrawable-directfb.c index d3f55f705b..87cfd71b08 100644 --- a/gdk/directfb/gdkdrawable-directfb.c +++ b/gdk/directfb/gdkdrawable-directfb.c @@ -554,80 +554,6 @@ gdk_directfb_draw_rectangle (GdkDrawable *drawable, } static void -gdk_directfb_draw_polygon (GdkDrawable *drawable, - GdkGC *gc, - gint filled, - GdkPoint *points, - gint npoints) -{ - g_return_if_fail (GDK_IS_DRAWABLE (drawable)); - - D_DEBUG_AT( GDKDFB_Drawable, "%s( %p, %p, %s, %p, %d )\n", G_STRFUNC, - drawable, gc, filled ? " filled" : "outline", points, npoints ); - - if (npoints < 3) - return; - - if (filled) - { - if (npoints == 3 || (npoints == 4 && - points[0].x == points[npoints-1].x && - points[0].y == points[npoints-1].y)) - { - GdkDrawableImplDirectFB *impl; - cairo_region_t clip; - gint i; - - impl = GDK_DRAWABLE_IMPL_DIRECTFB (drawable); - - if (!gdk_directfb_setup_for_drawing (impl, GDK_GC_DIRECTFB (gc))) - return; - - gdk_directfb_clip_region (drawable, gc, NULL, &clip); - - for (i = 0; i < clip.numRects; i++) - { - DFBRegion reg = { clip.rects[i].x1, clip.rects[i].y1, - clip.rects[i].x2 , clip.rects[i].y2 }; - - impl->surface->SetClip (impl->surface, ®); - impl->surface->FillTriangle (impl->surface, - points[0].x, points[0].y, - points[1].x, points[1].y, - points[2].x, points[2].y); - - } - - temp_region_deinit( &clip ); - - return; - } - else - g_message ("filled polygons with n > 3 are not yet supported, " - "drawing outlines"); - } - - if (points[0].x != points[npoints-1].x || - points[0].y != points[npoints-1].y) - { - GdkPoint *tmp_points; - - tmp_points = g_new (GdkPoint, npoints + 1); - memcpy (tmp_points, points, npoints * sizeof (GdkPoint)); - tmp_points[npoints].x = points[0].x; - tmp_points[npoints].y = points[0].y; - - gdk_directfb_draw_lines (drawable, gc, tmp_points, npoints + 1); - - g_free (tmp_points); - } - else - { - gdk_directfb_draw_lines (drawable, gc, points, npoints); - } -} - -static void gdk_directfb_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkDrawable *src, @@ -973,7 +899,6 @@ gdk_drawable_impl_directfb_class_init (GdkDrawableImplDirectFBClass *klass) drawable_class->create_gc = _gdk_directfb_gc_new; drawable_class->draw_rectangle = gdk_directfb_draw_rectangle; - drawable_class->draw_polygon = gdk_directfb_draw_polygon; drawable_class->draw_drawable = gdk_directfb_draw_drawable; drawable_class->draw_points = gdk_directfb_draw_points; drawable_class->draw_segments = gdk_directfb_draw_segments; diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols index f62bf7f151..21604c8b4d 100644 --- a/gdk/gdk.symbols +++ b/gdk/gdk.symbols @@ -554,7 +554,6 @@ gdk_draw_line gdk_draw_lines gdk_draw_point gdk_draw_points -gdk_draw_polygon gdk_draw_rectangle gdk_draw_segments #endif diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c index 0a8532c54d..8181cc1a89 100644 --- a/gdk/gdkdraw.c +++ b/gdk/gdkdraw.c @@ -324,34 +324,6 @@ gdk_draw_rectangle (GdkDrawable *drawable, } /** - * gdk_draw_polygon: - * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap). - * @gc: a #GdkGC. - * @filled: %TRUE if the polygon should be filled. The polygon is closed - * automatically, connecting the last point to the first point if - * necessary. - * @points: an array of #GdkPoint structures specifying the points making - * up the polygon. - * @n_points: the number of points. - * - * Draws an outlined or filled polygon. - **/ -void -gdk_draw_polygon (GdkDrawable *drawable, - GdkGC *gc, - gboolean filled, - const GdkPoint *points, - gint n_points) -{ - g_return_if_fail (GDK_IS_DRAWABLE (drawable)); - g_return_if_fail (GDK_IS_GC (gc)); - - GDK_DRAWABLE_GET_CLASS (drawable)->draw_polygon (drawable, gc, filled, - (GdkPoint *) points, - n_points); -} - -/** * gdk_draw_drawable: * @drawable: a #GdkDrawable * @gc: a #GdkGC sharing the drawable's visual and colormap diff --git a/gdk/gdkdrawable.h b/gdk/gdkdrawable.h index 93d61c3e62..151152c053 100644 --- a/gdk/gdkdrawable.h +++ b/gdk/gdkdrawable.h @@ -67,11 +67,6 @@ struct _GdkDrawableClass gint y, gint width, gint height); - void (*draw_polygon) (GdkDrawable *drawable, - GdkGC *gc, - gboolean filled, - GdkPoint *points, - gint npoints); void (*draw_drawable) (GdkDrawable *drawable, GdkGC *gc, GdkDrawable *src, @@ -184,11 +179,6 @@ void gdk_draw_rectangle (GdkDrawable *drawable, gint y, gint width, gint height); -void gdk_draw_polygon (GdkDrawable *drawable, - GdkGC *gc, - gboolean filled, - const GdkPoint *points, - gint n_points); void gdk_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkDrawable *src, diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c index 91a4381946..9a21e0993e 100644 --- a/gdk/gdkoffscreenwindow.c +++ b/gdk/gdkoffscreenwindow.c @@ -324,43 +324,6 @@ gdk_offscreen_window_draw_rectangle (GdkDrawable *drawable, } static void -gdk_offscreen_window_draw_polygon (GdkDrawable *drawable, - GdkGC *gc, - gboolean filled, - GdkPoint *points, - gint npoints) -{ - GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable); - GdkDrawable *real_drawable = get_real_drawable (offscreen); - - gdk_draw_polygon (real_drawable, - gc, - filled, - points, - npoints); - - if (npoints > 0) - { - int min_x, min_y, max_x, max_y, i; - - min_x = max_x = points[0].x; - min_y = max_y = points[0].y; - - for (i = 1; i < npoints; i++) - { - min_x = MIN (min_x, points[i].x); - max_x = MAX (max_x, points[i].x); - min_y = MIN (min_y, points[i].y); - max_y = MAX (max_y, points[i].y); - } - - add_damage (offscreen, min_x, min_y, - max_x - min_x, - max_y - min_y, !filled); - } -} - -static void gdk_offscreen_window_draw_points (GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, @@ -1083,7 +1046,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass) drawable_class->get_composite_drawable = gdk_offscreen_window_get_composite_drawable; drawable_class->draw_rectangle = gdk_offscreen_window_draw_rectangle; - drawable_class->draw_polygon = gdk_offscreen_window_draw_polygon; drawable_class->draw_drawable_with_src = gdk_offscreen_window_draw_drawable; drawable_class->draw_points = gdk_offscreen_window_draw_points; drawable_class->draw_segments = gdk_offscreen_window_draw_segments; diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c index 6915cd7ee2..9d0465b561 100644 --- a/gdk/gdkpixmap.c +++ b/gdk/gdkpixmap.c @@ -41,11 +41,6 @@ static void gdk_pixmap_draw_rectangle (GdkDrawable *drawable, gint y, gint width, gint height); -static void gdk_pixmap_draw_polygon (GdkDrawable *drawable, - GdkGC *gc, - gboolean filled, - GdkPoint *points, - gint npoints); static void gdk_pixmap_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkPixmap *src, @@ -127,7 +122,6 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass) drawable_class->create_gc = gdk_pixmap_create_gc; drawable_class->draw_rectangle = gdk_pixmap_draw_rectangle; - drawable_class->draw_polygon = gdk_pixmap_draw_polygon; drawable_class->draw_drawable_with_src = gdk_pixmap_draw_drawable; drawable_class->draw_points = gdk_pixmap_draw_points; drawable_class->draw_segments = gdk_pixmap_draw_segments; @@ -227,19 +221,6 @@ gdk_pixmap_draw_rectangle (GdkDrawable *drawable, } static void -gdk_pixmap_draw_polygon (GdkDrawable *drawable, - GdkGC *gc, - gboolean filled, - GdkPoint *points, - gint npoints) -{ - GdkPixmapObject *private = (GdkPixmapObject *)drawable; - - _gdk_gc_remove_drawable_clip (gc); - gdk_draw_polygon (private->impl, gc, filled, points, npoints); -} - -static void gdk_pixmap_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkPixmap *src, diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 5be5f91c09..d6f2d72393 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -236,11 +236,6 @@ static void gdk_window_draw_rectangle (GdkDrawable *drawable, gint y, gint width, gint height); -static void gdk_window_draw_polygon (GdkDrawable *drawable, - GdkGC *gc, - gboolean filled, - GdkPoint *points, - gint npoints); static void gdk_window_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkPixmap *src, @@ -442,7 +437,6 @@ gdk_window_class_init (GdkWindowObjectClass *klass) drawable_class->create_gc = gdk_window_create_gc; drawable_class->draw_rectangle = gdk_window_draw_rectangle; - drawable_class->draw_polygon = gdk_window_draw_polygon; drawable_class->draw_drawable_with_src = gdk_window_draw_drawable; drawable_class->draw_points = gdk_window_draw_points; drawable_class->draw_segments = gdk_window_draw_segments; @@ -3937,42 +3931,6 @@ gdk_window_draw_rectangle (GdkDrawable *drawable, END_DRAW; } -static void -gdk_window_draw_polygon (GdkDrawable *drawable, - GdkGC *gc, - gboolean filled, - GdkPoint *points, - gint npoints) -{ - GdkPoint *new_points; - - if (GDK_WINDOW_DESTROYED (drawable)) - return; - - BEGIN_DRAW; - - if (x_offset != 0 || y_offset != 0) - { - int i; - - new_points = g_new (GdkPoint, npoints); - for (i=0; i<npoints; i++) - { - new_points[i].x = points[i].x - x_offset; - new_points[i].y = points[i].y - y_offset; - } - } - else - new_points = points; - - gdk_draw_polygon (impl, gc, filled, new_points, npoints); - - if (new_points != points) - g_free (new_points); - - END_DRAW; -} - static GdkDrawable * gdk_window_get_source_drawable (GdkDrawable *drawable) { diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c index 6c77bb4874..f7d365f047 100644 --- a/gdk/quartz/gdkdrawable-quartz.c +++ b/gdk/quartz/gdkdrawable-quartz.c @@ -185,46 +185,6 @@ gdk_quartz_draw_rectangle (GdkDrawable *drawable, } static void -gdk_quartz_draw_polygon (GdkDrawable *drawable, - GdkGC *gc, - gboolean filled, - GdkPoint *points, - gint npoints) -{ - CGContextRef context = gdk_quartz_drawable_get_context (drawable, FALSE); - int i; - - if (!context) - return; - - _gdk_quartz_gc_update_cg_context (gc, drawable, context, - filled ? - GDK_QUARTZ_CONTEXT_FILL : - GDK_QUARTZ_CONTEXT_STROKE); - - if (filled) - { - CGContextMoveToPoint (context, points[0].x, points[0].y); - for (i = 1; i < npoints; i++) - CGContextAddLineToPoint (context, points[i].x, points[i].y); - - CGContextClosePath (context); - CGContextFillPath (context); - } - else - { - CGContextMoveToPoint (context, points[0].x + 0.5, points[0].y + 0.5); - for (i = 1; i < npoints; i++) - CGContextAddLineToPoint (context, points[i].x + 0.5, points[i].y + 0.5); - - CGContextClosePath (context); - CGContextStrokePath (context); - } - - gdk_quartz_drawable_release_context (drawable, context); -} - -static void gdk_quartz_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkPixmap *src, @@ -455,7 +415,6 @@ gdk_drawable_impl_quartz_class_init (GdkDrawableImplQuartzClass *klass) drawable_class->create_gc = _gdk_quartz_gc_new; drawable_class->draw_rectangle = gdk_quartz_draw_rectangle; - drawable_class->draw_polygon = gdk_quartz_draw_polygon; drawable_class->draw_drawable_with_src = gdk_quartz_draw_drawable; drawable_class->draw_points = gdk_quartz_draw_points; drawable_class->draw_segments = gdk_quartz_draw_segments; diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index 72a01f65e4..4f6a562d41 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -55,11 +55,6 @@ static void gdk_win32_draw_rectangle (GdkDrawable *drawable, gint y, gint width, gint height); -static void gdk_win32_draw_polygon (GdkDrawable *drawable, - GdkGC *gc, - gboolean filled, - GdkPoint *points, - gint npoints); static void gdk_win32_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkPixmap *src, @@ -113,7 +108,6 @@ _gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass) drawable_class->create_gc = _gdk_win32_gc_new; drawable_class->draw_rectangle = gdk_win32_draw_rectangle; - drawable_class->draw_polygon = gdk_win32_draw_polygon; drawable_class->draw_drawable_with_src = gdk_win32_draw_drawable; drawable_class->draw_points = gdk_win32_draw_points; drawable_class->draw_segments = gdk_win32_draw_segments; @@ -773,91 +767,6 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable, } static void -draw_polygon (GdkGCWin32 *gcwin32, - HDC hdc, - gint x_offset, - gint y_offset, - va_list args) -{ - gboolean filled; - POINT *pts; - HGDIOBJ old_pen_or_brush; - gint npoints; - gint i; - - filled = va_arg (args, gboolean); - pts = va_arg (args, POINT *); - npoints = va_arg (args, gint); - - if (x_offset != 0 || y_offset != 0) - for (i = 0; i < npoints; i++) - { - pts[i].x -= x_offset; - pts[i].y -= y_offset; - } - - if (filled) - old_pen_or_brush = SelectObject (hdc, GetStockObject (NULL_PEN)); - else - old_pen_or_brush = SelectObject (hdc, GetStockObject (HOLLOW_BRUSH)); - if (old_pen_or_brush == NULL) - WIN32_GDI_FAILED ("SelectObject"); - GDI_CALL (Polygon, (hdc, pts, npoints)); - if (old_pen_or_brush != NULL) - GDI_CALL (SelectObject, (hdc, old_pen_or_brush)); -} - -static void -gdk_win32_draw_polygon (GdkDrawable *drawable, - GdkGC *gc, - gboolean filled, - GdkPoint *points, - gint npoints) -{ - GdkRectangle bounds; - cairo_region_t *region; - POINT *pts; - int i; - - GDK_NOTE (DRAW, g_print ("gdk_win32_draw_polygon: %s %d points\n", - _gdk_win32_drawable_description (drawable), - npoints)); - - if (npoints < 2) - return; - - bounds.x = G_MAXINT; - bounds.y = G_MAXINT; - bounds.width = 0; - bounds.height = 0; - - pts = g_new (POINT, npoints); - - for (i = 0; i < npoints; i++) - { - bounds.x = MIN (bounds.x, points[i].x); - bounds.y = MIN (bounds.y, points[i].y); - pts[i].x = points[i].x; - pts[i].y = points[i].y; - } - - for (i = 0; i < npoints; i++) - { - bounds.width = MAX (bounds.width, points[i].x - bounds.x); - bounds.height = MAX (bounds.height, points[i].y - bounds.y); - } - - region = widen_bounds (&bounds, GDK_GC_WIN32 (gc)->pen_width); - - generic_draw (drawable, gc, - GDK_GC_FOREGROUND | (filled ? 0 : LINE_ATTRIBUTES), - draw_polygon, region, filled, pts, npoints); - - cairo_region_destroy (region); - g_free (pts); -} - -static void gdk_win32_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkPixmap *src, diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c index be63bcc596..b156376061 100644 --- a/gdk/x11/gdkdrawable-x11.c +++ b/gdk/x11/gdkdrawable-x11.c @@ -55,11 +55,6 @@ static void gdk_x11_draw_rectangle (GdkDrawable *drawable, gint y, gint width, gint height); -static void gdk_x11_draw_polygon (GdkDrawable *drawable, - GdkGC *gc, - gboolean filled, - GdkPoint *points, - gint npoints); static void gdk_x11_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkPixmap *src, @@ -109,7 +104,6 @@ _gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass) drawable_class->create_gc = _gdk_x11_gc_new; drawable_class->draw_rectangle = gdk_x11_draw_rectangle; - drawable_class->draw_polygon = gdk_x11_draw_polygon; drawable_class->draw_drawable_with_src = gdk_x11_draw_drawable; drawable_class->draw_points = gdk_x11_draw_points; drawable_class->draw_segments = gdk_x11_draw_segments; @@ -331,50 +325,6 @@ gdk_x11_draw_rectangle (GdkDrawable *drawable, } static void -gdk_x11_draw_polygon (GdkDrawable *drawable, - GdkGC *gc, - gboolean filled, - GdkPoint *points, - gint npoints) -{ - XPoint *tmp_points; - gint tmp_npoints, i; - GdkDrawableImplX11 *impl; - - impl = GDK_DRAWABLE_IMPL_X11 (drawable); - - - if (!filled && - (points[0].x != points[npoints-1].x || points[0].y != points[npoints-1].y)) - { - tmp_npoints = npoints + 1; - tmp_points = g_new (XPoint, tmp_npoints); - tmp_points[npoints].x = points[0].x; - tmp_points[npoints].y = points[0].y; - } - else - { - tmp_npoints = npoints; - tmp_points = g_new (XPoint, tmp_npoints); - } - - for (i=0; i<npoints; i++) - { - tmp_points[i].x = points[i].x; - tmp_points[i].y = points[i].y; - } - - if (filled) - XFillPolygon (GDK_SCREEN_XDISPLAY (impl->screen), impl->xid, - GDK_GC_GET_XGC (gc), tmp_points, tmp_npoints, Complex, CoordModeOrigin); - else - XDrawLines (GDK_SCREEN_XDISPLAY (impl->screen), impl->xid, - GDK_GC_GET_XGC (gc), tmp_points, tmp_npoints, CoordModeOrigin); - - g_free (tmp_points); -} - -static void gdk_x11_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkPixmap *src, |