forked from AuroraMiddleware/gtk
API: remove gdk_draw_drawable()
This commit is contained in:
parent
0cef9c2bbe
commit
61d4a019f8
@ -333,9 +333,6 @@ gdk_drawable_get_size
|
||||
gdk_drawable_get_clip_region
|
||||
gdk_drawable_get_visible_region
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_draw_drawable
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_DRAWABLE
|
||||
GDK_DRAWABLE_GET_CLASS
|
||||
|
@ -127,19 +127,3 @@ or a #GdkWindow.
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_draw_drawable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@drawable:
|
||||
@gc:
|
||||
@src:
|
||||
@xsrc:
|
||||
@ysrc:
|
||||
@xdest:
|
||||
@ydest:
|
||||
@width:
|
||||
@height:
|
||||
|
||||
|
||||
|
@ -382,8 +382,7 @@ union, 16-bit data uses the s array, and 32-bit data uses the l array.
|
||||
|
||||
<!-- ##### STRUCT GdkEventNoExpose ##### -->
|
||||
<para>
|
||||
Generated when the area of a #GdkDrawable being copied, with gdk_draw_drawable()
|
||||
, was completely available.
|
||||
Generated when the area of a #GdkDrawable being copied was completely available.
|
||||
</para>
|
||||
<para>
|
||||
FIXME: add more here.
|
||||
|
@ -8,7 +8,7 @@ Offscreen drawables
|
||||
<para>
|
||||
Pixmaps are offscreen drawables. They can be drawn upon with the
|
||||
standard drawing primitives, then copied to another drawable (such as
|
||||
a #GdkWindow) with gdk_draw_drawable(). The depth of a pixmap
|
||||
a #GdkWindow). The depth of a pixmap
|
||||
is the number of bits per pixels. Bitmaps are simply pixmaps
|
||||
with a depth of 1. (That is, they are monochrome bitmaps - each
|
||||
pixel can be either on or off).
|
||||
|
@ -397,62 +397,6 @@ gdk_directfb_setup_for_drawing (GdkDrawableImplDirectFB *impl,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_directfb_draw_drawable (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkDrawable *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkDrawableImplDirectFB *impl;
|
||||
GdkDrawableImplDirectFB *src_impl;
|
||||
cairo_region_t clip;
|
||||
GdkRectangle dest_rect = { xdest,
|
||||
ydest,
|
||||
xdest + width ,
|
||||
ydest + height};
|
||||
|
||||
DFBRectangle rect = { xsrc, ysrc, width, height };
|
||||
gint i;
|
||||
|
||||
D_DEBUG_AT( GDKDFB_Drawable, "%s( %p, %p, %p, %4d,%4d -> %4d,%4d - %dx%d )\n", G_STRFUNC,
|
||||
drawable, gc, src, xsrc, ysrc, xdest, ydest, width, height );
|
||||
|
||||
impl = GDK_DRAWABLE_IMPL_DIRECTFB (drawable);
|
||||
|
||||
if (!impl->surface)
|
||||
return;
|
||||
|
||||
if (GDK_IS_PIXMAP (src))
|
||||
src_impl = GDK_DRAWABLE_IMPL_DIRECTFB (GDK_PIXMAP_OBJECT (src)->impl);
|
||||
else if (GDK_IS_WINDOW (src))
|
||||
src_impl = GDK_DRAWABLE_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (src)->impl);
|
||||
else if (GDK_IS_DRAWABLE_IMPL_DIRECTFB (src))
|
||||
src_impl = GDK_DRAWABLE_IMPL_DIRECTFB (src);
|
||||
else
|
||||
return;
|
||||
|
||||
gdk_directfb_clip_region (drawable, gc, &dest_rect, &clip);
|
||||
|
||||
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, src_impl->surface, &rect,
|
||||
xdest, ydest);
|
||||
}
|
||||
|
||||
temp_region_deinit( &clip );
|
||||
}
|
||||
|
||||
static inline void
|
||||
convert_rgba_pixbuf_to_image (guint32 *src,
|
||||
guint src_pitch,
|
||||
@ -549,7 +493,6 @@ gdk_drawable_impl_directfb_class_init (GdkDrawableImplDirectFBClass *klass)
|
||||
object_class->finalize = gdk_drawable_impl_directfb_finalize;
|
||||
|
||||
drawable_class->create_gc = _gdk_directfb_gc_new;
|
||||
drawable_class->draw_drawable = gdk_directfb_draw_drawable;
|
||||
|
||||
drawable_class->ref_cairo_surface = gdk_directfb_ref_cairo_surface;
|
||||
drawable_class->set_colormap = gdk_directfb_set_colormap;
|
||||
|
@ -549,7 +549,6 @@ gdk_drawable_get_type G_GNUC_CONST
|
||||
gdk_drawable_get_visible_region
|
||||
gdk_drawable_get_visual
|
||||
gdk_drawable_set_colormap
|
||||
gdk_draw_drawable
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
129
gdk/gdkdraw.c
129
gdk/gdkdraw.c
@ -44,15 +44,6 @@ static GdkDrawable* gdk_drawable_real_get_composite_drawable (GdkDrawable *draw
|
||||
gint *composite_x_offset,
|
||||
gint *composite_y_offset);
|
||||
static cairo_region_t * gdk_drawable_real_get_visible_region (GdkDrawable *drawable);
|
||||
static void gdk_drawable_real_draw_drawable (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkDrawable *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (GdkDrawable, gdk_drawable, G_TYPE_OBJECT)
|
||||
@ -64,7 +55,6 @@ gdk_drawable_class_init (GdkDrawableClass *klass)
|
||||
/* Default implementation for clip and visible region is the same */
|
||||
klass->get_clip_region = gdk_drawable_real_get_visible_region;
|
||||
klass->get_visible_region = gdk_drawable_real_get_visible_region;
|
||||
klass->draw_drawable = gdk_drawable_real_draw_drawable;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -211,100 +201,6 @@ gdk_drawable_get_colormap (GdkDrawable *drawable)
|
||||
return GDK_DRAWABLE_GET_CLASS (drawable)->get_colormap (drawable);
|
||||
}
|
||||
|
||||
/* Drawing
|
||||
*/
|
||||
|
||||
/**
|
||||
* gdk_draw_drawable:
|
||||
* @drawable: a #GdkDrawable
|
||||
* @gc: a #GdkGC sharing the drawable's visual and colormap
|
||||
* @src: the source #GdkDrawable, which may be the same as @drawable
|
||||
* @xsrc: X position in @src of rectangle to draw
|
||||
* @ysrc: Y position in @src of rectangle to draw
|
||||
* @xdest: X position in @drawable where the rectangle should be drawn
|
||||
* @ydest: Y position in @drawable where the rectangle should be drawn
|
||||
* @width: width of rectangle to draw, or -1 for entire @src width
|
||||
* @height: height of rectangle to draw, or -1 for entire @src height
|
||||
*
|
||||
* Copies the @width x @height region of @src at coordinates (@xsrc,
|
||||
* @ysrc) to coordinates (@xdest, @ydest) in @drawable.
|
||||
* @width and/or @height may be given as -1, in which case the entire
|
||||
* @src drawable will be copied.
|
||||
*
|
||||
* Most fields in @gc are not used for this operation, but notably the
|
||||
* clip mask or clip region will be honored.
|
||||
*
|
||||
* The source and destination drawables must have the same visual and
|
||||
* colormap, or errors will result. (On X11, failure to match
|
||||
* visual/colormap results in a BadMatch error from the X server.)
|
||||
* A common cause of this problem is an attempt to draw a bitmap to
|
||||
* a color drawable. The way to draw a bitmap is to set the bitmap as
|
||||
* the stipple on the #GdkGC, set the fill mode to %GDK_STIPPLED, and
|
||||
* then draw the rectangle.
|
||||
**/
|
||||
void
|
||||
gdk_draw_drawable (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkDrawable *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkDrawable *composite;
|
||||
gint composite_x_offset = 0;
|
||||
gint composite_y_offset = 0;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
|
||||
g_return_if_fail (GDK_IS_DRAWABLE (src));
|
||||
g_return_if_fail (GDK_IS_GC (gc));
|
||||
|
||||
if (width < 0 || height < 0)
|
||||
{
|
||||
gint real_width;
|
||||
gint real_height;
|
||||
|
||||
gdk_drawable_get_size (src, &real_width, &real_height);
|
||||
|
||||
if (width < 0)
|
||||
width = real_width;
|
||||
if (height < 0)
|
||||
height = real_height;
|
||||
}
|
||||
|
||||
|
||||
composite =
|
||||
GDK_DRAWABLE_GET_CLASS (src)->get_composite_drawable (src,
|
||||
xsrc, ysrc,
|
||||
width, height,
|
||||
&composite_x_offset,
|
||||
&composite_y_offset);
|
||||
|
||||
/* TODO: For non-native windows this may copy stuff from other overlapping
|
||||
windows. We should clip that and (for windows with bg != None) clear that
|
||||
area in the destination instead. */
|
||||
|
||||
if (GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable_with_src)
|
||||
GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable_with_src (drawable, gc,
|
||||
composite,
|
||||
xsrc - composite_x_offset,
|
||||
ysrc - composite_y_offset,
|
||||
xdest, ydest,
|
||||
width, height,
|
||||
src);
|
||||
else /* backwards compat for old out-of-tree implementations of GdkDrawable (are there any?) */
|
||||
GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable (drawable, gc,
|
||||
composite,
|
||||
xsrc - composite_x_offset,
|
||||
ysrc - composite_y_offset,
|
||||
xdest, ydest,
|
||||
width, height);
|
||||
|
||||
g_object_unref (composite);
|
||||
}
|
||||
|
||||
static GdkDrawable *
|
||||
gdk_drawable_real_get_composite_drawable (GdkDrawable *drawable,
|
||||
gint x,
|
||||
@ -396,31 +292,6 @@ _gdk_drawable_ref_cairo_surface (GdkDrawable *drawable)
|
||||
return GDK_DRAWABLE_GET_CLASS (drawable)->ref_cairo_surface (drawable);
|
||||
}
|
||||
|
||||
/* Implementation of the old vfunc in terms of the new one
|
||||
in case someone calls it directly (which they shouldn't!) */
|
||||
static void
|
||||
gdk_drawable_real_draw_drawable (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkDrawable *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable_with_src (drawable,
|
||||
gc,
|
||||
src,
|
||||
xsrc,
|
||||
ysrc,
|
||||
xdest,
|
||||
ydest,
|
||||
width,
|
||||
height,
|
||||
src);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
/**
|
||||
|
@ -60,15 +60,6 @@ struct _GdkDrawableClass
|
||||
GdkGC *(*create_gc) (GdkDrawable *drawable,
|
||||
GdkGCValues *values,
|
||||
GdkGCValuesMask mask);
|
||||
void (*draw_drawable) (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkDrawable *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
gint (*get_depth) (GdkDrawable *drawable);
|
||||
void (*get_size) (GdkDrawable *drawable,
|
||||
@ -104,17 +95,6 @@ struct _GdkDrawableClass
|
||||
int width,
|
||||
int height);
|
||||
|
||||
void (*draw_drawable_with_src) (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkDrawable *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkDrawable *original_src);
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (*_gdk_reserved7) (void);
|
||||
void (*_gdk_reserved9) (void);
|
||||
@ -141,18 +121,6 @@ gint gdk_drawable_get_depth (GdkDrawable *drawable);
|
||||
GdkScreen* gdk_drawable_get_screen (GdkDrawable *drawable);
|
||||
GdkDisplay* gdk_drawable_get_display (GdkDrawable *drawable);
|
||||
|
||||
/* Drawing
|
||||
*/
|
||||
void gdk_draw_drawable (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkDrawable *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
cairo_region_t *gdk_drawable_get_clip_region (GdkDrawable *drawable);
|
||||
cairo_region_t *gdk_drawable_get_visible_region (GdkDrawable *drawable);
|
||||
|
||||
|
@ -921,7 +921,7 @@ _gdk_gc_get_subwindow (GdkGC *gc)
|
||||
* Sets whether copying non-visible portions of a drawable
|
||||
* using this graphics context generate exposure events
|
||||
* for the corresponding regions of the destination
|
||||
* drawable. (See gdk_draw_drawable()).
|
||||
* drawable.
|
||||
**/
|
||||
void
|
||||
gdk_gc_set_exposures (GdkGC *gc,
|
||||
|
@ -273,37 +273,6 @@ add_damage (GdkOffscreenWindow *offscreen,
|
||||
cairo_region_destroy (damage);
|
||||
}
|
||||
|
||||
static GdkDrawable *
|
||||
get_real_drawable (GdkOffscreenWindow *offscreen)
|
||||
{
|
||||
GdkPixmapObject *pixmap;
|
||||
pixmap = (GdkPixmapObject *) offscreen->pixmap;
|
||||
return GDK_DRAWABLE (pixmap->impl);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_offscreen_window_draw_drawable (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPixmap *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkDrawable *original_src)
|
||||
{
|
||||
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
|
||||
GdkDrawable *real_drawable = get_real_drawable (offscreen);
|
||||
|
||||
gdk_draw_drawable (real_drawable, gc,
|
||||
src, xsrc, ysrc,
|
||||
xdest, ydest,
|
||||
width, height);
|
||||
|
||||
add_damage (offscreen, xdest, ydest, width, height, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_offscreen_window_new (GdkWindow *window,
|
||||
GdkScreen *screen,
|
||||
@ -953,8 +922,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
|
||||
drawable_class->get_visual = gdk_offscreen_window_get_visual;
|
||||
drawable_class->get_source_drawable = gdk_offscreen_window_get_source_drawable;
|
||||
drawable_class->get_composite_drawable = gdk_offscreen_window_get_composite_drawable;
|
||||
|
||||
drawable_class->draw_drawable_with_src = gdk_offscreen_window_draw_drawable;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -34,16 +34,6 @@
|
||||
static GdkGC *gdk_pixmap_create_gc (GdkDrawable *drawable,
|
||||
GdkGCValues *values,
|
||||
GdkGCValuesMask mask);
|
||||
static void gdk_pixmap_draw_drawable (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPixmap *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkPixmap *original_src);
|
||||
|
||||
static void gdk_pixmap_real_get_size (GdkDrawable *drawable,
|
||||
gint *width,
|
||||
@ -102,7 +92,6 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass)
|
||||
object_class->finalize = gdk_pixmap_finalize;
|
||||
|
||||
drawable_class->create_gc = gdk_pixmap_create_gc;
|
||||
drawable_class->draw_drawable_with_src = gdk_pixmap_draw_drawable;
|
||||
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;
|
||||
@ -181,30 +170,6 @@ gdk_pixmap_create_gc (GdkDrawable *drawable,
|
||||
values, mask);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixmap_draw_drawable (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPixmap *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkPixmap *original_src)
|
||||
{
|
||||
GdkPixmapObject *private = (GdkPixmapObject *)drawable;
|
||||
|
||||
_gdk_gc_remove_drawable_clip (gc);
|
||||
/* Call the method directly to avoid getting the composite drawable again */
|
||||
GDK_DRAWABLE_GET_CLASS (private->impl)->draw_drawable_with_src (private->impl, gc,
|
||||
src,
|
||||
xsrc, ysrc,
|
||||
xdest, ydest,
|
||||
width, height,
|
||||
original_src);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixmap_real_get_size (GdkDrawable *drawable,
|
||||
gint *width,
|
||||
|
100
gdk/gdkwindow.c
100
gdk/gdkwindow.c
@ -229,16 +229,6 @@ typedef struct {
|
||||
static GdkGC *gdk_window_create_gc (GdkDrawable *drawable,
|
||||
GdkGCValues *values,
|
||||
GdkGCValuesMask mask);
|
||||
static void gdk_window_draw_drawable (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPixmap *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkDrawable *original_src);
|
||||
|
||||
static cairo_surface_t *gdk_window_ref_cairo_surface (GdkDrawable *drawable);
|
||||
static cairo_surface_t *gdk_window_create_cairo_surface (GdkDrawable *drawable,
|
||||
@ -417,7 +407,6 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
|
||||
object_class->get_property = gdk_window_get_property;
|
||||
|
||||
drawable_class->create_gc = gdk_window_create_gc;
|
||||
drawable_class->draw_drawable_with_src = gdk_window_draw_drawable;
|
||||
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;
|
||||
@ -4033,95 +4022,6 @@ gdk_window_get_visible_region (GdkDrawable *drawable)
|
||||
return cairo_region_copy (private->clip_region);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_draw_drawable (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPixmap *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkDrawable *original_src)
|
||||
{
|
||||
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (drawable))
|
||||
return;
|
||||
|
||||
BEGIN_DRAW;
|
||||
|
||||
/* Call the method directly to avoid getting the composite drawable again */
|
||||
GDK_DRAWABLE_GET_CLASS (impl)->draw_drawable_with_src (impl, gc,
|
||||
src,
|
||||
xsrc, ysrc,
|
||||
xdest - x_offset,
|
||||
ydest - y_offset,
|
||||
width, height,
|
||||
original_src);
|
||||
|
||||
if (!private->paint_stack)
|
||||
{
|
||||
/* We might have drawn from an obscured part of a client
|
||||
side window, if so we need to send graphics exposures */
|
||||
if (_gdk_gc_get_exposures (gc) &&
|
||||
GDK_IS_WINDOW (original_src))
|
||||
{
|
||||
cairo_region_t *exposure_region;
|
||||
cairo_region_t *clip;
|
||||
GdkRectangle r;
|
||||
|
||||
r.x = xdest;
|
||||
r.y = ydest;
|
||||
r.width = width;
|
||||
r.height = height;
|
||||
exposure_region = cairo_region_create_rectangle (&r);
|
||||
|
||||
if (_gdk_gc_get_subwindow (gc) == GDK_CLIP_BY_CHILDREN)
|
||||
clip = private->clip_region_with_children;
|
||||
else
|
||||
clip = private->clip_region;
|
||||
cairo_region_intersect (exposure_region, clip);
|
||||
|
||||
_gdk_gc_remove_drawable_clip (gc);
|
||||
clip = _gdk_gc_get_clip_region (gc);
|
||||
if (clip)
|
||||
{
|
||||
cairo_region_translate (exposure_region,
|
||||
old_clip_x,
|
||||
old_clip_y);
|
||||
cairo_region_intersect (exposure_region, clip);
|
||||
cairo_region_translate (exposure_region,
|
||||
-old_clip_x,
|
||||
-old_clip_y);
|
||||
}
|
||||
|
||||
/* Note: We don't clip by the clip mask if set, so this
|
||||
may invalidate to much */
|
||||
|
||||
/* Remove the area that is correctly copied from the src.
|
||||
* Note that xsrc/ysrc has been corrected for abs_x/y offsets already,
|
||||
* which need to be undone */
|
||||
clip = gdk_drawable_get_visible_region (original_src);
|
||||
cairo_region_translate (clip,
|
||||
xdest - (xsrc - GDK_WINDOW_OBJECT (original_src)->abs_x),
|
||||
ydest - (ysrc - GDK_WINDOW_OBJECT (original_src)->abs_y));
|
||||
cairo_region_subtract (exposure_region, clip);
|
||||
cairo_region_destroy (clip);
|
||||
|
||||
gdk_window_invalidate_region_full (GDK_WINDOW (private),
|
||||
exposure_region,
|
||||
_gdk_gc_get_subwindow (gc) == GDK_INCLUDE_INFERIORS,
|
||||
CLEAR_BG_ALL);
|
||||
|
||||
cairo_region_destroy (exposure_region);
|
||||
}
|
||||
}
|
||||
|
||||
END_DRAW;
|
||||
}
|
||||
|
||||
static cairo_t *
|
||||
setup_backing_rect (GdkWindow *window, GdkWindowPaint *paint, int x_offset_cairo, int y_offset_cairo)
|
||||
{
|
||||
|
@ -147,87 +147,6 @@ gdk_quartz_get_depth (GdkDrawable *drawable)
|
||||
return gdk_drawable_get_depth (GDK_DRAWABLE_IMPL_QUARTZ (drawable)->wrapper);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_draw_drawable (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPixmap *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkDrawable *original_src)
|
||||
{
|
||||
int src_depth = gdk_drawable_get_depth (src);
|
||||
int dest_depth = gdk_drawable_get_depth (drawable);
|
||||
GdkDrawableImplQuartz *src_impl;
|
||||
|
||||
if (GDK_IS_WINDOW_IMPL_QUARTZ (src))
|
||||
{
|
||||
GdkWindowImplQuartz *window_impl;
|
||||
|
||||
window_impl = GDK_WINDOW_IMPL_QUARTZ (src);
|
||||
|
||||
/* We do support moving areas on the same drawable, if it can be done
|
||||
* by using a scroll. FIXME: We need to check that the params support
|
||||
* this hack, and make sure it's done properly with any offsets etc?
|
||||
*/
|
||||
if (drawable == (GdkDrawable *)window_impl)
|
||||
{
|
||||
[window_impl->view scrollRect:NSMakeRect (xsrc, ysrc, width, height)
|
||||
by:NSMakeSize (xdest - xsrc, ydest - ysrc)];
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
g_warning ("Drawing with window source != dest is not supported");
|
||||
|
||||
return;
|
||||
}
|
||||
else if (GDK_IS_DRAWABLE_IMPL_QUARTZ (src))
|
||||
src_impl = GDK_DRAWABLE_IMPL_QUARTZ (src);
|
||||
else if (GDK_IS_PIXMAP (src))
|
||||
src_impl = GDK_DRAWABLE_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (src)->impl);
|
||||
else
|
||||
{
|
||||
g_warning ("Unsupported source %s", G_OBJECT_TYPE_NAME (src));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Handle drawable and pixmap sources. */
|
||||
if (src_depth == 1)
|
||||
{
|
||||
/* FIXME: src depth 1 is not supported yet */
|
||||
g_warning ("Source with depth 1 unsupported");
|
||||
}
|
||||
else if (dest_depth != 0 && src_depth == dest_depth)
|
||||
{
|
||||
GdkPixmapImplQuartz *pixmap_impl = GDK_PIXMAP_IMPL_QUARTZ (src_impl);
|
||||
CGContextRef context = gdk_quartz_drawable_get_context (drawable, FALSE);
|
||||
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
_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 +
|
||||
pixmap_impl->height);
|
||||
CGContextScaleCTM (context, 1.0, -1.0);
|
||||
|
||||
CGContextDrawImage (context,
|
||||
CGRectMake (0, 0, pixmap_impl->width, pixmap_impl->height),
|
||||
pixmap_impl->image);
|
||||
|
||||
gdk_quartz_drawable_release_context (drawable, context);
|
||||
}
|
||||
else
|
||||
g_warning ("Attempt to draw a drawable with depth %d to a drawable with depth %d",
|
||||
src_depth, dest_depth);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gdk_quartz_fix_cap_not_last_line (GdkGCQuartz *private,
|
||||
gint x1,
|
||||
@ -277,7 +196,6 @@ gdk_drawable_impl_quartz_class_init (GdkDrawableImplQuartzClass *klass)
|
||||
object_class->finalize = gdk_drawable_impl_quartz_finalize;
|
||||
|
||||
drawable_class->create_gc = _gdk_quartz_gc_new;
|
||||
drawable_class->draw_drawable_with_src = gdk_quartz_draw_drawable;
|
||||
|
||||
drawable_class->ref_cairo_surface = gdk_quartz_ref_cairo_surface;
|
||||
|
||||
|
@ -48,17 +48,6 @@
|
||||
(gcwin32->line_style == GDK_LINE_DOUBLE_DASH || \
|
||||
(gcwin32->line_style == GDK_LINE_ON_OFF_DASH && gcwin32->pen_dash_offset))
|
||||
|
||||
static void gdk_win32_draw_drawable (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPixmap *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkDrawable *original_src);
|
||||
|
||||
static cairo_surface_t *gdk_win32_ref_cairo_surface (GdkDrawable *drawable);
|
||||
|
||||
static void gdk_win32_set_colormap (GdkDrawable *drawable,
|
||||
@ -88,7 +77,6 @@ _gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass)
|
||||
object_class->finalize = gdk_drawable_impl_win32_finalize;
|
||||
|
||||
drawable_class->create_gc = _gdk_win32_gc_new;
|
||||
drawable_class->draw_drawable_with_src = gdk_win32_draw_drawable;
|
||||
|
||||
drawable_class->ref_cairo_surface = gdk_win32_ref_cairo_surface;
|
||||
|
||||
@ -431,25 +419,6 @@ widen_bounds (GdkRectangle *bounds,
|
||||
return cairo_region_create_rectangle (bounds);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_draw_drawable (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPixmap *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkDrawable *original_src)
|
||||
{
|
||||
g_assert (GDK_IS_DRAWABLE_IMPL_WIN32 (drawable));
|
||||
|
||||
_gdk_win32_blit (FALSE, (GdkDrawableImplWin32 *) drawable,
|
||||
gc, src, xsrc, ysrc,
|
||||
xdest, ydest, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
blit_from_pixmap (gboolean use_fg_bg,
|
||||
GdkDrawableImplWin32 *dest,
|
||||
@ -650,158 +619,6 @@ blit_from_window (HDC hdc,
|
||||
GDI_CALL (ReleaseDC, (src->handle, srcdc));
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_blit (gboolean use_fg_bg,
|
||||
GdkDrawableImplWin32 *draw_impl,
|
||||
GdkGC *gc,
|
||||
GdkDrawable *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
HDC hdc;
|
||||
HRGN src_rgn, draw_rgn, outside_rgn;
|
||||
RECT r;
|
||||
GdkDrawableImplWin32 *src_impl = NULL;
|
||||
gint src_width, src_height;
|
||||
|
||||
GDK_NOTE (DRAW, g_print ("_gdk_win32_blit: src:%s %dx%d@%+d%+d\n"
|
||||
" dst:%s @%+d%+d use_fg_bg=%d\n",
|
||||
_gdk_win32_drawable_description (src),
|
||||
width, height, xsrc, ysrc,
|
||||
_gdk_win32_drawable_description (&draw_impl->parent_instance),
|
||||
xdest, ydest,
|
||||
use_fg_bg));
|
||||
|
||||
/* If blitting from the root window, take the multi-monitor offset
|
||||
* into account.
|
||||
*/
|
||||
if (src == ((GdkWindowObject *)_gdk_root)->impl)
|
||||
{
|
||||
GDK_NOTE (DRAW, g_print ("... offsetting src coords\n"));
|
||||
xsrc -= _gdk_offset_x;
|
||||
ysrc -= _gdk_offset_y;
|
||||
}
|
||||
|
||||
if (GDK_IS_DRAWABLE_IMPL_WIN32 (src))
|
||||
src_impl = (GdkDrawableImplWin32 *) src;
|
||||
else if (GDK_IS_WINDOW (src))
|
||||
src_impl = (GdkDrawableImplWin32 *) GDK_WINDOW_OBJECT (src)->impl;
|
||||
else if (GDK_IS_PIXMAP (src))
|
||||
src_impl = (GdkDrawableImplWin32 *) GDK_PIXMAP_OBJECT (src)->impl;
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
|
||||
if (GDK_IS_WINDOW_IMPL_WIN32 (draw_impl) &&
|
||||
GDK_IS_PIXMAP_IMPL_WIN32 (src_impl))
|
||||
{
|
||||
GdkPixmapImplWin32 *src_pixmap = GDK_PIXMAP_IMPL_WIN32 (src_impl);
|
||||
|
||||
if (xsrc < 0)
|
||||
{
|
||||
width += xsrc;
|
||||
xdest -= xsrc;
|
||||
xsrc = 0;
|
||||
}
|
||||
|
||||
if (ysrc < 0)
|
||||
{
|
||||
height += ysrc;
|
||||
ydest -= ysrc;
|
||||
ysrc = 0;
|
||||
}
|
||||
|
||||
if (xsrc + width > src_pixmap->width)
|
||||
width = src_pixmap->width - xsrc;
|
||||
if (ysrc + height > src_pixmap->height)
|
||||
height = src_pixmap->height - ysrc;
|
||||
}
|
||||
|
||||
hdc = gdk_win32_hdc_get (&draw_impl->parent_instance, gc, GDK_GC_FOREGROUND);
|
||||
|
||||
gdk_drawable_get_size (src_impl->wrapper, &src_width, &src_height);
|
||||
|
||||
if ((src_rgn = CreateRectRgn (0, 0, src_width + 1, src_height + 1)) == NULL)
|
||||
{
|
||||
WIN32_GDI_FAILED ("CreateRectRgn");
|
||||
}
|
||||
else if ((draw_rgn = CreateRectRgn (xsrc, ysrc,
|
||||
xsrc + width + 1,
|
||||
ysrc + height + 1)) == NULL)
|
||||
{
|
||||
WIN32_GDI_FAILED ("CreateRectRgn");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GDK_IS_WINDOW_IMPL_WIN32 (draw_impl))
|
||||
{
|
||||
int comb;
|
||||
|
||||
/* If we are drawing on a window, calculate the region that is
|
||||
* outside the source pixmap, and invalidate that, causing it to
|
||||
* be cleared. Not completely sure whether this is always needed. XXX
|
||||
*/
|
||||
SetRectEmpty (&r);
|
||||
outside_rgn = CreateRectRgnIndirect (&r);
|
||||
|
||||
if ((comb = CombineRgn (outside_rgn,
|
||||
draw_rgn, src_rgn,
|
||||
RGN_DIFF)) == ERROR)
|
||||
WIN32_GDI_FAILED ("CombineRgn");
|
||||
else if (comb != NULLREGION)
|
||||
{
|
||||
OffsetRgn (outside_rgn, xdest, ydest);
|
||||
GDK_NOTE (DRAW, (GetRgnBox (outside_rgn, &r),
|
||||
g_print ("... InvalidateRgn "
|
||||
"bbox: %ldx%ld@%+ld%+ld\n",
|
||||
r.right - r.left - 1, r.bottom - r.top - 1,
|
||||
r.left, r.top)));
|
||||
InvalidateRgn (draw_impl->handle, outside_rgn, TRUE);
|
||||
}
|
||||
GDI_CALL (DeleteObject, (outside_rgn));
|
||||
}
|
||||
|
||||
#if 1 /* Don't know if this is necessary XXX */
|
||||
if (CombineRgn (draw_rgn, draw_rgn, src_rgn, RGN_AND) == COMPLEXREGION)
|
||||
g_warning ("gdk_win32_blit: CombineRgn returned a COMPLEXREGION");
|
||||
|
||||
GetRgnBox (draw_rgn, &r);
|
||||
if (r.left != xsrc || r.top != ysrc ||
|
||||
r.right != xsrc + width + 1 || r.bottom != ysrc + height + 1)
|
||||
{
|
||||
xdest += r.left - xsrc;
|
||||
xsrc = r.left;
|
||||
ydest += r.top - ysrc;
|
||||
ysrc = r.top;
|
||||
width = r.right - xsrc - 1;
|
||||
height = r.bottom - ysrc - 1;
|
||||
|
||||
GDK_NOTE (DRAW, g_print ("... restricted to src: %dx%d@%+d%+d, "
|
||||
"dest: @%+d%+d\n",
|
||||
width, height, xsrc, ysrc,
|
||||
xdest, ydest));
|
||||
}
|
||||
#endif
|
||||
|
||||
GDI_CALL (DeleteObject, (src_rgn));
|
||||
GDI_CALL (DeleteObject, (draw_rgn));
|
||||
}
|
||||
|
||||
if (draw_impl->handle == src_impl->handle)
|
||||
blit_inside_drawable (hdc, GDK_GC_WIN32 (gc), xsrc, ysrc, xdest, ydest, width, height);
|
||||
else if (GDK_IS_PIXMAP_IMPL_WIN32 (src_impl))
|
||||
blit_from_pixmap (use_fg_bg, draw_impl, hdc,
|
||||
(GdkPixmapImplWin32 *) src_impl, gc,
|
||||
xsrc, ysrc, xdest, ydest, width, height);
|
||||
else
|
||||
blit_from_window (hdc, GDK_GC_WIN32 (gc), src_impl, xsrc, ysrc, xdest, ydest, width, height);
|
||||
|
||||
gdk_win32_hdc_release (&draw_impl->parent_instance, gc, GDK_GC_FOREGROUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* _gdk_win32_drawable_acquire_dc
|
||||
* @drawable: a Win32 #GdkDrawable implementation
|
||||
|
@ -48,17 +48,6 @@
|
||||
#include "gdkdisplay-x11.h"
|
||||
|
||||
|
||||
static void gdk_x11_draw_drawable (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPixmap *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkDrawable *original_src);
|
||||
|
||||
static cairo_surface_t *gdk_x11_ref_cairo_surface (GdkDrawable *drawable);
|
||||
|
||||
static void gdk_x11_set_colormap (GdkDrawable *drawable,
|
||||
@ -84,7 +73,6 @@ _gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass)
|
||||
object_class->finalize = gdk_drawable_impl_x11_finalize;
|
||||
|
||||
drawable_class->create_gc = _gdk_x11_gc_new;
|
||||
drawable_class->draw_drawable_with_src = gdk_x11_draw_drawable;
|
||||
|
||||
drawable_class->ref_cairo_surface = gdk_x11_ref_cairo_surface;
|
||||
|
||||
@ -277,95 +265,6 @@ gdk_x11_set_colormap (GdkDrawable *drawable,
|
||||
g_object_ref (impl->colormap);
|
||||
}
|
||||
|
||||
/* Drawing
|
||||
*/
|
||||
|
||||
static void
|
||||
gdk_x11_draw_drawable (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPixmap *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkDrawable *original_src)
|
||||
{
|
||||
int src_depth = gdk_drawable_get_depth (src);
|
||||
int dest_depth = gdk_drawable_get_depth (drawable);
|
||||
GdkDrawableImplX11 *impl;
|
||||
GdkDrawableImplX11 *src_impl;
|
||||
|
||||
impl = GDK_DRAWABLE_IMPL_X11 (drawable);
|
||||
|
||||
if (GDK_IS_DRAWABLE_IMPL_X11 (src))
|
||||
src_impl = GDK_DRAWABLE_IMPL_X11 (src);
|
||||
else if (GDK_IS_WINDOW (src))
|
||||
src_impl = GDK_DRAWABLE_IMPL_X11(((GdkWindowObject *)src)->impl);
|
||||
else
|
||||
src_impl = GDK_DRAWABLE_IMPL_X11(((GdkPixmapObject *)src)->impl);
|
||||
|
||||
if (GDK_IS_WINDOW_IMPL_X11 (impl) &&
|
||||
GDK_IS_PIXMAP_IMPL_X11 (src_impl))
|
||||
{
|
||||
GdkPixmapImplX11 *src_pixmap = GDK_PIXMAP_IMPL_X11 (src_impl);
|
||||
/* Work around an Xserver bug where non-visible areas from
|
||||
* a pixmap to a window will clear the window background
|
||||
* in destination areas that are supposed to be clipped out.
|
||||
* This is a problem with client side windows as this means
|
||||
* things may draw outside the virtual windows. This could
|
||||
* also happen for window to window copies, but I don't
|
||||
* think we generate any calls like that.
|
||||
*
|
||||
* See:
|
||||
* http://lists.freedesktop.org/archives/xorg/2009-February/043318.html
|
||||
*/
|
||||
if (xsrc < 0)
|
||||
{
|
||||
width += xsrc;
|
||||
xdest -= xsrc;
|
||||
xsrc = 0;
|
||||
}
|
||||
|
||||
if (ysrc < 0)
|
||||
{
|
||||
height += ysrc;
|
||||
ydest -= ysrc;
|
||||
ysrc = 0;
|
||||
}
|
||||
|
||||
if (xsrc + width > src_pixmap->width)
|
||||
width = src_pixmap->width - xsrc;
|
||||
if (ysrc + height > src_pixmap->height)
|
||||
height = src_pixmap->height - ysrc;
|
||||
}
|
||||
|
||||
if (src_depth == 1)
|
||||
{
|
||||
XCopyArea (GDK_SCREEN_XDISPLAY (impl->screen),
|
||||
src_impl->xid,
|
||||
impl->xid,
|
||||
GDK_GC_GET_XGC (gc),
|
||||
xsrc, ysrc,
|
||||
width, height,
|
||||
xdest, ydest);
|
||||
}
|
||||
else if (dest_depth != 0 && src_depth == dest_depth)
|
||||
{
|
||||
XCopyArea (GDK_SCREEN_XDISPLAY (impl->screen),
|
||||
src_impl->xid,
|
||||
impl->xid,
|
||||
GDK_GC_GET_XGC (gc),
|
||||
xsrc, ysrc,
|
||||
width, height,
|
||||
xdest, ydest);
|
||||
}
|
||||
else
|
||||
g_warning ("Attempt to draw a drawable with depth %d to a drawable with depth %d",
|
||||
src_depth, dest_depth);
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_x11_get_depth (GdkDrawable *drawable)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user