mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-18 17:30:10 +00:00
d12c9702a4
Thu Jan 3 22:18:15 2002 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkdrawable-x11.c gdk/x11/gdkprivate-x11.h (_gdk_x11_have_render): Private function to tell if we have RENDER extension. * gdk/x11/gdkgc-x11.c (_gdk_x11_gc_get_fg_picture): Return None if we don't have RENDER extension. * gdk/x11/gdkpango-x11.c (gdk_pango_context_get): Don't use Xft unless we have render extension. * gdk/x11/gdkdrawable-x11.c (gdk_x11_drawable_get_picture): Handle missing render extension. * gdk/gdkdraw.c gdk/gdkdrawable.h gdk/gdkpixmap.c gdk/gdkwindow.c gdk/gdkinternals.h: Add a private copy_to_image() virtual function to the GdkDrawable vtable that extends get_image() to allow copying onto existing images. Make the default implementation of get_image() use this so that backends don't have to implement both. Add private wrapper _gdk_drawable_copy_to_image(). * gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.c gdk/x11/gdkdrawable-x11.c (_gdk_x11_copy_to_image): Implement copy_to_image() semantics, speed up by using ShmPixmaps and XCopyArea when possible, XFlush() after ungrabbing the server, generally redo the logic once again. * gdk/gdkinternals.h gdk/x11/gdkimage-x11.c _gdk_windowing_bits_per_depth(): Function to convert from depth to bits-per-pixel. (We assume only one bpp per depth - X requires this.) * gdk/gdkinternals.h gdk/gdkrgb.c gdk/gdkimage.c: Move the GdkRGB scratch image code into a generic _gdk_image_get_scratch() chunk of code that we can use other places we need scratch images. * gdk/gdkimage.c gdk/x11/gdkimage.c gdk/gdkinternals.h: Add _gdk_image_new_for_depth() as the backend to _gdk_image_new() to allowing creating images with a depth and no visual. * gdk/gdkpixbuf-drawable.c: Fix so that getting parts of images not at 0,0 actually works. * gdk/gdkdrawable.h gdk/gdkinternals.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/gdkpixmap.c gdk/gdkpixbuf-render.c: - Add a new GdkDrawableClass vfunc _draw_pixbuf, and _gdk_draw_pixbuf() [ will be made public later ], to allow backends to accelerate drawing pixbufs. - Move the implementation of gdk_pixbuf_render_to_drawable_alpha() to be the default implementation. - Update docs for gdk_pixbuf_render_to_drawable_alpha(). - Optimize the default implementation by using _gdk_image_copy_to_pixmap() and scratch shared images, and special casing the compositing. * gdk/x11/gdkdrawable-x11.c: Accelerate _gdk_draw_pixbuf() with alpha using the RENDER extension. * gdk/gdkpixbuf-drawable.c (gdk_pixbuf_get_from_drawable): Optimize by _gdk_image_copy_to_pixmap() and scratch images. * tests/testrgb.c: Add test for speed of alpha composition, reduce the number of iterations since alpha composition can be a bit slow. * gdk/x11/gdkimage-x11.c gdk/gdkprivate-x11.h (_gdk_x11_image_get_shm_pixmap): Private function to get a ShmPixmap for an image, if possible.
302 lines
8.5 KiB
C
302 lines
8.5 KiB
C
/* GDK - The GIMP Drawing Kit
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
* Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
/*
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
* files for a list of changes. These files are distributed with
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
*/
|
|
|
|
/* Uninstalled header defining types and functions internal to GDK */
|
|
|
|
#include <gdk/gdktypes.h>
|
|
#include <gdk/gdkprivate.h>
|
|
|
|
#ifndef __GDK_INTERNALS_H__
|
|
#define __GDK_INTERNALS_H__
|
|
|
|
/**********************
|
|
* General Facilities *
|
|
**********************/
|
|
|
|
/* Debugging support */
|
|
|
|
typedef struct _GdkColorInfo GdkColorInfo;
|
|
typedef struct _GdkEventFilter GdkEventFilter;
|
|
typedef struct _GdkClientFilter GdkClientFilter;
|
|
|
|
typedef enum {
|
|
GDK_COLOR_WRITEABLE = 1 << 0
|
|
} GdkColorInfoFlags;
|
|
|
|
struct _GdkColorInfo
|
|
{
|
|
GdkColorInfoFlags flags;
|
|
guint ref_count;
|
|
};
|
|
|
|
struct _GdkEventFilter {
|
|
GdkFilterFunc function;
|
|
gpointer data;
|
|
};
|
|
|
|
struct _GdkClientFilter {
|
|
GdkAtom type;
|
|
GdkFilterFunc function;
|
|
gpointer data;
|
|
};
|
|
|
|
typedef enum {
|
|
GDK_DEBUG_MISC = 1 << 0,
|
|
GDK_DEBUG_EVENTS = 1 << 1,
|
|
GDK_DEBUG_DND = 1 << 2,
|
|
GDK_DEBUG_XIM = 1 << 3,
|
|
GDK_DEBUG_NOGRABS = 1 << 4,
|
|
} GdkDebugFlag;
|
|
|
|
#ifndef GDK_DISABLE_DEPRECATED
|
|
|
|
typedef struct _GdkFontPrivate GdkFontPrivate;
|
|
|
|
struct _GdkFontPrivate
|
|
{
|
|
GdkFont font;
|
|
guint ref_count;
|
|
};
|
|
|
|
#endif /* GDK_DISABLE_DEPRECATED */
|
|
|
|
extern GList *_gdk_default_filters;
|
|
extern GdkWindow *_gdk_parent_root;
|
|
extern gint _gdk_error_code;
|
|
extern gint _gdk_error_warnings;
|
|
|
|
extern guint _gdk_debug_flags;
|
|
|
|
#ifdef G_ENABLE_DEBUG
|
|
|
|
#define GDK_NOTE(type,action) G_STMT_START { \
|
|
if (_gdk_debug_flags & GDK_DEBUG_##type) \
|
|
{ action; }; } G_STMT_END
|
|
|
|
#else /* !G_ENABLE_DEBUG */
|
|
|
|
#define GDK_NOTE(type,action)
|
|
|
|
#endif /* G_ENABLE_DEBUG */
|
|
|
|
/* Arg parsing */
|
|
|
|
typedef enum
|
|
{
|
|
GDK_ARG_STRING,
|
|
GDK_ARG_INT,
|
|
GDK_ARG_BOOL,
|
|
GDK_ARG_NOBOOL,
|
|
GDK_ARG_CALLBACK
|
|
} GdkArgType;
|
|
|
|
typedef struct _GdkArgContext GdkArgContext;
|
|
typedef struct _GdkArgDesc GdkArgDesc;
|
|
|
|
typedef void (*GdkArgFunc) (const char *name, const char *arg, gpointer data);
|
|
|
|
struct _GdkArgContext
|
|
{
|
|
GPtrArray *tables;
|
|
gpointer cb_data;
|
|
};
|
|
|
|
struct _GdkArgDesc
|
|
{
|
|
const char *name;
|
|
GdkArgType type;
|
|
gpointer location;
|
|
GdkArgFunc callback;
|
|
};
|
|
|
|
/* Event handling */
|
|
|
|
extern GdkEventFunc _gdk_event_func; /* Callback for events */
|
|
extern gpointer _gdk_event_data;
|
|
extern GDestroyNotify _gdk_event_notify;
|
|
|
|
/* FIFO's for event queue, and for events put back using
|
|
* gdk_event_put().
|
|
*/
|
|
extern GList *_gdk_queued_events;
|
|
extern GList *_gdk_queued_tail;
|
|
|
|
extern GdkDevice *_gdk_core_pointer;
|
|
|
|
GdkEvent* _gdk_event_new (void);
|
|
|
|
void _gdk_events_init (void);
|
|
void _gdk_events_queue (void);
|
|
GdkEvent* _gdk_event_unqueue (void);
|
|
|
|
GList* _gdk_event_queue_find_first (void);
|
|
void _gdk_event_queue_remove_link (GList *node);
|
|
void _gdk_event_queue_append (GdkEvent *event);
|
|
|
|
void _gdk_event_button_generate (GdkEvent *event);
|
|
|
|
#define GDK_SCRATCH_IMAGE_WIDTH 256
|
|
#define GDK_SCRATCH_IMAGE_HEIGHT 64
|
|
|
|
GdkImage* _gdk_image_new_for_depth (GdkImageType type,
|
|
GdkVisual *visual,
|
|
gint width,
|
|
gint height,
|
|
gint depth);
|
|
GdkImage *_gdk_image_get_scratch (gint width,
|
|
gint height,
|
|
gint depth,
|
|
gint *x,
|
|
gint *y);
|
|
|
|
/* Will most likely be exported in the future
|
|
*/
|
|
void _gdk_draw_pixbuf (GdkDrawable *drawable,
|
|
GdkGC *gc,
|
|
GdkPixbuf *pixbuf,
|
|
gint src_x,
|
|
gint src_y,
|
|
gint dest_x,
|
|
gint dest_y,
|
|
gint width,
|
|
gint height,
|
|
GdkRgbDither dither,
|
|
gint x_dither,
|
|
gint y_dither);
|
|
GdkImage *_gdk_drawable_copy_to_image (GdkDrawable *drawable,
|
|
GdkImage *image,
|
|
gint src_x,
|
|
gint src_y,
|
|
gint dest_x,
|
|
gint dest_y,
|
|
gint width,
|
|
gint height);
|
|
|
|
/*************************************
|
|
* Interfaces used by windowing code *
|
|
*************************************/
|
|
|
|
void _gdk_window_destroy (GdkWindow *window,
|
|
gboolean foreign_destroy);
|
|
void _gdk_window_clear_update_area (GdkWindow *window);
|
|
|
|
|
|
/*****************************************
|
|
* Interfaces provided by windowing code *
|
|
*****************************************/
|
|
|
|
/* Font/string functions implemented in module-specific code */
|
|
gint _gdk_font_strlen (GdkFont *font, const char *str);
|
|
void _gdk_font_destroy (GdkFont *font);
|
|
|
|
void _gdk_colormap_real_destroy (GdkColormap *colormap);
|
|
|
|
void _gdk_cursor_destroy (GdkCursor *cursor);
|
|
|
|
extern GdkArgDesc _gdk_windowing_args[];
|
|
gboolean _gdk_windowing_init_check (int argc,
|
|
char **argv);
|
|
void _gdk_windowing_window_get_offsets (GdkWindow *window,
|
|
gint *x_offset,
|
|
gint *y_offset);
|
|
void _gdk_windowing_window_clear_area (GdkWindow *window,
|
|
gint x,
|
|
gint y,
|
|
gint width,
|
|
gint height);
|
|
void _gdk_windowing_window_clear_area_e (GdkWindow *window,
|
|
gint x,
|
|
gint y,
|
|
gint width,
|
|
gint height);
|
|
|
|
GdkWindow* _gdk_windowing_window_at_pointer (GdkScreen *screen,
|
|
gint *win_x,
|
|
gint *win_y);
|
|
GdkWindow* _gdk_windowing_window_get_pointer (GdkWindow *window,
|
|
gint *x,
|
|
gint *y,
|
|
GdkModifierType *mask);
|
|
|
|
/* Return the number of bits-per-pixel for images of the specified depth.
|
|
* (Future: needs to be GdkDiplay specific.)
|
|
*/
|
|
gint _gdk_windowing_get_bits_for_depth (gint depth);
|
|
|
|
#define GDK_WINDOW_IS_MAPPED(window) ((((GdkWindowObject*)window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)
|
|
|
|
/* Called before processing updates for a window. This gives the windowing
|
|
* layer a chance to save the region for later use in avoiding duplicate
|
|
* exposes. The return value indicates whether the function has a saved
|
|
* the region; if the result is TRUE, then the windowing layer is responsible
|
|
* for destroying the region later.
|
|
*/
|
|
gboolean _gdk_windowing_window_queue_antiexpose (GdkWindow *window,
|
|
GdkRegion *area);
|
|
|
|
/* Called to do the windowing system specific part of gdk_window_destroy(),
|
|
*
|
|
* window: The window being destroyed
|
|
* recursing: If TRUE, then this is being called because a parent
|
|
* was destroyed. This generally means that the call to the windowing system
|
|
* to destroy the window can be omitted, since it will be destroyed as a result
|
|
* of the parent being destroyed. Unless @foreign_destroy
|
|
*
|
|
* foreign_destroy: If TRUE, the window or a parent was destroyed by some external
|
|
* agency. The window has already been destroyed and no windowing
|
|
* system calls should be made. (This may never happen for some
|
|
* windowing systems.)
|
|
*/
|
|
void _gdk_windowing_window_destroy (GdkWindow *window,
|
|
gboolean recursing,
|
|
gboolean foreign_destroy);
|
|
|
|
/* Implementation types */
|
|
GType _gdk_window_impl_get_type (void) G_GNUC_CONST;
|
|
GType _gdk_pixmap_impl_get_type (void) G_GNUC_CONST;
|
|
|
|
/************************************
|
|
* Initialization and exit routines *
|
|
************************************/
|
|
|
|
void _gdk_windowing_window_init (void);
|
|
void _gdk_visual_init (void);
|
|
void _gdk_dnd_init (void);
|
|
|
|
void _gdk_windowing_image_init (void);
|
|
void _gdk_image_exit (void);
|
|
|
|
void _gdk_input_init (void);
|
|
void _gdk_input_exit (void);
|
|
|
|
void _gdk_windowing_exit (void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* __GDK_INTERNALS_H__ */
|