Added virtual functions set_pixel, get_color, fill_span and draw_drawable

2000-11-15  Alexander Larsson  <alla@lysator.liu.se>

	* gdk/linux-fb/gdkprivate-fb.h:
	Added virtual functions set_pixel, get_color,
	fill_span and draw_drawable to the GC.
	Added global _gdk_fb_screen_gc to use instead of
	NULL when drawing to the screen.
	Added _gdk_fb_gc_calc_state() prototype.

	* gdk/linux-fb/gdkgc-fb.c:
	Call _gdk_fb_gc_calc_state() on any gc state change.

	* gdk/linux-fb/gdkglobals-fb.c:
	Add _gdk_fb_screen_gc

	* gdk/linux-fb/gdkdrawable-fb2.c:
	_gdk_fb_gc_calc_state() calculates best functions
	for the GC state and depth.
	Moved bpp specialized code to separate functions.
	Added optimized 24 bpp AA draw_drawable.

	* gdk/linux-fb/gdkevents-fb.c:
	Silence gcc warning.

	* gdk/linux-fb/gdkimage-fb.c:
	Use _gdk_fb_screen_gc

	* gdk/linux-fb/gdkwindow-fb.c:
	Init and use _gdk_fb_screen_gc

	* gdk/linux-fb/mitypes.h:
	Remove unused types.
This commit is contained in:
Alexander Larsson 2000-11-15 12:45:30 +00:00 committed by Alexander Larsson
parent 376d6c1914
commit 2eb744a3c4
15 changed files with 1330 additions and 514 deletions

View File

@ -1,3 +1,36 @@
2000-11-15 Alexander Larsson <alla@lysator.liu.se>
* gdk/linux-fb/gdkprivate-fb.h:
Added virtual functions set_pixel, get_color,
fill_span and draw_drawable to the GC.
Added global _gdk_fb_screen_gc to use instead of
NULL when drawing to the screen.
Added _gdk_fb_gc_calc_state() prototype.
* gdk/linux-fb/gdkgc-fb.c:
Call _gdk_fb_gc_calc_state() on any gc state change.
* gdk/linux-fb/gdkglobals-fb.c:
Add _gdk_fb_screen_gc
* gdk/linux-fb/gdkdrawable-fb2.c:
_gdk_fb_gc_calc_state() calculates best functions
for the GC state and depth.
Moved bpp specialized code to separate functions.
Added optimized 24 bpp AA draw_drawable.
* gdk/linux-fb/gdkevents-fb.c:
Silence gcc warning.
* gdk/linux-fb/gdkimage-fb.c:
Use _gdk_fb_screen_gc
* gdk/linux-fb/gdkwindow-fb.c:
Init and use _gdk_fb_screen_gc
* gdk/linux-fb/mitypes.h:
Remove unused types.
2000-11-14 Havoc Pennington <hp@pobox.com>
* gtk/gtktextlayout.c (add_cursor): use PANGO_PIXELS() to convert

View File

@ -1,3 +1,36 @@
2000-11-15 Alexander Larsson <alla@lysator.liu.se>
* gdk/linux-fb/gdkprivate-fb.h:
Added virtual functions set_pixel, get_color,
fill_span and draw_drawable to the GC.
Added global _gdk_fb_screen_gc to use instead of
NULL when drawing to the screen.
Added _gdk_fb_gc_calc_state() prototype.
* gdk/linux-fb/gdkgc-fb.c:
Call _gdk_fb_gc_calc_state() on any gc state change.
* gdk/linux-fb/gdkglobals-fb.c:
Add _gdk_fb_screen_gc
* gdk/linux-fb/gdkdrawable-fb2.c:
_gdk_fb_gc_calc_state() calculates best functions
for the GC state and depth.
Moved bpp specialized code to separate functions.
Added optimized 24 bpp AA draw_drawable.
* gdk/linux-fb/gdkevents-fb.c:
Silence gcc warning.
* gdk/linux-fb/gdkimage-fb.c:
Use _gdk_fb_screen_gc
* gdk/linux-fb/gdkwindow-fb.c:
Init and use _gdk_fb_screen_gc
* gdk/linux-fb/mitypes.h:
Remove unused types.
2000-11-14 Havoc Pennington <hp@pobox.com>
* gtk/gtktextlayout.c (add_cursor): use PANGO_PIXELS() to convert

View File

@ -1,3 +1,36 @@
2000-11-15 Alexander Larsson <alla@lysator.liu.se>
* gdk/linux-fb/gdkprivate-fb.h:
Added virtual functions set_pixel, get_color,
fill_span and draw_drawable to the GC.
Added global _gdk_fb_screen_gc to use instead of
NULL when drawing to the screen.
Added _gdk_fb_gc_calc_state() prototype.
* gdk/linux-fb/gdkgc-fb.c:
Call _gdk_fb_gc_calc_state() on any gc state change.
* gdk/linux-fb/gdkglobals-fb.c:
Add _gdk_fb_screen_gc
* gdk/linux-fb/gdkdrawable-fb2.c:
_gdk_fb_gc_calc_state() calculates best functions
for the GC state and depth.
Moved bpp specialized code to separate functions.
Added optimized 24 bpp AA draw_drawable.
* gdk/linux-fb/gdkevents-fb.c:
Silence gcc warning.
* gdk/linux-fb/gdkimage-fb.c:
Use _gdk_fb_screen_gc
* gdk/linux-fb/gdkwindow-fb.c:
Init and use _gdk_fb_screen_gc
* gdk/linux-fb/mitypes.h:
Remove unused types.
2000-11-14 Havoc Pennington <hp@pobox.com>
* gtk/gtktextlayout.c (add_cursor): use PANGO_PIXELS() to convert

View File

@ -1,3 +1,36 @@
2000-11-15 Alexander Larsson <alla@lysator.liu.se>
* gdk/linux-fb/gdkprivate-fb.h:
Added virtual functions set_pixel, get_color,
fill_span and draw_drawable to the GC.
Added global _gdk_fb_screen_gc to use instead of
NULL when drawing to the screen.
Added _gdk_fb_gc_calc_state() prototype.
* gdk/linux-fb/gdkgc-fb.c:
Call _gdk_fb_gc_calc_state() on any gc state change.
* gdk/linux-fb/gdkglobals-fb.c:
Add _gdk_fb_screen_gc
* gdk/linux-fb/gdkdrawable-fb2.c:
_gdk_fb_gc_calc_state() calculates best functions
for the GC state and depth.
Moved bpp specialized code to separate functions.
Added optimized 24 bpp AA draw_drawable.
* gdk/linux-fb/gdkevents-fb.c:
Silence gcc warning.
* gdk/linux-fb/gdkimage-fb.c:
Use _gdk_fb_screen_gc
* gdk/linux-fb/gdkwindow-fb.c:
Init and use _gdk_fb_screen_gc
* gdk/linux-fb/mitypes.h:
Remove unused types.
2000-11-14 Havoc Pennington <hp@pobox.com>
* gtk/gtktextlayout.c (add_cursor): use PANGO_PIXELS() to convert

View File

@ -1,3 +1,36 @@
2000-11-15 Alexander Larsson <alla@lysator.liu.se>
* gdk/linux-fb/gdkprivate-fb.h:
Added virtual functions set_pixel, get_color,
fill_span and draw_drawable to the GC.
Added global _gdk_fb_screen_gc to use instead of
NULL when drawing to the screen.
Added _gdk_fb_gc_calc_state() prototype.
* gdk/linux-fb/gdkgc-fb.c:
Call _gdk_fb_gc_calc_state() on any gc state change.
* gdk/linux-fb/gdkglobals-fb.c:
Add _gdk_fb_screen_gc
* gdk/linux-fb/gdkdrawable-fb2.c:
_gdk_fb_gc_calc_state() calculates best functions
for the GC state and depth.
Moved bpp specialized code to separate functions.
Added optimized 24 bpp AA draw_drawable.
* gdk/linux-fb/gdkevents-fb.c:
Silence gcc warning.
* gdk/linux-fb/gdkimage-fb.c:
Use _gdk_fb_screen_gc
* gdk/linux-fb/gdkwindow-fb.c:
Init and use _gdk_fb_screen_gc
* gdk/linux-fb/mitypes.h:
Remove unused types.
2000-11-14 Havoc Pennington <hp@pobox.com>
* gtk/gtktextlayout.c (add_cursor): use PANGO_PIXELS() to convert

View File

@ -1,3 +1,36 @@
2000-11-15 Alexander Larsson <alla@lysator.liu.se>
* gdk/linux-fb/gdkprivate-fb.h:
Added virtual functions set_pixel, get_color,
fill_span and draw_drawable to the GC.
Added global _gdk_fb_screen_gc to use instead of
NULL when drawing to the screen.
Added _gdk_fb_gc_calc_state() prototype.
* gdk/linux-fb/gdkgc-fb.c:
Call _gdk_fb_gc_calc_state() on any gc state change.
* gdk/linux-fb/gdkglobals-fb.c:
Add _gdk_fb_screen_gc
* gdk/linux-fb/gdkdrawable-fb2.c:
_gdk_fb_gc_calc_state() calculates best functions
for the GC state and depth.
Moved bpp specialized code to separate functions.
Added optimized 24 bpp AA draw_drawable.
* gdk/linux-fb/gdkevents-fb.c:
Silence gcc warning.
* gdk/linux-fb/gdkimage-fb.c:
Use _gdk_fb_screen_gc
* gdk/linux-fb/gdkwindow-fb.c:
Init and use _gdk_fb_screen_gc
* gdk/linux-fb/mitypes.h:
Remove unused types.
2000-11-14 Havoc Pennington <hp@pobox.com>
* gtk/gtktextlayout.c (add_cursor): use PANGO_PIXELS() to convert

View File

@ -1,3 +1,36 @@
2000-11-15 Alexander Larsson <alla@lysator.liu.se>
* gdk/linux-fb/gdkprivate-fb.h:
Added virtual functions set_pixel, get_color,
fill_span and draw_drawable to the GC.
Added global _gdk_fb_screen_gc to use instead of
NULL when drawing to the screen.
Added _gdk_fb_gc_calc_state() prototype.
* gdk/linux-fb/gdkgc-fb.c:
Call _gdk_fb_gc_calc_state() on any gc state change.
* gdk/linux-fb/gdkglobals-fb.c:
Add _gdk_fb_screen_gc
* gdk/linux-fb/gdkdrawable-fb2.c:
_gdk_fb_gc_calc_state() calculates best functions
for the GC state and depth.
Moved bpp specialized code to separate functions.
Added optimized 24 bpp AA draw_drawable.
* gdk/linux-fb/gdkevents-fb.c:
Silence gcc warning.
* gdk/linux-fb/gdkimage-fb.c:
Use _gdk_fb_screen_gc
* gdk/linux-fb/gdkwindow-fb.c:
Init and use _gdk_fb_screen_gc
* gdk/linux-fb/mitypes.h:
Remove unused types.
2000-11-14 Havoc Pennington <hp@pobox.com>
* gtk/gtktextlayout.c (add_cursor): use PANGO_PIXELS() to convert

File diff suppressed because it is too large Load Diff

View File

@ -204,7 +204,7 @@ fb_events_dispatch (gpointer source_data,
GDK_THREADS_ENTER ();
while (event = gdk_event_unqueue ())
while ((event = gdk_event_unqueue ()))
{
if (event->type == GDK_EXPOSE &&
event->expose.window == gdk_parent_root)

View File

@ -74,15 +74,19 @@ _gdk_fb_gc_new (GdkDrawable *drawable,
GdkGCValuesMask values_mask)
{
GdkGC *gc;
GdkGC *private;
GdkGCFBData *data;
GdkGCFBData *private;
gc = GDK_GC (g_object_new (gdk_gc_fb_get_type (), NULL));
private = (GdkGC *)gc;
data = (GdkGCFBData *)gc;
data->values.foreground.pixel = 255;
data->values.foreground.red = data->values.foreground.green = data->values.foreground.blue = 65535;
private = (GdkGCFBData *)gc;
private->depth = GDK_DRAWABLE_FBDATA (drawable)->depth;
private->values.foreground.pixel = 255;
private->values.foreground.red =
private->values.foreground.green =
private->values.foreground.blue = 65535;
_gdk_fb_gc_calc_state (gc, _GDK_FB_GC_DEPTH);
gdk_fb_gc_set_values (gc, values, values_mask);
@ -259,6 +263,8 @@ gdk_fb_gc_set_values (GdkGC *gc,
private->values.join_style = values->join_style;
private->values_mask |= GDK_GC_JOIN_STYLE;
}
_gdk_fb_gc_calc_state (gc, values_mask);
}
static void
@ -298,6 +304,8 @@ gc_unset_cmask(GdkGC *gc)
data->values.clip_mask = NULL;
data->values_mask &= ~ GDK_GC_CLIP_MASK;
}
_gdk_fb_gc_calc_state (gc, GDK_GC_CLIP_MASK);
}
void
@ -326,6 +334,8 @@ gdk_gc_set_clip_rectangle (GdkGC *gc,
data->values.clip_y_origin = 0;
gc_unset_cmask (gc);
_gdk_fb_gc_calc_state (gc, GDK_GC_CLIP_X_ORIGIN|GDK_GC_CLIP_Y_ORIGIN);
}
void
@ -357,6 +367,8 @@ gdk_gc_set_clip_region (GdkGC *gc,
data->values.clip_y_origin = 0;
gc_unset_cmask (gc);
_gdk_fb_gc_calc_state (gc, GDK_GC_CLIP_X_ORIGIN|GDK_GC_CLIP_Y_ORIGIN);
}

View File

@ -39,3 +39,4 @@ GdkEventMask _gdk_fb_pointer_grab_events, _gdk_fb_keyboard_grab_events;
GdkFBWindow *gdk_root_window = NULL;
GdkFBDisplay *gdk_display = NULL;
GdkCursor *_gdk_fb_pointer_grab_cursor;
GdkGC *_gdk_fb_screen_gc = NULL;

View File

@ -201,7 +201,7 @@ _gdk_fb_get_image (GdkDrawable *drawable,
fbd.drawable_data.window_type = GDK_DRAWABLE_PIXMAP;
gdk_fb_draw_drawable_2 ((GdkPixmap *)&fbd,
NULL,
_gdk_fb_screen_gc,
drawable,
x, y,
0, 0,

View File

@ -57,6 +57,8 @@
typedef struct _GdkDrawableFBData GdkDrawableFBData;
typedef struct _GdkWindowFBData GdkWindowFBData;
typedef struct _GdkPixmapFBData GdkPixmapFBData;
typedef struct _GdkFBDrawingContext GdkFBDrawingContext;
#define GDK_DRAWABLE_PIXMAP (GDK_WINDOW_FOREIGN+1)
struct _GdkDrawableFBData
@ -161,6 +163,36 @@ typedef struct {
#define GDK_GC_FBDATA(x) ((GdkGCFBData *)(x))
#define GDK_GC_P(x) ((GdkGC *)(x))
typedef enum {
GPR_USED_BG,
GPR_AA_GRAYVAL,
GPR_NONE,
GPR_ERR_BOUNDS
} GetPixelRet;
typedef enum {
GDK_FB_SRC_BPP_1,
GDK_FB_SRC_BPP_8,
GDK_FB_SRC_BPP_16,
GDK_FB_SRC_BPP_24,
GDK_FB_SRC_BPP_32,
GDK_FB_SRC_BPP_7_AA_GRAYVAL,
GDK_FB_SRC_BPP_8_AA_GRAYVAL,
GDK_NUM_FB_SRCBPP
} GdkFbSrcBPP;
typedef void gdk_fb_draw_drawable_func (GdkDrawable *drawable,
GdkGC *gc,
GdkPixmap *src,
GdkFBDrawingContext *dc,
gint start_y,
gint end_y,
gint start_x,
gint end_x,
gint src_x_off,
gint src_y_off,
gint draw_direction);
typedef struct {
GdkGC parent_instance;
@ -170,48 +202,88 @@ typedef struct {
GdkGCValues values;
gint dash_offset;
gushort dash_list_len;
guchar depth, alu;
guchar alu;
/* The GC can only be used with target drawables of
* the same depth as the initial drawable
* specified in gd_gc_new().
*/
guchar depth;
/* Calculated state: */
/* These functions can only be called for drawables
* that have the same depth as the gc.
*/
void (*set_pixel) (GdkDrawable *drawable,
GdkGC *gc,
int x,
int y,
gulong pixel);
GetPixelRet (*get_color) (GdkDrawable *drawable,
GdkGC *gc,
int x,
int y,
GdkColor *color);
void (*fill_span) (GdkDrawable *drawable,
GdkGC *gc,
GdkSegment *cur,
GdkColor *color);
gdk_fb_draw_drawable_func *draw_drawable[GDK_NUM_FB_SRCBPP];
} GdkGCFBData;
typedef struct {
GdkGCClass parent_class;
} GdkGCFBClass;
extern GdkGC *_gdk_fb_screen_gc;
GType gdk_gc_fb_get_type (void) G_GNUC_CONST;
/* Routines from gdkgeometry-fb.c */
void _gdk_window_init_position (GdkWindow *window);
void _gdk_window_move_resize_child (GdkWindow *window,
gint x,
gint y,
gint width,
gint height);
void _gdk_window_process_expose (GdkWindow *window,
gulong serial,
GdkRectangle *area);
void gdk_window_invalidate_region_clear(GdkWindow *window, GdkRegion *region);
void gdk_window_invalidate_rect_clear(GdkWindow *window, GdkRectangle *rect);
GdkGC *_gdk_fb_gc_new(GdkDrawable *drawable, GdkGCValues *values, GdkGCValuesMask values_mask);
void _gdk_window_init_position (GdkWindow *window);
void _gdk_window_move_resize_child (GdkWindow *window,
gint x,
gint y,
gint width,
gint height);
void _gdk_window_process_expose (GdkWindow *window,
gulong serial,
GdkRectangle *area);
void gdk_window_invalidate_region_clear (GdkWindow *window,
GdkRegion *region);
void gdk_window_invalidate_rect_clear (GdkWindow *window,
GdkRectangle *rect);
GdkImage*_gdk_fb_get_image (GdkDrawable *drawable,
gint x,
gint y,
gint width,
gint height);
void gdk_fb_drawable_clear (GdkDrawable *drawable);
void gdk_fb_draw_drawable (GdkDrawable *drawable,
GdkGC *gc,
GdkPixmap *src,
gint xsrc,
gint ysrc,
gint xdest,
gint ydest,
gint width,
gint height);
GdkGC * _gdk_fb_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
typedef struct {
#define _GDK_FB_GC_DEPTH (1<<31)
void _gdk_fb_gc_calc_state (GdkGC *gc,
GdkGCValuesMask changed);
GdkImage *_gdk_fb_get_image (GdkDrawable *drawable,
gint x,
gint y,
gint width,
gint height);
void gdk_fb_drawable_clear (GdkDrawable *drawable);
void gdk_fb_draw_drawable (GdkDrawable *drawable,
GdkGC *gc,
GdkPixmap *src,
gint xsrc,
gint ysrc,
gint xdest,
gint ydest,
gint width,
gint height);
struct _GdkFBDrawingContext {
GdkWindow *bg_relto;
GdkPixmap *bgpm;
@ -226,7 +298,7 @@ typedef struct {
gboolean draw_bg : 1;
gboolean copy_region : 1;
gboolean handle_cursor : 1;
} GdkFBDrawingContext;
};
void gdk_fb_drawing_context_init(GdkFBDrawingContext *dc, GdkDrawable *drawable,
GdkGC *gc, gboolean draw_bg, gboolean do_clipping);

View File

@ -135,6 +135,9 @@ _gdk_windowing_window_init (void)
GDK_DRAWABLE_IMPL_FBDATA (gdk_parent_root)->lim_x = attr.width;
GDK_DRAWABLE_IMPL_FBDATA (gdk_parent_root)->lim_y = attr.height;
_gdk_fb_screen_gc = gdk_gc_new (gdk_parent_root);
gdk_fb_drawable_clear (gdk_parent_root);
}
@ -871,7 +874,9 @@ gdk_fb_window_move_resize (GdkWindow *window,
{
GdkRegionBox *reg = ltmp->data;
gdk_fb_draw_drawable_3 (GDK_DRAWABLE_IMPL(gdk_parent_root), NULL, GDK_DRAWABLE_IMPL(gdk_parent_root),
gdk_fb_draw_drawable_3 (GDK_DRAWABLE_IMPL(gdk_parent_root),
_gdk_fb_screen_gc,
GDK_DRAWABLE_IMPL(gdk_parent_root),
&fbdc,
(reg->x1 - dx),
(reg->y1 - dy),
@ -1018,7 +1023,7 @@ _gdk_windowing_window_clear_area (GdkWindow *window,
xstep = GDK_DRAWABLE_IMPL_FBDATA (bgpm)->width - draww;
gdk_fb_draw_drawable_3 (GDK_DRAWABLE_IMPL (window),
NULL,
_gdk_fb_screen_gc,
GDK_DRAWABLE_IMPL (bgpm),
&fbdc,
draww, drawh,
@ -1030,7 +1035,7 @@ _gdk_windowing_window_clear_area (GdkWindow *window,
gdk_fb_drawing_context_finalize (&fbdc);
}
else if (!bgpm)
gdk_fb_draw_rectangle (GDK_DRAWABLE_IMPL (window), NULL, TRUE, x, y, width, height);
gdk_fb_draw_rectangle (GDK_DRAWABLE_IMPL (window), _gdk_fb_screen_gc, TRUE, x, y, width, height);
}
/* What's the diff? */

View File

@ -23,16 +23,9 @@ typedef struct _miDash *miDashPtr;
#define CT_YXSORTED 14
#define CT_YXBANDED 18
typedef union {
guint32 val;
gpointer ptr;
} ChangeGCVal, *ChangeGCValPtr;
#define PixmapBytePad(w, d) (w)
#define BitmapBytePad(w) (w)
typedef GdkSegment BoxRec, *BoxPtr;
typedef struct _miArc {
gint16 x, y;
guint16 width, height;