mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 19:00:08 +00:00
API: remove gdk_draw_image()
This commit is contained in:
parent
d18abf42b7
commit
b926ce719b
@ -392,7 +392,6 @@ gdk_draw_layout_with_colors
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_draw_drawable
|
||||
gdk_draw_image
|
||||
gdk_drawable_get_image
|
||||
gdk_drawable_copy_to_image
|
||||
|
||||
|
@ -354,21 +354,6 @@ bottom edges.
|
||||
@height:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_draw_image ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@drawable:
|
||||
@gc:
|
||||
@image:
|
||||
@xsrc:
|
||||
@ysrc:
|
||||
@xdest:
|
||||
@ydest:
|
||||
@width:
|
||||
@height:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_drawable_get_image ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -890,66 +890,6 @@ gdk_directfb_draw_lines (GdkDrawable *drawable,
|
||||
temp_region_deinit( &clip );
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_directfb_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkDrawableImplDirectFB *impl;
|
||||
GdkImageDirectFB *image_private;
|
||||
cairo_region_t clip;
|
||||
GdkRectangle dest_rect = { xdest, ydest, width, height };
|
||||
|
||||
gint pitch = 0;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
|
||||
g_return_if_fail (image != NULL);
|
||||
|
||||
D_DEBUG_AT( GDKDFB_Drawable, "%s( %p, %p, %p, %4d,%4d -> %4d,%4d - %dx%d )\n", G_STRFUNC,
|
||||
drawable, gc, image, xsrc, ysrc, xdest, ydest, width, height );
|
||||
|
||||
impl = GDK_DRAWABLE_IMPL_DIRECTFB (drawable);
|
||||
image_private = image->windowing_data;
|
||||
|
||||
if (!impl->surface)
|
||||
return;
|
||||
|
||||
gdk_directfb_clip_region (drawable, gc, &dest_rect, &clip);
|
||||
|
||||
if (!cairo_region_is_empty (&clip))
|
||||
{
|
||||
DFBRectangle src_rect = { xsrc, ysrc, width, height };
|
||||
|
||||
image_private->surface->Unlock (image_private->surface);
|
||||
|
||||
impl->surface->SetBlittingFlags (impl->surface, DSBLIT_NOFX);
|
||||
|
||||
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->Blit (impl->surface,
|
||||
image_private->surface, &src_rect,
|
||||
xdest, ydest);
|
||||
}
|
||||
|
||||
image_private->surface->Lock (image_private->surface, DSLF_WRITE,
|
||||
&image->mem, &pitch);
|
||||
image->bpl = pitch;
|
||||
}
|
||||
|
||||
temp_region_deinit( &clip );
|
||||
}
|
||||
|
||||
static inline void
|
||||
convert_rgba_pixbuf_to_image (guint32 *src,
|
||||
guint src_pitch,
|
||||
@ -1053,7 +993,6 @@ gdk_drawable_impl_directfb_class_init (GdkDrawableImplDirectFBClass *klass)
|
||||
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->draw_image = gdk_directfb_draw_image;
|
||||
|
||||
drawable_class->ref_cairo_surface = gdk_directfb_ref_cairo_surface;
|
||||
drawable_class->set_colormap = gdk_directfb_set_colormap;
|
||||
|
@ -556,7 +556,6 @@ gdk_draw_arc
|
||||
gdk_draw_drawable
|
||||
gdk_draw_glyphs
|
||||
gdk_draw_glyphs_transformed
|
||||
gdk_draw_image
|
||||
gdk_draw_line
|
||||
gdk_draw_lines
|
||||
gdk_draw_point
|
||||
|
@ -497,47 +497,6 @@ gdk_draw_drawable (GdkDrawable *drawable,
|
||||
g_object_unref (composite);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_draw_image:
|
||||
* @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
|
||||
* @gc: a #GdkGC.
|
||||
* @image: the #GdkImage to draw.
|
||||
* @xsrc: the left edge of the source rectangle within @image.
|
||||
* @ysrc: the top of the source rectangle within @image.
|
||||
* @xdest: the x coordinate of the destination within @drawable.
|
||||
* @ydest: the y coordinate of the destination within @drawable.
|
||||
* @width: the width of the area to be copied, or -1 to make the area
|
||||
* extend to the right edge of @image.
|
||||
* @height: the height of the area to be copied, or -1 to make the area
|
||||
* extend to the bottom edge of @image.
|
||||
*
|
||||
* Draws a #GdkImage onto a drawable.
|
||||
* The depth of the #GdkImage must match the depth of the #GdkDrawable.
|
||||
**/
|
||||
void
|
||||
gdk_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
|
||||
g_return_if_fail (GDK_IS_IMAGE (image));
|
||||
g_return_if_fail (GDK_IS_GC (gc));
|
||||
|
||||
if (width == -1)
|
||||
width = image->width;
|
||||
if (height == -1)
|
||||
height = image->height;
|
||||
|
||||
GDK_DRAWABLE_GET_CLASS (drawable)->draw_image (drawable, gc, image, xsrc, ysrc,
|
||||
xdest, ydest, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_draw_points:
|
||||
* @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
|
||||
|
@ -111,16 +111,6 @@ struct _GdkDrawableClass
|
||||
gint y,
|
||||
PangoGlyphString *glyphs);
|
||||
|
||||
void (*draw_image) (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
gint (*get_depth) (GdkDrawable *drawable);
|
||||
void (*get_size) (GdkDrawable *drawable,
|
||||
gint *width,
|
||||
@ -266,15 +256,6 @@ void gdk_draw_drawable (GdkDrawable *drawable,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_draw_points (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
const GdkPoint *points,
|
||||
|
@ -504,33 +504,6 @@ gdk_offscreen_window_draw_lines (GdkDrawable *drawable,
|
||||
add_damage (offscreen, 0, 0, private->width, private->height, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_offscreen_window_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
|
||||
GdkDrawable *real_drawable = get_real_drawable (offscreen);
|
||||
|
||||
gdk_draw_image (real_drawable,
|
||||
gc,
|
||||
image,
|
||||
xsrc,
|
||||
ysrc,
|
||||
xdest,
|
||||
ydest,
|
||||
width,
|
||||
height);
|
||||
|
||||
add_damage (offscreen, xdest, ydest, width, height, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_offscreen_window_new (GdkWindow *window,
|
||||
GdkScreen *screen,
|
||||
@ -1163,7 +1136,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
|
||||
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;
|
||||
drawable_class->draw_image = gdk_offscreen_window_draw_image;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -92,15 +92,6 @@ static void gdk_pixmap_draw_glyphs_transformed (GdkDrawable *drawable,
|
||||
gint y,
|
||||
PangoGlyphString *glyphs);
|
||||
|
||||
static void gdk_pixmap_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
static void gdk_pixmap_draw_trapezoids (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkTrapezoid *trapezoids,
|
||||
@ -181,7 +172,6 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass)
|
||||
drawable_class->draw_lines = gdk_pixmap_draw_lines;
|
||||
drawable_class->draw_glyphs = gdk_pixmap_draw_glyphs;
|
||||
drawable_class->draw_glyphs_transformed = gdk_pixmap_draw_glyphs_transformed;
|
||||
drawable_class->draw_image = gdk_pixmap_draw_image;
|
||||
drawable_class->draw_trapezoids = gdk_pixmap_draw_trapezoids;
|
||||
drawable_class->get_depth = gdk_pixmap_real_get_depth;
|
||||
drawable_class->get_screen = gdk_pixmap_real_get_screen;
|
||||
@ -399,24 +389,6 @@ gdk_pixmap_draw_glyphs_transformed (GdkDrawable *drawable,
|
||||
gdk_draw_glyphs_transformed (private->impl, gc, matrix, font, x, y, glyphs);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixmap_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
|
||||
|
||||
_gdk_gc_remove_drawable_clip (gc);
|
||||
gdk_draw_image (private->impl, gc, image, xsrc, ysrc, xdest, ydest,
|
||||
width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixmap_draw_trapezoids (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
|
@ -287,16 +287,6 @@ static void gdk_window_draw_glyphs_transformed (GdkDrawable *drawable,
|
||||
gint y,
|
||||
PangoGlyphString *glyphs);
|
||||
|
||||
static void gdk_window_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
static void gdk_window_draw_trapezoids (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkTrapezoid *trapezoids,
|
||||
@ -497,7 +487,6 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
|
||||
drawable_class->draw_lines = gdk_window_draw_lines;
|
||||
drawable_class->draw_glyphs = gdk_window_draw_glyphs;
|
||||
drawable_class->draw_glyphs_transformed = gdk_window_draw_glyphs_transformed;
|
||||
drawable_class->draw_image = gdk_window_draw_image;
|
||||
drawable_class->draw_trapezoids = gdk_window_draw_trapezoids;
|
||||
drawable_class->get_depth = gdk_window_real_get_depth;
|
||||
drawable_class->get_screen = gdk_window_real_get_screen;
|
||||
@ -4814,27 +4803,6 @@ gdk_window_clear_area_e (GdkWindow *window,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
if (GDK_WINDOW_DESTROYED (drawable))
|
||||
return;
|
||||
|
||||
BEGIN_DRAW;
|
||||
gdk_draw_image (impl, gc, image, xsrc, ysrc,
|
||||
xdest - x_offset, ydest - y_offset,
|
||||
width, height);
|
||||
END_DRAW;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_draw_trapezoids (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
|
@ -506,52 +506,6 @@ gdk_quartz_draw_lines (GdkDrawable *drawable,
|
||||
gdk_quartz_drawable_release_context (drawable, context);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
CGContextRef context = gdk_quartz_drawable_get_context (drawable, FALSE);
|
||||
CGColorSpaceRef colorspace;
|
||||
CGDataProviderRef data_provider;
|
||||
CGImageRef cgimage;
|
||||
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
colorspace = CGColorSpaceCreateDeviceRGB ();
|
||||
data_provider = CGDataProviderCreateWithData (NULL, image->mem, image->height * image->bpl, NULL);
|
||||
|
||||
/* FIXME: Make sure that this function draws 32-bit images correctly,
|
||||
* also check endianness wrt kCGImageAlphaNoneSkipFirst */
|
||||
cgimage = CGImageCreate (image->width, image->height, 8,
|
||||
32, image->bpl,
|
||||
colorspace,
|
||||
kCGImageAlphaNoneSkipFirst,
|
||||
data_provider, NULL, FALSE, kCGRenderingIntentDefault);
|
||||
|
||||
CGDataProviderRelease (data_provider);
|
||||
CGColorSpaceRelease (colorspace);
|
||||
|
||||
_gdk_quartz_gc_update_cg_context (gc, drawable, context,
|
||||
GDK_QUARTZ_CONTEXT_STROKE);
|
||||
|
||||
CGContextClipToRect (context, CGRectMake (xdest, ydest, width, height));
|
||||
CGContextTranslateCTM (context, xdest - xsrc, ydest - ysrc + image->height);
|
||||
CGContextScaleCTM (context, 1, -1);
|
||||
|
||||
CGContextDrawImage (context, CGRectMake (0, 0, image->width, image->height), cgimage);
|
||||
CGImageRelease (cgimage);
|
||||
|
||||
gdk_quartz_drawable_release_context (drawable, context);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drawable_impl_quartz_finalize (GObject *object)
|
||||
{
|
||||
@ -581,7 +535,6 @@ gdk_drawable_impl_quartz_class_init (GdkDrawableImplQuartzClass *klass)
|
||||
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->draw_image = gdk_quartz_draw_image;
|
||||
|
||||
drawable_class->ref_cairo_surface = gdk_quartz_ref_cairo_surface;
|
||||
|
||||
|
@ -91,15 +91,6 @@ static void gdk_win32_draw_lines (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPoint *points,
|
||||
gint npoints);
|
||||
static void gdk_win32_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
static cairo_surface_t *gdk_win32_ref_cairo_surface (GdkDrawable *drawable);
|
||||
|
||||
@ -137,7 +128,6 @@ _gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass)
|
||||
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->draw_image = gdk_win32_draw_image;
|
||||
|
||||
drawable_class->ref_cairo_surface = gdk_win32_ref_cairo_surface;
|
||||
|
||||
@ -1603,24 +1593,6 @@ _gdk_win32_blit (gboolean use_fg_bg,
|
||||
gdk_win32_hdc_release (&draw_impl->parent_instance, gc, GDK_GC_FOREGROUND);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
g_assert (GDK_IS_DRAWABLE_IMPL_WIN32 (drawable));
|
||||
|
||||
_gdk_win32_blit (TRUE, (GdkDrawableImplWin32 *) drawable,
|
||||
gc, (GdkPixmap *) image->windowing_data,
|
||||
xsrc, ysrc, xdest, ydest, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* _gdk_win32_drawable_acquire_dc
|
||||
* @drawable: a Win32 #GdkDrawable implementation
|
||||
|
@ -92,16 +92,6 @@ static void gdk_x11_draw_lines (GdkDrawable *drawable,
|
||||
GdkPoint *points,
|
||||
gint npoints);
|
||||
|
||||
static void gdk_x11_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
static cairo_surface_t *gdk_x11_ref_cairo_surface (GdkDrawable *drawable);
|
||||
|
||||
static void gdk_x11_set_colormap (GdkDrawable *drawable,
|
||||
@ -134,7 +124,6 @@ _gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass)
|
||||
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->draw_image = gdk_x11_draw_image;
|
||||
|
||||
drawable_class->ref_cairo_surface = gdk_x11_ref_cairo_surface;
|
||||
|
||||
@ -620,33 +609,6 @@ gdk_x11_draw_lines (GdkDrawable *drawable,
|
||||
g_free (tmp_points);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkDrawableImplX11 *impl;
|
||||
|
||||
impl = GDK_DRAWABLE_IMPL_X11 (drawable);
|
||||
|
||||
#ifdef USE_SHM
|
||||
if (image->type == GDK_IMAGE_SHARED)
|
||||
XShmPutImage (GDK_SCREEN_XDISPLAY (impl->screen), impl->xid,
|
||||
GDK_GC_GET_XGC (gc), GDK_IMAGE_XIMAGE (image),
|
||||
xsrc, ysrc, xdest, ydest, width, height, False);
|
||||
else
|
||||
#endif
|
||||
XPutImage (GDK_SCREEN_XDISPLAY (impl->screen), impl->xid,
|
||||
GDK_GC_GET_XGC (gc), GDK_IMAGE_XIMAGE (image),
|
||||
xsrc, ysrc, xdest, ydest, width, height);
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_x11_get_depth (GdkDrawable *drawable)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user