diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt index 413af2324d..b284d0eafc 100644 --- a/docs/reference/gdk/gdk3-sections.txt +++ b/docs/reference/gdk/gdk3-sections.txt @@ -336,10 +336,6 @@ gdk_drawable_get_visible_region gdk_draw_point gdk_draw_points -gdk_draw_line -gdk_draw_lines -gdk_draw_segments -GdkSegment gdk_draw_rectangle gdk_draw_layout_line gdk_draw_layout_line_with_colors diff --git a/docs/reference/gdk/tmpl/drawing.sgml b/docs/reference/gdk/tmpl/drawing.sgml index 19290892b4..25f5e13a6e 100644 --- a/docs/reference/gdk/tmpl/drawing.sgml +++ b/docs/reference/gdk/tmpl/drawing.sgml @@ -147,50 +147,6 @@ or a #GdkWindow. @n_points: - - - - -@drawable: -@gc: -@x1_: -@y1_: -@x2_: -@y2_: - - - - - - -@drawable: -@gc: -@points: -lines. -@n_points: - - - - - - -@drawable: -@gc: -@segs: -@n_segs: - - - - -Specifies the start and end point of a line for use by the gdk_draw_segments() -function. - - -@x1: the x coordinate of the start point. -@y1: the y coordinate of the start point. -@x2: the x coordinate of the end point. -@y2: the y coordinate of the end point. - diff --git a/gdk/directfb/gdkdrawable-directfb.c b/gdk/directfb/gdkdrawable-directfb.c index 87cfd71b08..e89bdc2e68 100644 --- a/gdk/directfb/gdkdrawable-directfb.c +++ b/gdk/directfb/gdkdrawable-directfb.c @@ -117,10 +117,6 @@ do {\ static GdkScreen * gdk_directfb_get_screen (GdkDrawable *drawable); static void gdk_drawable_impl_directfb_class_init (GdkDrawableImplDirectFBClass *klass); -static void gdk_directfb_draw_lines (GdkDrawable *drawable, - GdkGC *gc, - GdkPoint *points, - gint npoints); static cairo_surface_t *gdk_directfb_ref_cairo_surface (GdkDrawable *drawable); @@ -657,151 +653,6 @@ gdk_directfb_draw_points (GdkDrawable *drawable, temp_region_deinit( &clip ); } -static void -gdk_directfb_draw_segments (GdkDrawable *drawable, - GdkGC *gc, - GdkSegment *segs, - gint nsegs) -{ - GdkDrawableImplDirectFB *impl; - cairo_region_t clip; - gint i; - -// DFBRegion region = { segs->x1, segs->y1, segs->x2, segs->y2 }; - - D_DEBUG_AT( GDKDFB_Drawable, "%s( %p, %p, %p, %d )\n", G_STRFUNC, drawable, gc, segs, nsegs ); - - if (nsegs < 1) - return; - - 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->DrawLines (impl->surface, (DFBRegion *)segs, nsegs); - } - - temp_region_deinit( &clip ); - - /* everything below can be omitted if the drawing is buffered */ -/* if (impl->buffered) - return; - - if (region.x1 > region.x2) - { - region.x1 = segs->x2; - region.x2 = segs->x1; - } - if (region.y1 > region.y2) - { - region.y1 = segs->y2; - region.y2 = segs->y1; - } - - while (nsegs > 1) - { - nsegs--; - segs++; - - if (segs->x1 < region.x1) - region.x1 = segs->x1; - if (segs->x2 < region.x1) - region.x1 = segs->x2; - - if (segs->y1 < region.y1) - region.y1 = segs->y1; - if (segs->y2 < region.y1) - region.y1 = segs->y2; - - if (segs->x1 > region.x2) - region.x2 = segs->x1; - if (segs->x2 > region.x2) - region.x2 = segs->x2; - - if (segs->y1 > region.y2) - region.y2 = segs->y1; - if (segs->y2 > region.y2) - region.y2 = segs->y2; - }*/ -} - -static void -gdk_directfb_draw_lines (GdkDrawable *drawable, - GdkGC *gc, - GdkPoint *points, - gint npoints) -{ - GdkDrawableImplDirectFB *impl; - cairo_region_t clip; - gint i; - - DFBRegion lines[npoints > 1 ? npoints - 1 : 1]; - - DFBRegion region = { points->x, points->y, points->x, points->y }; - - D_DEBUG_AT( GDKDFB_Drawable, "%s( %p, %p, %p, %d )\n", G_STRFUNC, drawable, gc, points, npoints ); - - if (npoints < 2) - return; - - impl = GDK_DRAWABLE_IMPL_DIRECTFB (drawable); - - if (!gdk_directfb_setup_for_drawing (impl, GDK_GC_DIRECTFB (gc))) - return; - - /* create an array of DFBRegions so we can use DrawLines */ - - lines[0].x1 = points->x; - lines[0].y1 = points->y; - - for (i = 0; i < npoints - 2; i++) - { - points++; - - lines[i].x2 = lines[i+1].x1 = points->x; - lines[i].y2 = lines[i+1].y1 = points->y; - - if (points->x < region.x1) - region.x1 = points->x; - - if (points->y < region.y1) - region.y1 = points->y; - - if (points->x > region.x2) - region.x2 = points->x; - - if (points->y > region.y2) - region.y2 = points->y; - } - - points++; - lines[i].x2 = points->x; - lines[i].y2 = points->y; - - 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->DrawLines (impl->surface, lines, npoints - 1); - } - - temp_region_deinit( &clip ); -} - static inline void convert_rgba_pixbuf_to_image (guint32 *src, guint src_pitch, @@ -901,8 +752,6 @@ gdk_drawable_impl_directfb_class_init (GdkDrawableImplDirectFBClass *klass) drawable_class->draw_rectangle = gdk_directfb_draw_rectangle; drawable_class->draw_drawable = gdk_directfb_draw_drawable; drawable_class->draw_points = gdk_directfb_draw_points; - drawable_class->draw_segments = gdk_directfb_draw_segments; - drawable_class->draw_lines = gdk_directfb_draw_lines; drawable_class->ref_cairo_surface = gdk_directfb_ref_cairo_surface; drawable_class->set_colormap = gdk_directfb_set_colormap; diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols index 21604c8b4d..e0616c6bb7 100644 --- a/gdk/gdk.symbols +++ b/gdk/gdk.symbols @@ -550,12 +550,9 @@ gdk_drawable_get_visible_region gdk_drawable_get_visual gdk_drawable_set_colormap gdk_draw_drawable -gdk_draw_line -gdk_draw_lines gdk_draw_point gdk_draw_points gdk_draw_rectangle -gdk_draw_segments #endif #endif diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c index 8181cc1a89..832685abe7 100644 --- a/gdk/gdkdraw.c +++ b/gdk/gdkdraw.c @@ -241,38 +241,6 @@ gdk_draw_point (GdkDrawable *drawable, GDK_DRAWABLE_GET_CLASS (drawable)->draw_points (drawable, gc, &point, 1); } -/** - * gdk_draw_line: - * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap). - * @gc: a #GdkGC. - * @x1_: the x coordinate of the start point. - * @y1_: the y coordinate of the start point. - * @x2_: the x coordinate of the end point. - * @y2_: the y coordinate of the end point. - * - * Draws a line, using the foreground color and other attributes of - * the #GdkGC. - **/ -void -gdk_draw_line (GdkDrawable *drawable, - GdkGC *gc, - gint x1, - gint y1, - gint x2, - gint y2) -{ - GdkSegment segment; - - g_return_if_fail (GDK_IS_DRAWABLE (drawable)); - g_return_if_fail (GDK_IS_GC (gc)); - - segment.x1 = x1; - segment.y1 = y1; - segment.x2 = x2; - segment.y2 = y2; - GDK_DRAWABLE_GET_CLASS (drawable)->draw_segments (drawable, gc, &segment, 1); -} - /** * gdk_draw_rectangle: * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap). @@ -442,66 +410,6 @@ gdk_draw_points (GdkDrawable *drawable, (GdkPoint *) points, n_points); } -/** - * gdk_draw_segments: - * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap). - * @gc: a #GdkGC. - * @segs: an array of #GdkSegment structures specifying the start and - * end points of the lines to be drawn. - * @n_segs: the number of line segments to draw, i.e. the size of the - * @segs array. - * - * Draws a number of unconnected lines. - **/ -void -gdk_draw_segments (GdkDrawable *drawable, - GdkGC *gc, - const GdkSegment *segs, - gint n_segs) -{ - g_return_if_fail (GDK_IS_DRAWABLE (drawable)); - - if (n_segs == 0) - return; - - g_return_if_fail (segs != NULL); - g_return_if_fail (GDK_IS_GC (gc)); - g_return_if_fail (n_segs >= 0); - - GDK_DRAWABLE_GET_CLASS (drawable)->draw_segments (drawable, gc, - (GdkSegment *) segs, n_segs); -} - -/** - * gdk_draw_lines: - * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap). - * @gc: a #GdkGC. - * @points: an array of #GdkPoint structures specifying the endpoints of the - * @n_points: the size of the @points array. - * - * Draws a series of lines connecting the given points. - * The way in which joins between lines are draw is determined by the - * #GdkCapStyle value in the #GdkGC. This can be set with - * gdk_gc_set_line_attributes(). - **/ -void -gdk_draw_lines (GdkDrawable *drawable, - GdkGC *gc, - const GdkPoint *points, - gint n_points) -{ - g_return_if_fail (GDK_IS_DRAWABLE (drawable)); - g_return_if_fail (points != NULL); - g_return_if_fail (GDK_IS_GC (gc)); - g_return_if_fail (n_points >= 0); - - if (n_points == 0) - return; - - GDK_DRAWABLE_GET_CLASS (drawable)->draw_lines (drawable, gc, - (GdkPoint *) points, n_points); -} - static GdkDrawable * gdk_drawable_real_get_composite_drawable (GdkDrawable *drawable, gint x, diff --git a/gdk/gdkdrawable.h b/gdk/gdkdrawable.h index 151152c053..c0d88f2271 100644 --- a/gdk/gdkdrawable.h +++ b/gdk/gdkdrawable.h @@ -80,14 +80,6 @@ struct _GdkDrawableClass GdkGC *gc, GdkPoint *points, gint npoints); - void (*draw_segments) (GdkDrawable *drawable, - GdkGC *gc, - GdkSegment *segs, - gint nsegs); - void (*draw_lines) (GdkDrawable *drawable, - GdkGC *gc, - GdkPoint *points, - gint npoints); gint (*get_depth) (GdkDrawable *drawable); void (*get_size) (GdkDrawable *drawable, @@ -166,12 +158,6 @@ void gdk_draw_point (GdkDrawable *drawable, GdkGC *gc, gint x, gint y); -void gdk_draw_line (GdkDrawable *drawable, - GdkGC *gc, - gint x1_, - gint y1_, - gint x2_, - gint y2_); void gdk_draw_rectangle (GdkDrawable *drawable, GdkGC *gc, gboolean filled, @@ -192,14 +178,6 @@ void gdk_draw_points (GdkDrawable *drawable, GdkGC *gc, const GdkPoint *points, gint n_points); -void gdk_draw_segments (GdkDrawable *drawable, - GdkGC *gc, - const GdkSegment *segs, - gint n_segs); -void gdk_draw_lines (GdkDrawable *drawable, - GdkGC *gc, - const GdkPoint *points, - gint n_points); void gdk_draw_layout_line (GdkDrawable *drawable, GdkGC *gc, diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c index 9a21e0993e..2ee6f9ec27 100644 --- a/gdk/gdkoffscreenwindow.c +++ b/gdk/gdkoffscreenwindow.c @@ -360,67 +360,6 @@ gdk_offscreen_window_draw_points (GdkDrawable *drawable, } } -static void -gdk_offscreen_window_draw_segments (GdkDrawable *drawable, - GdkGC *gc, - GdkSegment *segs, - gint nsegs) -{ - GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable); - GdkDrawable *real_drawable = get_real_drawable (offscreen); - - gdk_draw_segments (real_drawable, - gc, - segs, - nsegs); - - if (nsegs > 0) - { - int min_x, min_y, max_x, max_y, i; - - min_x = max_x = segs[0].x1; - min_y = max_y = segs[0].y1; - - for (i = 0; i < nsegs; i++) - { - min_x = MIN (min_x, segs[i].x1); - max_x = MAX (max_x, segs[i].x1); - min_x = MIN (min_x, segs[i].x2); - max_x = MAX (max_x, segs[i].x2); - min_y = MIN (min_y, segs[i].y1); - max_y = MAX (max_y, segs[i].y1); - min_y = MIN (min_y, segs[i].y2); - max_y = MAX (max_y, segs[i].y2); - } - - add_damage (offscreen, min_x, min_y, - max_x - min_x, - max_y - min_y, TRUE); - } - -} - -static void -gdk_offscreen_window_draw_lines (GdkDrawable *drawable, - GdkGC *gc, - GdkPoint *points, - gint npoints) -{ - GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable); - GdkDrawable *real_drawable = get_real_drawable (offscreen); - GdkWindowObject *private = GDK_WINDOW_OBJECT (offscreen->wrapper); - - gdk_draw_lines (real_drawable, - gc, - points, - npoints); - - /* Hard to compute the minimal size, as we don't know the line - width, and since joins are hard to calculate. - Its not that often used anyway, damage it all */ - add_damage (offscreen, 0, 0, private->width, private->height, TRUE); -} - void _gdk_offscreen_window_new (GdkWindow *window, GdkScreen *screen, @@ -1048,8 +987,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass) drawable_class->draw_rectangle = gdk_offscreen_window_draw_rectangle; 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; - drawable_class->draw_lines = gdk_offscreen_window_draw_lines; } static void diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c index 9d0465b561..3df695be29 100644 --- a/gdk/gdkpixmap.c +++ b/gdk/gdkpixmap.c @@ -55,14 +55,6 @@ static void gdk_pixmap_draw_points (GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints); -static void gdk_pixmap_draw_segments (GdkDrawable *drawable, - GdkGC *gc, - GdkSegment *segs, - gint nsegs); -static void gdk_pixmap_draw_lines (GdkDrawable *drawable, - GdkGC *gc, - GdkPoint *points, - gint npoints); static void gdk_pixmap_real_get_size (GdkDrawable *drawable, gint *width, @@ -124,8 +116,6 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass) drawable_class->draw_rectangle = gdk_pixmap_draw_rectangle; 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; - drawable_class->draw_lines = gdk_pixmap_draw_lines; drawable_class->get_depth = gdk_pixmap_real_get_depth; drawable_class->get_screen = gdk_pixmap_real_get_screen; drawable_class->get_size = gdk_pixmap_real_get_size; @@ -256,30 +246,6 @@ gdk_pixmap_draw_points (GdkDrawable *drawable, gdk_draw_points (private->impl, gc, points, npoints); } -static void -gdk_pixmap_draw_segments (GdkDrawable *drawable, - GdkGC *gc, - GdkSegment *segs, - gint nsegs) -{ - GdkPixmapObject *private = (GdkPixmapObject *)drawable; - - _gdk_gc_remove_drawable_clip (gc); - gdk_draw_segments (private->impl, gc, segs, nsegs); -} - -static void -gdk_pixmap_draw_lines (GdkDrawable *drawable, - GdkGC *gc, - GdkPoint *points, - gint npoints) -{ - GdkPixmapObject *private = (GdkPixmapObject *)drawable; - - _gdk_gc_remove_drawable_clip (gc); - gdk_draw_lines (private->impl, gc, points, npoints); -} - static void gdk_pixmap_real_get_size (GdkDrawable *drawable, gint *width, diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h index aaba5898bf..b86cecc8ce 100644 --- a/gdk/gdktypes.h +++ b/gdk/gdktypes.h @@ -75,7 +75,6 @@ G_BEGIN_DECLS */ typedef struct _GdkPoint GdkPoint; typedef cairo_rectangle_int_t GdkRectangle; -typedef struct _GdkSegment GdkSegment; typedef struct _GdkSpan GdkSpan; typedef struct _GdkAtom *GdkAtom; @@ -270,14 +269,6 @@ struct _GdkPoint gint y; }; -struct _GdkSegment -{ - gint x1; - gint y1; - gint x2; - gint y2; -}; - struct _GdkSpan { gint x; diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index d6f2d72393..0178c2dbe3 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -250,14 +250,6 @@ static void gdk_window_draw_points (GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints); -static void gdk_window_draw_segments (GdkDrawable *drawable, - GdkGC *gc, - GdkSegment *segs, - gint nsegs); -static void gdk_window_draw_lines (GdkDrawable *drawable, - GdkGC *gc, - GdkPoint *points, - gint npoints); static cairo_surface_t *gdk_window_ref_cairo_surface (GdkDrawable *drawable); static cairo_surface_t *gdk_window_create_cairo_surface (GdkDrawable *drawable, @@ -439,8 +431,6 @@ gdk_window_class_init (GdkWindowObjectClass *klass) drawable_class->draw_rectangle = gdk_window_draw_rectangle; 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; - drawable_class->draw_lines = gdk_window_draw_lines; drawable_class->get_depth = gdk_window_real_get_depth; drawable_class->get_screen = gdk_window_real_get_screen; drawable_class->get_size = gdk_window_real_get_size; @@ -4239,78 +4229,6 @@ gdk_window_draw_points (GdkDrawable *drawable, END_DRAW; } -static void -gdk_window_draw_segments (GdkDrawable *drawable, - GdkGC *gc, - GdkSegment *segs, - gint nsegs) -{ - GdkSegment *new_segs; - - if (GDK_WINDOW_DESTROYED (drawable)) - return; - - BEGIN_DRAW; - - if (x_offset != 0 || y_offset != 0) - { - gint i; - - new_segs = g_new (GdkSegment, nsegs); - for (i=0; idraw_rectangle = gdk_quartz_draw_rectangle; 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; - drawable_class->draw_lines = gdk_quartz_draw_lines; drawable_class->ref_cairo_surface = gdk_quartz_ref_cairo_surface; diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index 4f6a562d41..b0a730b061 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -69,14 +69,6 @@ static void gdk_win32_draw_points (GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints); -static void gdk_win32_draw_segments (GdkDrawable *drawable, - GdkGC *gc, - GdkSegment *segs, - gint nsegs); -static void gdk_win32_draw_lines (GdkDrawable *drawable, - GdkGC *gc, - GdkPoint *points, - gint npoints); static cairo_surface_t *gdk_win32_ref_cairo_surface (GdkDrawable *drawable); @@ -110,8 +102,6 @@ _gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass) drawable_class->draw_rectangle = gdk_win32_draw_rectangle; 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; - drawable_class->draw_lines = gdk_win32_draw_lines; drawable_class->ref_cairo_surface = gdk_win32_ref_cairo_surface; @@ -816,229 +806,6 @@ gdk_win32_draw_points (GdkDrawable *drawable, gdk_win32_hdc_release (drawable, gc, GDK_GC_FOREGROUND); } -static void -draw_segments (GdkGCWin32 *gcwin32, - HDC hdc, - gint x_offset, - gint y_offset, - va_list args) -{ - GdkSegment *segs; - gint nsegs; - gint i; - - segs = va_arg (args, GdkSegment *); - nsegs = va_arg (args, gint); - - if (x_offset != 0 || y_offset != 0) - { - /* must not modify in place, but could splice in the offset all below */ - segs = g_memdup (segs, nsegs * sizeof (GdkSegment)); - for (i = 0; i < nsegs; i++) - { - segs[i].x1 -= x_offset; - segs[i].y1 -= y_offset; - segs[i].x2 -= x_offset; - segs[i].y2 -= y_offset; - } - } - - if (MUST_RENDER_DASHES_MANUALLY (gcwin32)) - { - for (i = 0; i < nsegs; i++) - { - if (segs[i].x1 == segs[i].x2) - { - int y1, y2; - - if (segs[i].y1 <= segs[i].y2) - y1 = segs[i].y1, y2 = segs[i].y2; - else - y1 = segs[i].y2, y2 = segs[i].y1; - - render_line_vertical (gcwin32, segs[i].x1, y1, y2); - } - else if (segs[i].y1 == segs[i].y2) - { - int x1, x2; - - if (segs[i].x1 <= segs[i].x2) - x1 = segs[i].x1, x2 = segs[i].x2; - else - x1 = segs[i].x2, x2 = segs[i].x1; - - render_line_horizontal (gcwin32, x1, x2, segs[i].y1); - } - else - GDI_CALL (MoveToEx, (hdc, segs[i].x1, segs[i].y1, NULL)) && - GDI_CALL (LineTo, (hdc, segs[i].x2, segs[i].y2)); - } - } - else - { - for (i = 0; i < nsegs; i++) - { - const GdkSegment *ps = &segs[i]; - const int x1 = ps->x1, y1 = ps->y1; - int x2 = ps->x2, y2 = ps->y2; - - GDK_NOTE (DRAW, g_print (" +%d+%d..+%d+%d", x1, y1, x2, y2)); - GDI_CALL (MoveToEx, (hdc, x1, y1, NULL)) && - GDI_CALL (LineTo, (hdc, x2, y2)); - } - - GDK_NOTE (DRAW, g_print ("\n")); - } - if (x_offset != 0 || y_offset != 0) - g_free (segs); -} - -static void -gdk_win32_draw_segments (GdkDrawable *drawable, - GdkGC *gc, - GdkSegment *segs, - gint nsegs) -{ - GdkRectangle bounds; - cairo_region_t *region; - gint i; - - GDK_NOTE (DRAW, g_print ("gdk_win32_draw_segments: %s %d segs\n", - _gdk_win32_drawable_description (drawable), - nsegs)); - - bounds.x = G_MAXINT; - bounds.y = G_MAXINT; - bounds.width = 0; - bounds.height = 0; - - for (i = 0; i < nsegs; i++) - { - bounds.x = MIN (bounds.x, segs[i].x1); - bounds.x = MIN (bounds.x, segs[i].x2); - bounds.y = MIN (bounds.y, segs[i].y1); - bounds.y = MIN (bounds.y, segs[i].y2); - } - - for (i = 0; i < nsegs; i++) - { - bounds.width = MAX (bounds.width, segs[i].x1 - bounds.x); - bounds.width = MAX (bounds.width, segs[i].x2 - bounds.x); - bounds.height = MAX (bounds.height, segs[i].y1 - bounds.y); - bounds.height = MAX (bounds.height, segs[i].y2 - bounds.y); - } - - region = widen_bounds (&bounds, GDK_GC_WIN32 (gc)->pen_width); - - generic_draw (drawable, gc, GDK_GC_FOREGROUND | LINE_ATTRIBUTES, - draw_segments, region, segs, nsegs); - - cairo_region_destroy (region); -} - -static void -draw_lines (GdkGCWin32 *gcwin32, - HDC hdc, - gint x_offset, - gint y_offset, - va_list args) -{ - POINT *pts; - gint npoints; - gint i; - - 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 (MUST_RENDER_DASHES_MANUALLY (gcwin32)) - { - for (i = 0; i < npoints - 1; i++) - { - if (pts[i].x == pts[i+1].x) - { - int y1, y2; - if (pts[i].y > pts[i+1].y) - y1 = pts[i+1].y, y2 = pts[i].y; - else - y1 = pts[i].y, y2 = pts[i+1].y; - - render_line_vertical (gcwin32, pts[i].x, y1, y2); - } - else if (pts[i].y == pts[i+1].y) - { - int x1, x2; - if (pts[i].x > pts[i+1].x) - x1 = pts[i+1].x, x2 = pts[i].x; - else - x1 = pts[i].x, x2 = pts[i+1].x; - - render_line_horizontal (gcwin32, x1, x2, pts[i].y); - } - else - GDI_CALL (MoveToEx, (hdc, pts[i].x, pts[i].y, NULL)) && - GDI_CALL (LineTo, (hdc, pts[i+1].x, pts[i+1].y)); - } - } - else - GDI_CALL (Polyline, (hdc, pts, npoints)); -} - -static void -gdk_win32_draw_lines (GdkDrawable *drawable, - GdkGC *gc, - GdkPoint *points, - gint npoints) -{ - GdkRectangle bounds; - cairo_region_t *region; - POINT *pts; - int i; - - GDK_NOTE (DRAW, g_print ("gdk_win32_draw_lines: %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 | GDK_GC_BACKGROUND | - LINE_ATTRIBUTES, - draw_lines, region, pts, npoints); - - cairo_region_destroy (region); - g_free (pts); -} - static void blit_from_pixmap (gboolean use_fg_bg, GdkDrawableImplWin32 *dest, diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c index b156376061..4261c6f9be 100644 --- a/gdk/x11/gdkdrawable-x11.c +++ b/gdk/x11/gdkdrawable-x11.c @@ -69,14 +69,6 @@ static void gdk_x11_draw_points (GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints); -static void gdk_x11_draw_segments (GdkDrawable *drawable, - GdkGC *gc, - GdkSegment *segs, - gint nsegs); -static void gdk_x11_draw_lines (GdkDrawable *drawable, - GdkGC *gc, - GdkPoint *points, - gint npoints); static cairo_surface_t *gdk_x11_ref_cairo_surface (GdkDrawable *drawable); @@ -106,8 +98,6 @@ _gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass) drawable_class->draw_rectangle = gdk_x11_draw_rectangle; 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; - drawable_class->draw_lines = gdk_x11_draw_lines; drawable_class->ref_cairo_surface = gdk_x11_ref_cairo_surface; @@ -453,76 +443,6 @@ gdk_x11_draw_points (GdkDrawable *drawable, } } -static void -gdk_x11_draw_segments (GdkDrawable *drawable, - GdkGC *gc, - GdkSegment *segs, - gint nsegs) -{ - GdkDrawableImplX11 *impl; - - impl = GDK_DRAWABLE_IMPL_X11 (drawable); - - - /* We special-case nsegs == 1, because X will merge multiple - * consecutive XDrawLine requests into a PolySegment request - */ - if (nsegs == 1) - { - XDrawLine (GDK_SCREEN_XDISPLAY (impl->screen), impl->xid, - GDK_GC_GET_XGC (gc), segs[0].x1, segs[0].y1, - segs[0].x2, segs[0].y2); - } - else - { - gint i; - XSegment *tmp_segs = g_new (XSegment, nsegs); - - for (i=0; iscreen), - impl->xid, - GDK_GC_GET_XGC (gc), - tmp_segs, nsegs); - - g_free (tmp_segs); - } -} - -static void -gdk_x11_draw_lines (GdkDrawable *drawable, - GdkGC *gc, - GdkPoint *points, - gint npoints) -{ - gint i; - XPoint *tmp_points = g_new (XPoint, npoints); - GdkDrawableImplX11 *impl; - - impl = GDK_DRAWABLE_IMPL_X11 (drawable); - - - for (i=0; iscreen), - impl->xid, - GDK_GC_GET_XGC (gc), - tmp_points, npoints, - CoordModeOrigin); - - g_free (tmp_points); -} - static gint gdk_x11_get_depth (GdkDrawable *drawable) {