forked from AuroraMiddleware/gtk
i2000-11-22 Alexander Larsson <alexl@redhat.com>
* gdk/gdktypes.h: Add new type GdkSpan * docs/reference/gdk/gdk-sections.txt, docs/reference/gdk/tmpl/regions.sgml, gdk/gdkregion-generic.c, gdk/gdkregion.h: Implement and document gdk_region_spans_intersect_foreach. * gdk/linux-fb/Makefile.am, gdk/linux-fb/gdkrender-fb.c: Add new file gdkrender-fb.c which contains all core rendering code. Add gdk_fb_fill_rectangle_generic (old rectangle code) and gdk_fb_fill_rectangle_simple_16, gdk_fb_fill_rectangle_simple_32 (optimized rectangle fillers). * gdk/linux-fb/gdkdrawable-fb2.c: Move all rendering code to gdkrender-fb.c. Change from using GdkRectangles and GdkSegments for spans to GdkSpan. Use the new span intersection functions in gdk_fb_fill_spans. gdk_fb_draw_rectangle() clips filled rectangles and calls gc->fill_rectangle with the result. gdk_fb_fill_spans() gets extra argument "sorted". * gdk/linux-fb/gdkevents-fb.c: Remove unused includes and defines. New function gdk_fb_get_time() to get correct time for events. * gdk/linux-fb/gdkinput-ps2.c: Use gdk method of generating multiple-clicks (gdk_event_button_generate) Make sure to set the time of all events. * gdk/linux-fb/gdkmain-fb.c: Use gdk_fb_get_time (). * gdk/linux-fb/gdkprivate-fb.h: New virtual GC calls: fill_span & fill_rectangle. Export gdk_fb_get_time(). gdk_fb_fill_spans() gets extra argument "sorted". * gdk/linux-fb/mi*.c: Use GdkSpan instead of GdkRectangle. Pass correct sorted to gdk_fb_fill_spans. (sorted value taken from XFree 4 source)
This commit is contained in:
parent
c76c5f4857
commit
5b4c8afa7e
@ -620,6 +620,12 @@ gdk_region_intersect
|
||||
gdk_region_union
|
||||
gdk_region_subtract
|
||||
gdk_region_xor
|
||||
|
||||
<SUBSECTION>
|
||||
GdkSpan
|
||||
GdkSpanFunc
|
||||
gdk_region_spans_intersect_foreach
|
||||
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
|
@ -6,8 +6,8 @@ simple graphical data types.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
GDK provides the #GdkPoint, #GdkRectangle and #GdkRegion data types for
|
||||
representing pixels and sets of pixels on the screen.
|
||||
GDK provides the #GdkPoint, #GdkRectangle, #GdkRegion and #GdkSpan data types
|
||||
for representing pixels and sets of pixels on the screen.
|
||||
</para>
|
||||
<para>
|
||||
#GdkPoint is a simple structure containing an x and y coordinate of a point.
|
||||
@ -22,6 +22,11 @@ gdk_rectangle_union().
|
||||
#GdkRegion is an opaque data type holding a set of arbitrary pixels, and is
|
||||
usually used for clipping graphical operations (see gdk_gc_set_clip_region()).
|
||||
</para>
|
||||
<para>
|
||||
#GdkSpan is a structure holding a spanline. A spanline is a horizontal line that
|
||||
is one pixel wide. It is mainly used when rasterizing other graphics primitives.
|
||||
It can be intersected to regions by using gdk_region_spans_intersect_foreach().
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
@ -261,3 +266,36 @@ Returns the union of a region and a rectangle.
|
||||
@source2:
|
||||
|
||||
|
||||
<!-- ##### STRUCT GdkSpan ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@x:
|
||||
@y:
|
||||
@width:
|
||||
|
||||
<!-- ##### USER_FUNCTION GdkSpanFunc ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@span: The intersected part of the span.
|
||||
@data: Opaque data passed by user.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_region_spans_intersect_foreach ##### -->
|
||||
<para>
|
||||
Intersects a set of spans with a region and call a user specified
|
||||
function for each resulting spanline. This function is a lot more effective
|
||||
if the spans are sorted.
|
||||
</para>
|
||||
|
||||
@region: The region to intersect against.
|
||||
@spans: Array of spans to intersect.
|
||||
@n_spans: Number of spans.
|
||||
@sorted: True if the spans are sorted in increasing y order.
|
||||
@function: The function to call for each intersected spanline.
|
||||
@data: Opaque user data passed to function.
|
||||
|
||||
|
||||
|
@ -1505,3 +1505,153 @@ gdk_region_rect_in (GdkRegion *region,
|
||||
GDK_OVERLAP_RECTANGLE_PART : GDK_OVERLAP_RECTANGLE_IN) :
|
||||
GDK_OVERLAP_RECTANGLE_OUT);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gdk_region_unsorted_spans_intersect_foreach (GdkRegion *region,
|
||||
GdkSpan *spans,
|
||||
int n_spans,
|
||||
GdkSpanFunc function,
|
||||
gpointer data)
|
||||
{
|
||||
gint i, left, right, y;
|
||||
gint clipped_left, clipped_right;
|
||||
GdkRegionBox *pbox;
|
||||
GdkRegionBox *pboxEnd;
|
||||
GdkSpan out_span;
|
||||
|
||||
if (!region->numRects)
|
||||
return;
|
||||
|
||||
for (i=0;i<n_spans;i++)
|
||||
{
|
||||
y = spans[i].y;
|
||||
left = spans[i].x;
|
||||
right = left + spans[i].width; /* right is not in the span! */
|
||||
|
||||
if (! ((region->extents.y1 <= y) &&
|
||||
(region->extents.y2 > y) &&
|
||||
(region->extents.x1 < right) &&
|
||||
(region->extents.x2 > left)) )
|
||||
continue;
|
||||
|
||||
/* can stop when we passed y */
|
||||
for (pbox = region->rects, pboxEnd = pbox + region->numRects;
|
||||
pbox < pboxEnd;
|
||||
pbox++)
|
||||
{
|
||||
if (pbox->y2 <= y)
|
||||
continue; /* Not quite there yet */
|
||||
|
||||
if (pbox->y1 > y)
|
||||
break; /* passed the spanline */
|
||||
|
||||
if ((right > pbox->x1) && (left < pbox->x2))
|
||||
{
|
||||
clipped_left = MAX (left, pbox->x1);
|
||||
clipped_right = MIN (right, pbox->x2);
|
||||
|
||||
out_span.y = y;
|
||||
out_span.x = clipped_left;
|
||||
out_span.width = clipped_right - clipped_left;
|
||||
(*function) (&out_span, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gdk_region_spans_intersect_foreach (GdkRegion *region,
|
||||
GdkSpan *spans,
|
||||
int n_spans,
|
||||
gboolean sorted,
|
||||
GdkSpanFunc function,
|
||||
gpointer data)
|
||||
{
|
||||
gint left, right, y;
|
||||
gint clipped_left, clipped_right;
|
||||
GdkRegionBox *pbox;
|
||||
GdkRegionBox *pboxEnd;
|
||||
GdkSpan *span, *tmpspan;
|
||||
GdkSpan *end_span;
|
||||
GdkSpan out_span;
|
||||
|
||||
if (!sorted)
|
||||
{
|
||||
gdk_region_unsorted_spans_intersect_foreach (region,
|
||||
spans,
|
||||
n_spans,
|
||||
function,
|
||||
data);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((!region->numRects) || (n_spans == 0))
|
||||
return;
|
||||
|
||||
y = span->y;
|
||||
left = span->x;
|
||||
right = span->x + span->width; /* right is not in the span! */
|
||||
|
||||
/* The main method here is to step along the
|
||||
* sorted rectangles and spans in lock step, and
|
||||
* clipping the spans that are in the current
|
||||
* rectangle before going on to the next rectangle.
|
||||
*/
|
||||
|
||||
span = spans;
|
||||
end_span = spans + n_spans;
|
||||
pbox = region->rects;
|
||||
pboxEnd = pbox + region->numRects;
|
||||
while (pbox < pboxEnd)
|
||||
{
|
||||
while ((pbox->y2 < span->y) || (span->y < pbox->y1))
|
||||
{
|
||||
/* Skip any rectangles that are above the current span */
|
||||
if (pbox->y2 < span->y)
|
||||
{
|
||||
pbox++;
|
||||
if (pbox == pboxEnd)
|
||||
return;
|
||||
}
|
||||
/* Skip any spans that are above the current rectangle */
|
||||
if (span->y < pbox->y1)
|
||||
{
|
||||
span++;
|
||||
if (span == end_span)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Ok, we got at least one span that might intersect this rectangle. */
|
||||
tmpspan = span;
|
||||
while ((tmpspan < end_span) &&
|
||||
(tmpspan->y < pbox->y2))
|
||||
{
|
||||
y = tmpspan->y;
|
||||
left = tmpspan->x;
|
||||
right = left + tmpspan->width; /* right is not in the span! */
|
||||
|
||||
if ((right > pbox->x1) && (left < pbox->x2))
|
||||
{
|
||||
clipped_left = MAX (left, pbox->x1);
|
||||
clipped_right = MIN (right, pbox->x2);
|
||||
|
||||
out_span.y = y;
|
||||
out_span.x = clipped_left;
|
||||
out_span.width = clipped_right - clipped_left;
|
||||
(*function) (&out_span, data);
|
||||
}
|
||||
|
||||
tmpspan++;
|
||||
}
|
||||
|
||||
/* Finished this rectangle.
|
||||
* The spans could still intersect the next one
|
||||
*/
|
||||
pbox++;
|
||||
}
|
||||
|
||||
return spans;
|
||||
}
|
||||
|
@ -29,6 +29,9 @@ typedef enum
|
||||
GDK_OVERLAP_RECTANGLE_PART
|
||||
} GdkOverlapType;
|
||||
|
||||
typedef void (*GdkSpanFunc) (GdkSpan *span,
|
||||
gpointer data);
|
||||
|
||||
GdkRegion *gdk_region_new (void);
|
||||
GdkRegion *gdk_region_polygon (GdkPoint *points,
|
||||
gint npoints,
|
||||
@ -66,8 +69,16 @@ void gdk_region_subtract (GdkRegion *source1,
|
||||
void gdk_region_xor (GdkRegion *source1,
|
||||
GdkRegion *source2);
|
||||
|
||||
void gdk_region_spans_intersect_foreach (GdkRegion *region,
|
||||
GdkSpan *spans,
|
||||
int n_spans,
|
||||
gboolean sorted,
|
||||
GdkSpanFunc function,
|
||||
gpointer data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __GDK_REGION_H__ */
|
||||
|
||||
|
@ -67,6 +67,7 @@ extern "C" {
|
||||
typedef struct _GdkPoint GdkPoint;
|
||||
typedef struct _GdkRectangle GdkRectangle;
|
||||
typedef struct _GdkSegment GdkSegment;
|
||||
typedef struct _GdkSpan GdkSpan;
|
||||
|
||||
/*
|
||||
* Note that on some platforms the wchar_t type
|
||||
@ -184,6 +185,13 @@ struct _GdkSegment
|
||||
gint y2;
|
||||
};
|
||||
|
||||
struct _GdkSpan
|
||||
{
|
||||
gint x;
|
||||
gint y;
|
||||
gint width;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
@ -50,6 +50,7 @@ libgdk_linux_fb_la_SOURCES = \
|
||||
gdkinputprivate.h \
|
||||
gdkinput-ps2.c \
|
||||
gdkevents-fb.c \
|
||||
gdkrender-fb.c \
|
||||
mi.h \
|
||||
miarc.c \
|
||||
midash.c \
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -29,63 +29,6 @@
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkfb.h"
|
||||
|
||||
#include "gdkkeysyms.h"
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
# if STDC_HEADERS
|
||||
# include <string.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
typedef struct _GdkIOClosure GdkIOClosure;
|
||||
typedef struct _GdkEventPrivate GdkEventPrivate;
|
||||
|
||||
#define DOUBLE_CLICK_TIME 250
|
||||
#define TRIPLE_CLICK_TIME 500
|
||||
#define DOUBLE_CLICK_DIST 5
|
||||
#define TRIPLE_CLICK_DIST 5
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* Following flag is set for events on the event queue during
|
||||
* translation and cleared afterwards.
|
||||
*/
|
||||
GDK_EVENT_PENDING = 1 << 0
|
||||
} GdkEventFlags;
|
||||
|
||||
struct _GdkIOClosure
|
||||
{
|
||||
GdkInputFunction function;
|
||||
GdkInputCondition condition;
|
||||
GdkDestroyNotify notify;
|
||||
gpointer data;
|
||||
};
|
||||
|
||||
struct _GdkEventPrivate
|
||||
{
|
||||
GdkEvent event;
|
||||
guint flags;
|
||||
};
|
||||
|
||||
/*
|
||||
* Private function declarations
|
||||
*/
|
||||
|
||||
/* Private variable declarations
|
||||
*/
|
||||
|
||||
#if 0
|
||||
static GList *client_filters; /* Filters for client messages */
|
||||
|
||||
static GSourceFuncs event_funcs = {
|
||||
gdk_event_prepare,
|
||||
gdk_event_check,
|
||||
gdk_event_dispatch,
|
||||
(GDestroyNotify)g_free
|
||||
};
|
||||
#endif
|
||||
|
||||
/*********************************************
|
||||
* Functions for maintaining the event queue *
|
||||
*********************************************/
|
||||
@ -101,6 +44,15 @@ static gboolean fb_events_dispatch (gpointer source_data,
|
||||
GTimeVal *dispatch_time,
|
||||
gpointer user_data);
|
||||
|
||||
guint32
|
||||
gdk_fb_get_time(void)
|
||||
{
|
||||
GTimeVal tv;
|
||||
|
||||
g_get_current_time (&tv);
|
||||
return (guint32) tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_events_init (void)
|
||||
{
|
||||
|
@ -76,9 +76,6 @@ static Keyboard * tty_keyboard_open(void);
|
||||
static MouseDevice *gdk_fb_mouse = NULL;
|
||||
static Keyboard *keyboard = NULL;
|
||||
|
||||
static guint multiclick_tag;
|
||||
static GdkEvent *multiclick_event = NULL;
|
||||
|
||||
#ifndef VESA_NO_BLANKING
|
||||
#define VESA_NO_BLANKING 0
|
||||
#define VESA_VSYNC_SUSPEND 1
|
||||
@ -110,33 +107,11 @@ input_activity (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static gboolean
|
||||
click_event_timeout (gpointer x)
|
||||
{
|
||||
switch (multiclick_event->type)
|
||||
{
|
||||
case GDK_BUTTON_RELEASE:
|
||||
gdk_event_free (multiclick_event);
|
||||
break;
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
gdk_event_queue_append (multiclick_event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
multiclick_event = NULL;
|
||||
multiclick_tag = 0;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
send_button_event (MouseDevice *mouse,
|
||||
guint button,
|
||||
gboolean press_event,
|
||||
time_t the_time)
|
||||
guint32 the_time)
|
||||
{
|
||||
GdkEvent *event;
|
||||
gint x, y;
|
||||
@ -152,35 +127,6 @@ send_button_event (MouseDevice *mouse,
|
||||
x = mouse->x - x;
|
||||
y = mouse->y - y;
|
||||
|
||||
if (!press_event &&
|
||||
multiclick_event &&
|
||||
multiclick_event->button.button == button &&
|
||||
multiclick_event->button.window == window &&
|
||||
ABS(multiclick_event->button.x - x) < 3 &&
|
||||
ABS(multiclick_event->button.y - y) < 3)
|
||||
{
|
||||
multiclick_event->button.time = the_time;
|
||||
|
||||
/* Just change multiclick_event into a different event */
|
||||
switch (multiclick_event->button.type)
|
||||
{
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
|
||||
case GDK_BUTTON_RELEASE:
|
||||
multiclick_event->button.type = GDK_2BUTTON_PRESS;
|
||||
return;
|
||||
|
||||
case GDK_2BUTTON_PRESS:
|
||||
multiclick_event->button.type = GDK_3BUTTON_PRESS;
|
||||
return;
|
||||
|
||||
case GDK_3BUTTON_PRESS:
|
||||
gdk_event_queue_append (multiclick_event); multiclick_event = NULL;
|
||||
g_source_remove (multiclick_tag); multiclick_tag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
event = gdk_event_make (window, press_event ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE, FALSE);
|
||||
|
||||
if (!event)
|
||||
@ -219,6 +165,8 @@ send_button_event (MouseDevice *mouse,
|
||||
mouse->click_grab = FALSE;
|
||||
}
|
||||
|
||||
event->button.time = the_time;
|
||||
|
||||
#if 0
|
||||
g_message ("Button #%d %s [%d, %d] in %p",
|
||||
button, press_event?"pressed":"released",
|
||||
@ -237,11 +185,9 @@ send_button_event (MouseDevice *mouse,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!press_event && !multiclick_tag)
|
||||
{
|
||||
multiclick_tag = g_timeout_add (250, click_event_timeout, NULL);
|
||||
multiclick_event = gdk_event_copy (event);
|
||||
}
|
||||
/* For double-clicks */
|
||||
if (press_event)
|
||||
gdk_event_button_generate (event);
|
||||
|
||||
gdk_event_queue_append (event);
|
||||
}
|
||||
@ -598,6 +544,7 @@ handle_mouse_input(MouseDevice *mouse,
|
||||
event->motion.device = gdk_core_pointer;
|
||||
event->motion.x_root = mouse->x;
|
||||
event->motion.y_root = mouse->y;
|
||||
event->motion.time = gdk_fb_get_time ();
|
||||
}
|
||||
|
||||
if (win != mouse->prev_window)
|
||||
@ -732,11 +679,10 @@ handle_input_fidmour (GIOChannel *gioc,
|
||||
gdouble x, y, oldx, oldy;
|
||||
gboolean got_motion = FALSE;
|
||||
gboolean btn_down;
|
||||
time_t the_time;
|
||||
GTimeVal tv;
|
||||
guint32 the_time;
|
||||
|
||||
g_get_current_time (&tv);
|
||||
the_time = tv.tv_sec;
|
||||
the_time = gdk_fb_get_time ();
|
||||
|
||||
oldx = mouse->x;
|
||||
oldy = mouse->y;
|
||||
while (pull_fidmour_packet (mouse, &btn_down, &x, &y))
|
||||
@ -775,13 +721,11 @@ handle_input_ps2 (GIOChannel *gioc,
|
||||
MouseDevice *mouse = data;
|
||||
int n, dx=0, dy=0;
|
||||
gboolean new_button1, new_button2, new_button3;
|
||||
time_t the_time;
|
||||
GTimeVal curtime;
|
||||
guint32 the_time;
|
||||
gboolean got_motion = FALSE;
|
||||
guchar *buf;
|
||||
|
||||
g_get_current_time (&curtime);
|
||||
the_time = curtime.tv_usec;
|
||||
the_time = gdk_fb_get_time ();
|
||||
|
||||
while (1) /* Go through as many mouse events as we can */
|
||||
{
|
||||
@ -862,11 +806,9 @@ handle_input_ms (GIOChannel *gioc,
|
||||
guchar byte1, byte2, byte3;
|
||||
int n, dx=0, dy=0;
|
||||
gboolean new_button1, new_button2, new_button3;
|
||||
time_t the_time;
|
||||
GTimeVal curtime;
|
||||
guint32 the_time;
|
||||
|
||||
g_get_current_time (&curtime);
|
||||
the_time = curtime.tv_usec;
|
||||
the_time = gdk_fb_get_time ();
|
||||
|
||||
n = read (mouse->fd, &byte1, 1);
|
||||
if ( (n!=1) || (byte1 & 0x40) != 0x40)
|
||||
@ -1405,16 +1347,14 @@ handle_mediumraw_keyboard_input (GIOChannel *gioc,
|
||||
guchar buf[128];
|
||||
int i, n;
|
||||
Keyboard *k = data;
|
||||
time_t now;
|
||||
GTimeVal curtime;
|
||||
guint32 now;
|
||||
|
||||
n = read (k->fd, buf, sizeof(buf));
|
||||
if (n <= 0)
|
||||
g_error("Nothing from keyboard!");
|
||||
|
||||
/* Now turn this into a keyboard event */
|
||||
g_get_current_time (&curtime);
|
||||
now = curtime.tv_sec;
|
||||
now = gdk_fb_get_time ();
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
@ -1556,16 +1496,14 @@ handle_xlate_keyboard_input (GIOChannel *gioc,
|
||||
guchar buf[128];
|
||||
int i, n;
|
||||
Keyboard *k = data;
|
||||
time_t now;
|
||||
GTimeVal curtime;
|
||||
guint32 now;
|
||||
|
||||
n = read (k->fd, buf, sizeof(buf));
|
||||
if (n <= 0)
|
||||
g_error ("Nothing from keyboard!");
|
||||
|
||||
/* Now turn this into a keyboard event */
|
||||
g_get_current_time (&curtime);
|
||||
now = curtime.tv_sec;
|
||||
now = gdk_fb_get_time ();
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
|
@ -991,10 +991,9 @@ gdk_event_make (GdkWindow *window,
|
||||
guint32 the_time = g_latest_time.tv_sec * 1000 + g_latest_time.tv_usec / 1000;
|
||||
#else
|
||||
guint32 the_time;
|
||||
GTimeVal gcurtime;
|
||||
|
||||
g_get_current_time (&gcurtime);
|
||||
the_time = gcurtime.tv_sec * 1000 + gcurtime.tv_usec / 1000;
|
||||
|
||||
the_time = gdk_fb_get_time ();
|
||||
#endif
|
||||
|
||||
event->any.type = type;
|
||||
|
@ -215,7 +215,7 @@ typedef struct {
|
||||
/* These functions can only be called for drawables
|
||||
* that have the same depth as the gc.
|
||||
*/
|
||||
void (*set_pixel) (GdkDrawable *drawable,
|
||||
void (*set_pixel) (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
int x,
|
||||
int y,
|
||||
@ -227,11 +227,16 @@ typedef struct {
|
||||
int y,
|
||||
GdkColor *color);
|
||||
|
||||
void (*fill_span) (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkSegment *cur,
|
||||
GdkColor *color);
|
||||
void (*fill_span) (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkSpan *span,
|
||||
GdkColor *color);
|
||||
|
||||
void (*fill_rectangle) (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkRectangle *rect,
|
||||
GdkColor *color);
|
||||
|
||||
gdk_fb_draw_drawable_func *draw_drawable[GDK_NUM_FB_SRCBPP];
|
||||
} GdkGCFBData;
|
||||
|
||||
@ -301,51 +306,67 @@ struct _GdkFBDrawingContext {
|
||||
gboolean handle_cursor : 1;
|
||||
};
|
||||
|
||||
void gdk_fb_drawing_context_init(GdkFBDrawingContext *dc, GdkDrawable *drawable,
|
||||
GdkGC *gc, gboolean draw_bg, gboolean do_clipping);
|
||||
void gdk_fb_drawing_context_finalize(GdkFBDrawingContext *dc);
|
||||
void gdk_fb_drawing_context_init (GdkFBDrawingContext *dc,
|
||||
GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
gboolean draw_bg,
|
||||
gboolean do_clipping);
|
||||
void gdk_fb_drawing_context_finalize (GdkFBDrawingContext *dc);
|
||||
void gdk_fb_draw_drawable_3 (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPixmap *src,
|
||||
GdkFBDrawingContext *dc,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_fb_draw_drawable_2 (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPixmap *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height,
|
||||
gboolean draw_bg,
|
||||
gboolean do_clipping);
|
||||
void gdk_fb_draw_rectangle (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
gint filled,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_fb_draw_lines (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPoint *points,
|
||||
gint npoints);
|
||||
void gdk_fb_fill_spans (GdkDrawable *real_drawable,
|
||||
GdkGC *gc,
|
||||
GdkSpan *spans,
|
||||
int nspans,
|
||||
gboolean sorted);
|
||||
GdkRegion *gdk_fb_clip_region (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
gboolean do_clipping,
|
||||
gboolean do_children);
|
||||
|
||||
void gdk_fb_draw_drawable_3 (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPixmap *src,
|
||||
GdkFBDrawingContext *dc,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
void gdk_fb_draw_drawable_2 (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkPixmap *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height,
|
||||
gboolean draw_bg,
|
||||
gboolean do_clipping);
|
||||
void gdk_fb_draw_rectangle (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
gint filled,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_fb_fill_spans(GdkDrawable *real_drawable, GdkGC *gc, GdkRectangle *rects, int nrects);
|
||||
GdkRegion *gdk_fb_clip_region(GdkDrawable *drawable, GdkGC *gc, gboolean do_clipping, gboolean do_children);
|
||||
GdkGrabStatus gdk_fb_pointer_grab (GdkWindow *window,
|
||||
gint owner_events,
|
||||
GdkEventMask event_mask,
|
||||
GdkWindow *confine_to,
|
||||
GdkCursor *cursor,
|
||||
guint32 time,
|
||||
gboolean implicit_grab);
|
||||
void gdk_fb_pointer_ungrab (guint32 time,
|
||||
gboolean implicit_grab);
|
||||
|
||||
guint32 gdk_fb_get_time (void);
|
||||
|
||||
GdkGrabStatus
|
||||
gdk_fb_pointer_grab (GdkWindow * window,
|
||||
gint owner_events,
|
||||
GdkEventMask event_mask,
|
||||
GdkWindow * confine_to,
|
||||
GdkCursor * cursor,
|
||||
guint32 time,
|
||||
gboolean implicit_grab);
|
||||
void gdk_fb_pointer_ungrab (guint32 time, gboolean implicit_grab);
|
||||
|
||||
extern GdkWindow *_gdk_fb_pointer_grab_window, *_gdk_fb_pointer_grab_window_events, *_gdk_fb_keyboard_grab_window, *_gdk_fb_pointer_grab_confine;
|
||||
extern GdkEventMask _gdk_fb_pointer_grab_events, _gdk_fb_keyboard_grab_events;
|
||||
|
1154
gdk/linux-fb/gdkrender-fb.c
Normal file
1154
gdk/linux-fb/gdkrender-fb.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -866,8 +866,8 @@ miComputeWideEllipse(int lw, miArc *parc, gboolean *mustFree)
|
||||
static void
|
||||
miFillWideEllipse(GdkDrawable *pDraw, GdkGC *pGC, miArc *parc)
|
||||
{
|
||||
GdkRectangle* points;
|
||||
register GdkRectangle* pts;
|
||||
GdkSpan* points;
|
||||
register GdkSpan* pts;
|
||||
miArcSpanData *spdata;
|
||||
gboolean mustFree;
|
||||
register miArcSpan *span;
|
||||
@ -875,7 +875,7 @@ miFillWideEllipse(GdkDrawable *pDraw, GdkGC *pGC, miArc *parc)
|
||||
register int n;
|
||||
|
||||
yorgu = parc->height + GDK_GC_FBDATA(pGC)->values.line_width;
|
||||
points = ALLOCATE_LOCAL(sizeof(GdkRectangle) * yorgu * 2);
|
||||
points = ALLOCATE_LOCAL(sizeof(GdkSpan) * yorgu * 2);
|
||||
spdata = miComputeWideEllipse(GDK_GC_FBDATA(pGC)->values.line_width, parc, &mustFree);
|
||||
if (!spdata)
|
||||
{
|
||||
@ -893,7 +893,7 @@ miFillWideEllipse(GdkDrawable *pDraw, GdkGC *pGC, miArc *parc)
|
||||
{
|
||||
pts->x = xorg;
|
||||
pts->y = yorgu - 1;
|
||||
pts->width = pts->height = 1;
|
||||
pts->width = 1;
|
||||
pts++;
|
||||
span++;
|
||||
}
|
||||
@ -901,7 +901,6 @@ miFillWideEllipse(GdkDrawable *pDraw, GdkGC *pGC, miArc *parc)
|
||||
{
|
||||
pts[0].x = xorg + span->lx;
|
||||
pts[0].y = yorgu;
|
||||
pts[0].height = 1;
|
||||
pts[0].width = span->lw;
|
||||
pts[1] = pts[0];
|
||||
pts[1].y = yorgl;
|
||||
@ -914,7 +913,7 @@ miFillWideEllipse(GdkDrawable *pDraw, GdkGC *pGC, miArc *parc)
|
||||
{
|
||||
pts[0].x = xorg;
|
||||
pts[0].y = yorgl;
|
||||
pts[0].width = pts[0].height = 1;
|
||||
pts[0].width = 1;
|
||||
pts++;
|
||||
}
|
||||
for (n = spdata->count2; --n >= 0; )
|
||||
@ -922,22 +921,18 @@ miFillWideEllipse(GdkDrawable *pDraw, GdkGC *pGC, miArc *parc)
|
||||
pts[0].x = xorg + span->lx;
|
||||
pts[0].y = yorgu;
|
||||
pts[0].width = span->lw;
|
||||
pts[0].height = 1;
|
||||
|
||||
pts[1].x = xorg + span->rx;
|
||||
pts[1].y = pts[0].y;
|
||||
pts[1].width = span->rw;
|
||||
pts[1].height = 1;
|
||||
|
||||
pts[2].x = pts[0].x;
|
||||
pts[2].y = yorgl;
|
||||
pts[2].height = 1;
|
||||
pts[2].width = pts[0].width;
|
||||
|
||||
pts[3].x = pts[1].x;
|
||||
pts[3].y = pts[2].y;
|
||||
pts[3].width = pts[1].width;
|
||||
pts[3].height = 1;
|
||||
|
||||
yorgu++;
|
||||
yorgl--;
|
||||
@ -951,7 +946,6 @@ miFillWideEllipse(GdkDrawable *pDraw, GdkGC *pGC, miArc *parc)
|
||||
pts[0].x = xorg + span->lx;
|
||||
pts[0].y = yorgu;
|
||||
pts[0].width = span->lw;
|
||||
pts[0].height = 1;
|
||||
pts++;
|
||||
}
|
||||
else
|
||||
@ -959,18 +953,16 @@ miFillWideEllipse(GdkDrawable *pDraw, GdkGC *pGC, miArc *parc)
|
||||
pts[0].x = xorg + span->lx;
|
||||
pts[0].y = yorgu;
|
||||
pts[0].width = span->lw;
|
||||
pts[0].height = 1;
|
||||
pts[1].x = xorg + span->rx;
|
||||
pts[1].y = pts[0].y;
|
||||
pts[1].width = span->rw;
|
||||
pts[1].height = 1;
|
||||
pts += 2;
|
||||
}
|
||||
}
|
||||
if (mustFree)
|
||||
g_free(spdata);
|
||||
|
||||
gdk_fb_fill_spans(pDraw, pGC, points, pts - points);
|
||||
gdk_fb_fill_spans(pDraw, pGC, points, pts - points, FALSE);
|
||||
|
||||
DEALLOCATE_LOCAL(points);
|
||||
}
|
||||
@ -3039,15 +3031,15 @@ fillSpans (pDrawable, pGC)
|
||||
GdkGC* pGC;
|
||||
{
|
||||
register struct finalSpan *span;
|
||||
register GdkRectangle* xSpan;
|
||||
register GdkSpan* xSpan;
|
||||
register int i;
|
||||
register struct finalSpan **f;
|
||||
register int spany;
|
||||
GdkRectangle* xSpans;
|
||||
GdkSpan* xSpans;
|
||||
|
||||
if (nspans == 0)
|
||||
return;
|
||||
xSpan = xSpans = (GdkRectangle*) ALLOCATE_LOCAL (nspans * sizeof (GdkRectangle));
|
||||
xSpan = xSpans = (GdkSpan*) ALLOCATE_LOCAL (nspans * sizeof (GdkSpan));
|
||||
if (xSpans)
|
||||
{
|
||||
i = 0;
|
||||
@ -3059,13 +3051,12 @@ fillSpans (pDrawable, pGC)
|
||||
xSpan->x = span->min;
|
||||
xSpan->y = spany;
|
||||
xSpan->width = span->max - span->min;
|
||||
xSpan->height = 1;
|
||||
++xSpan;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
gdk_fb_fill_spans(pDrawable, pGC, xSpans, i);
|
||||
gdk_fb_fill_spans(pDrawable, pGC, xSpans, i, TRUE);
|
||||
}
|
||||
disposeFinalSpans ();
|
||||
if (xSpans)
|
||||
|
@ -521,14 +521,12 @@ miFillArcSliceSetup(arc, slice, pGC)
|
||||
pts->x = xorg - x; \
|
||||
pts->y = yorg - y; \
|
||||
pts->width = slw; \
|
||||
pts->height = 1; \
|
||||
pts++; \
|
||||
if (miFillArcLower(slw)) \
|
||||
{ \
|
||||
pts->x = xorg - x; \
|
||||
pts->y = yorg + y + dy; \
|
||||
pts->width = slw; \
|
||||
pts->height = 1; \
|
||||
pts++; \
|
||||
}
|
||||
|
||||
@ -542,10 +540,10 @@ miFillEllipseI(pDraw, pGC, arc)
|
||||
int yk, xk, ym, xm, dx, dy, xorg, yorg;
|
||||
int slw;
|
||||
miFillArcRec info;
|
||||
GdkRectangle* points;
|
||||
register GdkRectangle* pts;
|
||||
GdkSpan* points;
|
||||
register GdkSpan* pts;
|
||||
|
||||
points = (GdkRectangle*)ALLOCATE_LOCAL(sizeof(GdkRectangle) * arc->height);
|
||||
points = (GdkSpan*)ALLOCATE_LOCAL(sizeof(GdkSpan) * arc->height);
|
||||
if (!points)
|
||||
return;
|
||||
miFillArcSetup(arc, &info);
|
||||
@ -556,7 +554,7 @@ miFillEllipseI(pDraw, pGC, arc)
|
||||
MIFILLARCSTEP(slw);
|
||||
ADDSPANS();
|
||||
}
|
||||
gdk_fb_fill_spans(pDraw, pGC, points, pts - points);
|
||||
gdk_fb_fill_spans(pDraw, pGC, points, pts - points, FALSE);
|
||||
|
||||
DEALLOCATE_LOCAL(points);
|
||||
}
|
||||
@ -571,10 +569,10 @@ miFillEllipseD(pDraw, pGC, arc)
|
||||
int xorg, yorg, dx, dy, slw;
|
||||
double e, yk, xk, ym, xm;
|
||||
miFillArcDRec info;
|
||||
GdkRectangle* points;
|
||||
register GdkRectangle* pts;
|
||||
GdkSpan* points;
|
||||
register GdkSpan* pts;
|
||||
|
||||
points = (GdkRectangle*)ALLOCATE_LOCAL(sizeof(GdkRectangle) * arc->height);
|
||||
points = (GdkSpan*)ALLOCATE_LOCAL(sizeof(GdkSpan) * arc->height);
|
||||
if (!points)
|
||||
return;
|
||||
miFillArcDSetup(arc, &info);
|
||||
@ -585,7 +583,7 @@ miFillEllipseD(pDraw, pGC, arc)
|
||||
MIFILLARCSTEP(slw);
|
||||
ADDSPANS();
|
||||
}
|
||||
gdk_fb_fill_spans(pDraw, pGC, points, pts - points);
|
||||
gdk_fb_fill_spans(pDraw, pGC, points, pts - points, FALSE);
|
||||
DEALLOCATE_LOCAL(points);
|
||||
}
|
||||
|
||||
@ -595,7 +593,6 @@ miFillEllipseD(pDraw, pGC, arc)
|
||||
pts->x = l; \
|
||||
pts->y = ya; \
|
||||
pts->width = r - l + 1; \
|
||||
pts->height = 1; \
|
||||
pts++; \
|
||||
}
|
||||
|
||||
@ -623,8 +620,8 @@ miFillArcSliceI(pDraw, pGC, arc)
|
||||
miFillArcRec info;
|
||||
miArcSliceRec slice;
|
||||
int ya, xl, xr, xc;
|
||||
GdkRectangle* points;
|
||||
register GdkRectangle* pts;
|
||||
GdkSpan* points;
|
||||
register GdkSpan* pts;
|
||||
|
||||
miFillArcSetup(arc, &info);
|
||||
miFillArcSliceSetup(arc, &slice, pGC);
|
||||
@ -632,7 +629,7 @@ miFillArcSliceI(pDraw, pGC, arc)
|
||||
slw = arc->height;
|
||||
if (slice.flip_top || slice.flip_bot)
|
||||
slw += (arc->height >> 1) + 1;
|
||||
points = (GdkRectangle*)ALLOCATE_LOCAL(sizeof(GdkRectangle) * slw);
|
||||
points = (GdkSpan*)ALLOCATE_LOCAL(sizeof(GdkSpan) * slw);
|
||||
if (!points)
|
||||
return;
|
||||
pts = points;
|
||||
@ -655,7 +652,7 @@ miFillArcSliceI(pDraw, pGC, arc)
|
||||
}
|
||||
}
|
||||
|
||||
gdk_fb_fill_spans(pDraw, pGC, points, pts - points);
|
||||
gdk_fb_fill_spans(pDraw, pGC, points, pts - points, FALSE);
|
||||
DEALLOCATE_LOCAL(points);
|
||||
}
|
||||
|
||||
@ -671,8 +668,8 @@ miFillArcSliceD(pDraw, pGC, arc)
|
||||
miFillArcDRec info;
|
||||
miArcSliceRec slice;
|
||||
int ya, xl, xr, xc;
|
||||
GdkRectangle* points;
|
||||
register GdkRectangle* pts;
|
||||
GdkSpan* points;
|
||||
register GdkSpan* pts;
|
||||
|
||||
miFillArcDSetup(arc, &info);
|
||||
miFillArcSliceSetup(arc, &slice, pGC);
|
||||
@ -680,7 +677,7 @@ miFillArcSliceD(pDraw, pGC, arc)
|
||||
slw = arc->height;
|
||||
if (slice.flip_top || slice.flip_bot)
|
||||
slw += (arc->height >> 1) + 1;
|
||||
points = (GdkRectangle*)ALLOCATE_LOCAL(sizeof(GdkRectangle) * slw);
|
||||
points = (GdkSpan*)ALLOCATE_LOCAL(sizeof(GdkSpan) * slw);
|
||||
if (!points)
|
||||
return;
|
||||
pts = points;
|
||||
@ -702,7 +699,7 @@ miFillArcSliceD(pDraw, pGC, arc)
|
||||
ADDSLICESPANS(slice.flip_bot);
|
||||
}
|
||||
}
|
||||
gdk_fb_fill_spans(pDraw, pGC, points, pts - points);
|
||||
gdk_fb_fill_spans(pDraw, pGC, points, pts - points, FALSE);
|
||||
|
||||
DEALLOCATE_LOCAL(points);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ miFillSppPoly(GdkDrawable *dst, GdkGC *pgc, int count, SppPointPtr ptsIn, int xT
|
||||
register int left, right, /* indices to first endpoints */
|
||||
nextleft,
|
||||
nextright; /* indices to second endpoints */
|
||||
GdkRectangle* ptsOut,
|
||||
GdkSpan* ptsOut,
|
||||
*FirstPoint; /* output buffer */
|
||||
|
||||
imin = GetFPolyYBounds(ptsIn, count, yFtrans, &ymin, &ymax);
|
||||
@ -101,7 +101,7 @@ miFillSppPoly(GdkDrawable *dst, GdkGC *pgc, int count, SppPointPtr ptsIn, int xT
|
||||
y = ymax - ymin + 1;
|
||||
if ((count < 3) || (y <= 0))
|
||||
return;
|
||||
ptsOut = FirstPoint = (GdkRectangle*)ALLOCATE_LOCAL(sizeof(GdkRectangle) * y);
|
||||
ptsOut = FirstPoint = (GdkSpan*)ALLOCATE_LOCAL(sizeof(GdkSpan) * y);
|
||||
Marked = (int *) ALLOCATE_LOCAL(sizeof(int) * count);
|
||||
|
||||
if(!ptsOut || !Marked)
|
||||
@ -198,7 +198,6 @@ miFillSppPoly(GdkDrawable *dst, GdkGC *pgc, int count, SppPointPtr ptsIn, int xT
|
||||
|
||||
cxl = ICEIL(xl);
|
||||
cxr = ICEIL(xr);
|
||||
ptsOut->height = 1;
|
||||
/* reverse the edges if necessary */
|
||||
if (xl < xr)
|
||||
{
|
||||
@ -220,7 +219,7 @@ miFillSppPoly(GdkDrawable *dst, GdkGC *pgc, int count, SppPointPtr ptsIn, int xT
|
||||
} while (y <= ymax);
|
||||
|
||||
/* Finally, fill the spans we've collected */
|
||||
gdk_fb_fill_spans(dst, pgc, FirstPoint, ptsOut-FirstPoint);
|
||||
gdk_fb_fill_spans(dst, pgc, FirstPoint, ptsOut-FirstPoint, TRUE);
|
||||
DEALLOCATE_LOCAL(Marked);
|
||||
DEALLOCATE_LOCAL(FirstPoint);
|
||||
}
|
||||
|
@ -66,8 +66,8 @@ miFillGeneralPoly(dst, pgc, count, ptsIn)
|
||||
register int nPts = 0; /* number of pts in buffer */
|
||||
register EdgeTableEntry *pWETE; /* Winding Edge Table */
|
||||
register ScanLineList *pSLL; /* Current ScanLineList */
|
||||
register GdkRectangle* ptsOut; /* ptr to output buffers */
|
||||
GdkRectangle FirstPoint[NUMPTSTOBUFFER]; /* the output buffers */
|
||||
register GdkSpan* ptsOut; /* ptr to output buffers */
|
||||
GdkSpan FirstPoint[NUMPTSTOBUFFER]; /* the output buffers */
|
||||
EdgeTableEntry *pPrevAET; /* previous AET entry */
|
||||
EdgeTable ET; /* Edge Table header node */
|
||||
EdgeTableEntry AET; /* Active ET header node */
|
||||
@ -115,7 +115,6 @@ miFillGeneralPoly(dst, pgc, count, ptsIn)
|
||||
{
|
||||
ptsOut->x = pAET->bres.minor;
|
||||
ptsOut->width = pAET->next->bres.minor - pAET->bres.minor;
|
||||
ptsOut->height = 1;
|
||||
ptsOut++->y = y;
|
||||
nPts++;
|
||||
|
||||
@ -124,7 +123,7 @@ miFillGeneralPoly(dst, pgc, count, ptsIn)
|
||||
*/
|
||||
if (nPts == NUMPTSTOBUFFER)
|
||||
{
|
||||
gdk_fb_fill_spans(dst, pgc, FirstPoint, nPts);
|
||||
gdk_fb_fill_spans(dst, pgc, FirstPoint, nPts, TRUE);
|
||||
ptsOut = FirstPoint;
|
||||
nPts = 0;
|
||||
}
|
||||
@ -169,7 +168,6 @@ miFillGeneralPoly(dst, pgc, count, ptsIn)
|
||||
{
|
||||
ptsOut->x = pAET->bres.minor;
|
||||
ptsOut->width = pAET->nextWETE->bres.minor - pAET->bres.minor;
|
||||
ptsOut->height = 1;
|
||||
ptsOut++->y = y;
|
||||
nPts++;
|
||||
|
||||
@ -178,7 +176,7 @@ miFillGeneralPoly(dst, pgc, count, ptsIn)
|
||||
*/
|
||||
if (nPts == NUMPTSTOBUFFER)
|
||||
{
|
||||
gdk_fb_fill_spans(dst, pgc, FirstPoint, nPts);
|
||||
gdk_fb_fill_spans(dst, pgc, FirstPoint, nPts, TRUE);
|
||||
ptsOut = FirstPoint;
|
||||
nPts = 0;
|
||||
}
|
||||
@ -207,7 +205,7 @@ miFillGeneralPoly(dst, pgc, count, ptsIn)
|
||||
* Get any spans that we missed by buffering
|
||||
*/
|
||||
if(nPts > 0)
|
||||
gdk_fb_fill_spans(dst, pgc, FirstPoint, nPts);
|
||||
gdk_fb_fill_spans(dst, pgc, FirstPoint, nPts, TRUE);
|
||||
DEALLOCATE_LOCAL(pETEs);
|
||||
miFreeStorage(SLLBlock.next);
|
||||
return(TRUE);
|
||||
|
@ -78,7 +78,7 @@ void miSubtractSpans (spanGroup, sub)
|
||||
int i, subCount, spansCount;
|
||||
int ymin, ymax, xmin, xmax;
|
||||
Spans *spans;
|
||||
GdkRectangle* subPt, *spansPt;
|
||||
GdkSpan* subPt, *spansPt;
|
||||
int extra;
|
||||
|
||||
ymin = YMIN(sub);
|
||||
@ -137,10 +137,10 @@ void miSubtractSpans (spanGroup, sub)
|
||||
else
|
||||
{
|
||||
if (!extra) {
|
||||
GdkRectangle* newPt;
|
||||
GdkSpan* newPt;
|
||||
|
||||
#define EXTRA 8
|
||||
newPt = (GdkRectangle*) g_realloc (spans->points, (spans->count + EXTRA) * sizeof (GdkRectangle));
|
||||
newPt = (GdkSpan*) g_realloc (spans->points, (spans->count + EXTRA) * sizeof (GdkSpan));
|
||||
if (!newPt)
|
||||
break;
|
||||
spansPt = newPt + (spansPt - spans->points);
|
||||
@ -151,10 +151,8 @@ void miSubtractSpans (spanGroup, sub)
|
||||
spans->count++;
|
||||
extra--;
|
||||
spansPt->width = xmin - spansPt->x;
|
||||
spansPt->height = 1;
|
||||
spansPt++;
|
||||
spansPt->width -= xmax - spansPt->x;
|
||||
spansPt->height = 1;
|
||||
spansPt->x = xmax;
|
||||
}
|
||||
}
|
||||
@ -207,19 +205,19 @@ void miFreeSpanGroup(spanGroup)
|
||||
}
|
||||
|
||||
static void QuickSortSpansX(points, numSpans)
|
||||
register GdkRectangle points[];
|
||||
register GdkSpan points[];
|
||||
register int numSpans;
|
||||
{
|
||||
register int x;
|
||||
register int i, j, m;
|
||||
register GdkRectangle* r;
|
||||
register GdkSpan* r;
|
||||
|
||||
/* Always called with numSpans > 1 */
|
||||
/* Sorts only by x, as all y should be the same */
|
||||
|
||||
#define ExchangeSpans(a, b) \
|
||||
{ \
|
||||
GdkRectangle tpt; \
|
||||
GdkSpan tpt; \
|
||||
\
|
||||
tpt = points[a]; points[a] = points[b]; points[b] = tpt; \
|
||||
}
|
||||
@ -235,7 +233,7 @@ static void QuickSortSpansX(points, numSpans)
|
||||
x = points[i].x;
|
||||
if (xprev > x) {
|
||||
/* points[i] is out of order. Move into proper location. */
|
||||
GdkRectangle tpt;
|
||||
GdkSpan tpt;
|
||||
int k;
|
||||
|
||||
for (j = 0; x >= points[j].x; j++) {}
|
||||
@ -289,10 +287,10 @@ static void QuickSortSpansX(points, numSpans)
|
||||
|
||||
static int UniquifySpansX(spans, newPoints, newWidths)
|
||||
Spans *spans;
|
||||
register GdkRectangle *newPoints;
|
||||
register GdkSpan *newPoints;
|
||||
{
|
||||
register int newx1, newx2, oldpt, i, y;
|
||||
GdkRectangle *oldPoints, *startNewPoints = newPoints;
|
||||
GdkSpan *oldPoints, *startNewPoints = newPoints;
|
||||
|
||||
/* Always called with numSpans > 1 */
|
||||
/* Uniquify the spans, and stash them into newPoints and newWidths. Return the
|
||||
@ -313,7 +311,6 @@ static int UniquifySpansX(spans, newPoints, newWidths)
|
||||
newPoints->x = newx1;
|
||||
newPoints->y = y;
|
||||
newPoints->width = newx2 - newx1;
|
||||
newPoints->height = 1;
|
||||
newPoints++;
|
||||
newx1 = oldpt;
|
||||
newx2 = oldpt + oldPoints->width;
|
||||
@ -327,7 +324,6 @@ static int UniquifySpansX(spans, newPoints, newWidths)
|
||||
/* Write final span */
|
||||
newPoints->x = newx1;
|
||||
newPoints->width = newx2 - newx1;
|
||||
newPoints->height = 1;
|
||||
newPoints->y = y;
|
||||
|
||||
return (newPoints - startNewPoints) + 1;
|
||||
@ -359,7 +355,7 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
|
||||
register int ymin, ylength;
|
||||
|
||||
/* Outgoing spans for one big call to FillSpans */
|
||||
register GdkRectangle* points;
|
||||
register GdkSpan* points;
|
||||
register int count;
|
||||
|
||||
if (spanGroup->count == 0) return;
|
||||
@ -367,7 +363,7 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
|
||||
if (spanGroup->count == 1) {
|
||||
/* Already should be sorted, unique */
|
||||
spans = spanGroup->group;
|
||||
gdk_fb_fill_spans(pDraw, pGC, spans->points, spans->count);
|
||||
gdk_fb_fill_spans(pDraw, pGC, spans->points, spans->count, TRUE);
|
||||
g_free(spans->points);
|
||||
}
|
||||
else
|
||||
@ -415,11 +411,11 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
|
||||
if (index >= 0 && index < ylength) {
|
||||
Spans *newspans = &(yspans[index]);
|
||||
if (newspans->count == ysizes[index]) {
|
||||
GdkRectangle* newpoints;
|
||||
GdkSpan* newpoints;
|
||||
ysizes[index] = (ysizes[index] + 8) * 2;
|
||||
newpoints = (GdkRectangle*) g_realloc(
|
||||
newpoints = (GdkSpan*) g_realloc(
|
||||
newspans->points,
|
||||
ysizes[index] * sizeof(GdkRectangle));
|
||||
ysizes[index] * sizeof(GdkSpan));
|
||||
if (!newpoints)
|
||||
{
|
||||
int i;
|
||||
@ -445,7 +441,7 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
|
||||
} /* for i thorough Spans */
|
||||
|
||||
/* Now sort by x and uniquify each bucket into the final array */
|
||||
points = (GdkRectangle*) g_malloc(count * sizeof(GdkRectangle));
|
||||
points = (GdkSpan*) g_malloc(count * sizeof(GdkSpan));
|
||||
if (!points)
|
||||
{
|
||||
int i;
|
||||
@ -476,7 +472,7 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
|
||||
}
|
||||
}
|
||||
|
||||
gdk_fb_fill_spans(pDraw, pGC, points, count);
|
||||
gdk_fb_fill_spans(pDraw, pGC, points, count, TRUE);
|
||||
g_free(points);
|
||||
g_free(yspans);
|
||||
g_free(ysizes); /* use (DE)ALLOCATE_LOCAL for these? */
|
||||
@ -497,7 +493,7 @@ void miFillSpanGroup(pDraw, pGC, spanGroup)
|
||||
register Spans *spans;
|
||||
|
||||
for (i = 0, spans = spanGroup->group; i != spanGroup->count; i++, spans++) {
|
||||
gdk_fb_fill_spans(pDraw, pGC, spans->points, spans->count);
|
||||
gdk_fb_fill_spans(pDraw, pGC, spans->points, spans->count, TRUE);
|
||||
g_free(spans->points);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ SOFTWARE.
|
||||
|
||||
typedef struct {
|
||||
int count; /* number of spans */
|
||||
GdkRectangle* points; /* pointer to list of start points */
|
||||
GdkSpan* points; /* pointer to list of start points */
|
||||
} Spans;
|
||||
|
||||
typedef struct {
|
||||
|
@ -80,8 +80,8 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
|
||||
int height = 0;
|
||||
int left_height = 0, right_height = 0;
|
||||
|
||||
register GdkRectangle* ppt;
|
||||
GdkRectangle* pptInit;
|
||||
register GdkSpan* ppt;
|
||||
GdkSpan* pptInit;
|
||||
GdkColor oldPixel;
|
||||
int xorg;
|
||||
Spans spanRec;
|
||||
@ -91,7 +91,7 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
|
||||
|
||||
if (!spanData)
|
||||
{
|
||||
pptInit = (GdkRectangle*) ALLOCATE_LOCAL (overall_height * sizeof(*ppt));
|
||||
pptInit = (GdkSpan*) ALLOCATE_LOCAL (overall_height * sizeof(*ppt));
|
||||
if (!pptInit)
|
||||
return;
|
||||
ppt = pptInit;
|
||||
@ -103,7 +103,7 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
|
||||
}
|
||||
else
|
||||
{
|
||||
spanRec.points = (GdkRectangle*) g_malloc (overall_height * sizeof (*ppt));
|
||||
spanRec.points = (GdkSpan*) g_malloc (overall_height * sizeof (*ppt));
|
||||
if (!spanRec.points)
|
||||
return;
|
||||
ppt = spanRec.points;
|
||||
@ -130,7 +130,6 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
|
||||
ppt->y = y;
|
||||
ppt->x = left_x + xorg;
|
||||
ppt->width = right_x - left_x + 1;
|
||||
ppt->height = 1;
|
||||
ppt++;
|
||||
}
|
||||
y++;
|
||||
@ -142,7 +141,7 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
|
||||
}
|
||||
if (!spanData)
|
||||
{
|
||||
gdk_fb_fill_spans(pDrawable, pGC, pptInit, ppt - pptInit);
|
||||
gdk_fb_fill_spans(pDrawable, pGC, pptInit, ppt - pptInit, TRUE);
|
||||
DEALLOCATE_LOCAL (pptInit);
|
||||
if (pixel->pixel != oldPixel.pixel)
|
||||
{
|
||||
@ -164,23 +163,18 @@ miFillRectPolyHelper (pDrawable, pGC, pixel, spanData, x, y, w, h)
|
||||
SpanDataPtr spanData;
|
||||
int x, y, w, h;
|
||||
{
|
||||
register GdkRectangle* ppt;
|
||||
GdkColor oldPixel;
|
||||
register GdkSpan* ppt;
|
||||
GdkColor oldPixel;
|
||||
Spans spanRec;
|
||||
GdkRectangle rect;
|
||||
|
||||
if (!spanData)
|
||||
{
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
rect.width = w;
|
||||
rect.height = h;
|
||||
oldPixel = GDK_GC_FBDATA(pGC)->values.foreground;
|
||||
if (pixel->pixel != oldPixel.pixel)
|
||||
{
|
||||
gdk_gc_set_foreground(pGC, pixel);
|
||||
}
|
||||
gdk_fb_fill_spans(pDrawable, pGC, &rect, 1);
|
||||
gdk_fb_draw_rectangle(pDrawable, pGC, TRUE, x, y, w, h);
|
||||
if (pixel->pixel != oldPixel.pixel)
|
||||
{
|
||||
gdk_gc_set_foreground(pGC, &oldPixel);
|
||||
@ -188,7 +182,7 @@ miFillRectPolyHelper (pDrawable, pGC, pixel, spanData, x, y, w, h)
|
||||
}
|
||||
else
|
||||
{
|
||||
spanRec.points = (GdkRectangle*) g_malloc (h * sizeof (*ppt));
|
||||
spanRec.points = (GdkSpan*) g_malloc (h * sizeof (*ppt));
|
||||
if (!spanRec.points)
|
||||
return;
|
||||
ppt = spanRec.points;
|
||||
@ -198,7 +192,6 @@ miFillRectPolyHelper (pDrawable, pGC, pixel, spanData, x, y, w, h)
|
||||
ppt->x = x;
|
||||
ppt->y = y;
|
||||
ppt->width = w;
|
||||
ppt->height = 1;
|
||||
ppt++;
|
||||
y++;
|
||||
}
|
||||
@ -384,14 +377,15 @@ miLineOnePoint (pDrawable, pGC, pixel, spanData, x, y)
|
||||
SpanDataPtr spanData;
|
||||
int x, y;
|
||||
{
|
||||
GdkColor oldPixel;
|
||||
GdkRectangle rect;
|
||||
GdkColor oldPixel;
|
||||
GdkSpan span;
|
||||
|
||||
MILINESETPIXEL (pDrawable, pGC, pixel, oldPixel);
|
||||
rect.width = 1;
|
||||
rect.height = 1;
|
||||
span.x = x;
|
||||
span.y = y;
|
||||
span.width = 1;
|
||||
|
||||
gdk_fb_fill_spans(pDrawable, pGC, &rect, 1);
|
||||
gdk_fb_fill_spans(pDrawable, pGC, &span, 1, TRUE);
|
||||
MILINERESETPIXEL (pDrawable, pGC, pixel, oldPixel);
|
||||
}
|
||||
|
||||
@ -542,9 +536,9 @@ miLineArcI (pDraw, pGC, xorg, yorg, points, widths)
|
||||
GdkDrawable* pDraw;
|
||||
GdkGC* pGC;
|
||||
int xorg, yorg;
|
||||
GdkRectangle* points;
|
||||
GdkSpan* points;
|
||||
{
|
||||
register GdkRectangle* tpts, *bpts;
|
||||
register GdkSpan* tpts, *bpts;
|
||||
register int x, y, e, ex, slw;
|
||||
|
||||
tpts = points;
|
||||
@ -554,7 +548,6 @@ miLineArcI (pDraw, pGC, xorg, yorg, points, widths)
|
||||
tpts->x = xorg;
|
||||
tpts->y = yorg;
|
||||
tpts->width = 1;
|
||||
tpts->height = 1;
|
||||
return 1;
|
||||
}
|
||||
bpts = tpts + slw;
|
||||
@ -580,14 +573,12 @@ miLineArcI (pDraw, pGC, xorg, yorg, points, widths)
|
||||
tpts->x = xorg - x;
|
||||
tpts->y = yorg - y;
|
||||
tpts->width = slw;
|
||||
tpts->height = 1;
|
||||
tpts++;
|
||||
if ((y != 0) && ((slw > 1) || (e != ex)))
|
||||
{
|
||||
bpts--;
|
||||
bpts->x = xorg - x;
|
||||
bpts->y = yorg + y;
|
||||
bpts->height = 1;
|
||||
bpts->width = slw;
|
||||
}
|
||||
}
|
||||
@ -623,12 +614,12 @@ miLineArcD (pDraw, pGC, xorg, yorg, points, widths,
|
||||
GdkDrawable* pDraw;
|
||||
GdkGC* pGC;
|
||||
double xorg, yorg;
|
||||
GdkRectangle* points;
|
||||
GdkSpan* points;
|
||||
PolyEdgePtr edge1, edge2;
|
||||
int edgey1, edgey2;
|
||||
gboolean edgeleft1, edgeleft2;
|
||||
{
|
||||
register GdkRectangle* pts;
|
||||
register GdkSpan* pts;
|
||||
double radius, x0, y0, el, er, yk, xlk, xrk, k;
|
||||
int xbase, ybase, y, boty, xl, xr, xcl, xcr;
|
||||
int ymin, ymax;
|
||||
@ -731,7 +722,6 @@ miLineArcD (pDraw, pGC, xorg, yorg, points, widths,
|
||||
pts->x = xcl;
|
||||
pts->y = ybase;
|
||||
pts->width = xcr - xcl + 1;
|
||||
pts->height = 1;
|
||||
pts++;
|
||||
}
|
||||
}
|
||||
@ -768,7 +758,6 @@ miLineArcD (pDraw, pGC, xorg, yorg, points, widths,
|
||||
pts->x = xcl;
|
||||
pts->y = ybase;
|
||||
pts->width = xcr - xcl + 1;
|
||||
pts->height = 1;
|
||||
pts++;
|
||||
}
|
||||
}
|
||||
@ -909,7 +898,7 @@ miLineArc (pDraw, pGC, pixel, spanData, leftFace, rightFace, xorg, yorg, isInt)
|
||||
double xorg, yorg;
|
||||
gboolean isInt;
|
||||
{
|
||||
GdkRectangle* points;
|
||||
GdkSpan* points;
|
||||
int xorgi = 0, yorgi = 0;
|
||||
GdkColor oldPixel;
|
||||
Spans spanRec;
|
||||
@ -957,7 +946,7 @@ miLineArc (pDraw, pGC, pixel, spanData, leftFace, rightFace, xorg, yorg, isInt)
|
||||
}
|
||||
if (!spanData)
|
||||
{
|
||||
points = (GdkRectangle*)ALLOCATE_LOCAL(sizeof(GdkRectangle) * GDK_GC_FBDATA(pGC)->values.line_width);
|
||||
points = (GdkSpan*)ALLOCATE_LOCAL(sizeof(GdkSpan) * GDK_GC_FBDATA(pGC)->values.line_width);
|
||||
if (!points)
|
||||
return;
|
||||
oldPixel = GDK_GC_FBDATA(pGC)->values.foreground;
|
||||
@ -968,7 +957,7 @@ miLineArc (pDraw, pGC, pixel, spanData, leftFace, rightFace, xorg, yorg, isInt)
|
||||
}
|
||||
else
|
||||
{
|
||||
points = (GdkRectangle*) g_malloc (GDK_GC_FBDATA(pGC)->values.line_width * sizeof (GdkRectangle));
|
||||
points = (GdkSpan*) g_malloc (GDK_GC_FBDATA(pGC)->values.line_width * sizeof (GdkSpan));
|
||||
if (!points)
|
||||
return;
|
||||
spanRec.points = points;
|
||||
@ -982,7 +971,7 @@ miLineArc (pDraw, pGC, pixel, spanData, leftFace, rightFace, xorg, yorg, isInt)
|
||||
|
||||
if (!spanData)
|
||||
{
|
||||
gdk_fb_fill_spans(pDraw, pGC, points, n);
|
||||
gdk_fb_fill_spans(pDraw, pGC, points, n, TRUE);
|
||||
DEALLOCATE_LOCAL(points);
|
||||
if (pixel->pixel != oldPixel.pixel)
|
||||
{
|
||||
|
@ -79,7 +79,6 @@ SOFTWARE.
|
||||
spans->x = xx;\
|
||||
spans->y = yy;\
|
||||
spans->width = 1; \
|
||||
spans->height = 1; \
|
||||
current_y = yy;\
|
||||
new_span = FALSE;\
|
||||
}\
|
||||
@ -95,7 +94,7 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit)
|
||||
{
|
||||
int Nspans, current_y;
|
||||
GdkPoint* ppt;
|
||||
GdkRectangle* pspanInit, *spans;
|
||||
GdkSpan* pspanInit, *spans;
|
||||
int list_len;
|
||||
int xleft, ytop, xright, ybottom;
|
||||
int new_x1, new_y1, new_x2, new_y2;
|
||||
@ -130,7 +129,7 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit)
|
||||
width = xright - xleft + 1;
|
||||
height = ybottom - ytop + 1;
|
||||
list_len = (height >= width) ? height : width;
|
||||
pspanInit = (GdkRectangle*)ALLOCATE_LOCAL(list_len * sizeof(GdkRectangle));
|
||||
pspanInit = (GdkSpan*)ALLOCATE_LOCAL(list_len * sizeof(GdkSpan));
|
||||
if (!pspanInit)
|
||||
return;
|
||||
|
||||
@ -153,7 +152,7 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit)
|
||||
while (--npt > 0)
|
||||
{
|
||||
if (Nspans > 0)
|
||||
gdk_fb_fill_spans(pDraw, pGC, pspanInit, Nspans);
|
||||
gdk_fb_fill_spans(pDraw, pGC, pspanInit, Nspans, FALSE);
|
||||
Nspans = 0;
|
||||
new_span = TRUE;
|
||||
spans = pspanInit - 1;
|
||||
@ -312,7 +311,7 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit)
|
||||
}
|
||||
|
||||
if (Nspans > 0)
|
||||
gdk_fb_fill_spans(pDraw, pGC, pspanInit, Nspans);
|
||||
gdk_fb_fill_spans(pDraw, pGC, pspanInit, Nspans, FALSE);
|
||||
|
||||
DEALLOCATE_LOCAL(pspanInit);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user