mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
Create _gdk_drawable_create_cairo_surface to ugly typechecking
This commit is contained in:
parent
0ba99e6e7b
commit
0d540e935b
@ -1804,5 +1804,15 @@ _gdk_drawable_get_source_drawable (GdkDrawable *drawable)
|
||||
return drawable;
|
||||
}
|
||||
|
||||
cairo_surface_t *
|
||||
_gdk_drawable_create_cairo_surface (GdkDrawable *drawable,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
return GDK_DRAWABLE_GET_CLASS (drawable)->create_cairo_surface (drawable,
|
||||
width, height);
|
||||
}
|
||||
|
||||
|
||||
#define __GDK_DRAW_C__
|
||||
#include "gdkaliasdef.c"
|
||||
|
@ -204,8 +204,12 @@ struct _GdkDrawableClass
|
||||
|
||||
void (*set_cairo_clip) (GdkDrawable *drawable,
|
||||
cairo_t *cr);
|
||||
|
||||
cairo_surface_t * (*create_cairo_surface) (GdkDrawable *drawable,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (*_gdk_reserved6) (void);
|
||||
void (*_gdk_reserved7) (void);
|
||||
void (*_gdk_reserved9) (void);
|
||||
void (*_gdk_reserved10) (void);
|
||||
|
@ -234,6 +234,9 @@ GdkImage *_gdk_drawable_copy_to_image (GdkDrawable *drawable,
|
||||
cairo_surface_t *_gdk_drawable_ref_cairo_surface (GdkDrawable *drawable);
|
||||
|
||||
GdkDrawable *_gdk_drawable_get_source_drawable (GdkDrawable *drawable);
|
||||
cairo_surface_t * _gdk_drawable_create_cairo_surface (GdkDrawable *drawable,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
/* GC caching */
|
||||
GdkGC *_gdk_drawable_get_scratch_gc (GdkDrawable *drawable,
|
||||
|
@ -145,6 +145,9 @@ static GdkImage* gdk_pixmap_copy_to_image (GdkDrawable *drawable,
|
||||
gint height);
|
||||
|
||||
static cairo_surface_t *gdk_pixmap_ref_cairo_surface (GdkDrawable *drawable);
|
||||
static cairo_surface_t *gdk_pixmap_create_cairo_surface (GdkDrawable *drawable,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
static GdkVisual* gdk_pixmap_real_get_visual (GdkDrawable *drawable);
|
||||
static gint gdk_pixmap_real_get_depth (GdkDrawable *drawable);
|
||||
@ -216,6 +219,7 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass)
|
||||
drawable_class->get_visual = gdk_pixmap_real_get_visual;
|
||||
drawable_class->_copy_to_image = gdk_pixmap_copy_to_image;
|
||||
drawable_class->ref_cairo_surface = gdk_pixmap_ref_cairo_surface;
|
||||
drawable_class->create_cairo_surface = gdk_pixmap_create_cairo_surface;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -605,6 +609,17 @@ gdk_pixmap_ref_cairo_surface (GdkDrawable *drawable)
|
||||
return _gdk_drawable_ref_cairo_surface (((GdkPixmapObject*)drawable)->impl);
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
gdk_pixmap_create_cairo_surface (GdkDrawable *drawable,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
return _gdk_windowing_create_cairo_surface (GDK_PIXMAP_OBJECT(drawable)->impl,
|
||||
width, height);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static GdkBitmap *
|
||||
make_solid_mask (GdkScreen *screen, gint width, gint height)
|
||||
{
|
||||
|
@ -192,6 +192,9 @@ static GdkImage* gdk_window_copy_to_image (GdkDrawable *drawable,
|
||||
gint height);
|
||||
|
||||
static cairo_surface_t *gdk_window_ref_cairo_surface (GdkDrawable *drawable);
|
||||
static cairo_surface_t *gdk_window_create_cairo_surface (GdkDrawable *drawable,
|
||||
int width,
|
||||
int height);
|
||||
static void gdk_window_set_cairo_clip (GdkDrawable *drawable,
|
||||
cairo_t *cr);
|
||||
|
||||
@ -344,6 +347,7 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
|
||||
drawable_class->get_visual = gdk_window_real_get_visual;
|
||||
drawable_class->_copy_to_image = gdk_window_copy_to_image;
|
||||
drawable_class->ref_cairo_surface = gdk_window_ref_cairo_surface;
|
||||
drawable_class->create_cairo_surface = gdk_window_create_cairo_surface;
|
||||
drawable_class->set_cairo_clip = gdk_window_set_cairo_clip;
|
||||
drawable_class->get_clip_region = gdk_window_get_clip_region;
|
||||
drawable_class->get_visible_region = gdk_window_get_visible_region;
|
||||
@ -2010,8 +2014,7 @@ gdk_window_begin_paint_region (GdkWindow *window,
|
||||
width = private->abs_x + private->width;
|
||||
height = private->abs_y + private->height;
|
||||
|
||||
paint->surface = _gdk_windowing_create_cairo_surface (((GdkPixmapObject *)paint->pixmap)->impl,
|
||||
width, height);
|
||||
paint->surface = _gdk_drawable_create_cairo_surface (paint->pixmap, width, height);
|
||||
|
||||
/* Mark the region as valid on the implicit paint */
|
||||
gdk_region_offset (paint->region, private->abs_x, private->abs_y);
|
||||
@ -3868,6 +3871,16 @@ gdk_window_cairo_surface_destroy (void *data)
|
||||
private->cairo_surface = NULL;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
gdk_window_create_cairo_surface (GdkDrawable *drawable,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
return _gdk_windowing_create_cairo_surface (GDK_WINDOW_OBJECT(drawable)->impl,
|
||||
width, height);
|
||||
}
|
||||
|
||||
|
||||
static cairo_surface_t *
|
||||
gdk_window_ref_cairo_surface (GdkDrawable *drawable)
|
||||
{
|
||||
@ -3900,8 +3913,7 @@ gdk_window_ref_cairo_surface (GdkDrawable *drawable)
|
||||
source = _gdk_drawable_get_source_drawable (drawable);
|
||||
|
||||
/* TODO: Avoid the typecheck crap by adding virtual call */
|
||||
private->cairo_surface = _gdk_windowing_create_cairo_surface (GDK_IS_PIXMAP (source) ? GDK_PIXMAP_OBJECT(source)->impl : GDK_WINDOW_OBJECT(source)->impl,
|
||||
width, height);
|
||||
private->cairo_surface = _gdk_drawable_create_cairo_surface (source, width, height);
|
||||
|
||||
if (private->cairo_surface)
|
||||
{
|
||||
@ -5933,7 +5945,7 @@ update_cursor (GdkDisplay *display)
|
||||
!is_parent_of (display->pointer_grab.window, (GdkWindow *)cursor_window))
|
||||
cursor_window = (GdkWindowObject *)display->pointer_grab.window;
|
||||
|
||||
GDK_WINDOW_IMPL_GET_IFACE (pointer_window->impl)->set_cursor (pointer_window,
|
||||
GDK_WINDOW_IMPL_GET_IFACE (pointer_window->impl)->set_cursor ((GdkWindow *)pointer_window,
|
||||
cursor_window->cursor);
|
||||
}
|
||||
|
||||
@ -7402,8 +7414,7 @@ proxy_button_event (GdkEvent *source_event)
|
||||
break;
|
||||
w = w->parent;
|
||||
}
|
||||
pointer_window = w;
|
||||
|
||||
pointer_window = (GdkWindow *)w;
|
||||
|
||||
if (pointer_window != NULL &&
|
||||
pointer_window != source_event->any.window)
|
||||
|
Loading…
Reference in New Issue
Block a user