vte r2139 - in trunk: . src
- From: behdad svn gnome org
- To: svn-commits-list gnome org
- Subject: vte r2139 - in trunk: . src
- Date: Thu, 13 Nov 2008 15:13:26 +0000 (UTC)
Author: behdad
Date: Thu Nov 13 15:13:26 2008
New Revision: 2139
URL: http://svn.gnome.org/viewvc/vte?rev=2139&view=rev
Log:
2008-11-13 Behdad Esfahbod <behdad gnome org>
* src/vte.c (vte_terminal_background_update):
* src/vtedraw.c (_vte_draw_update_requires_clear), (_vte_draw_new),
(_vte_draw_set_background_opacity),
(_vte_draw_set_background_color), (_vte_draw_set_background_image),
(_vte_draw_char), (_vte_draw_set_scroll):
* src/vtedraw.h:
* src/vteft2.c (_vte_ft2_set_background_image), (_vte_ft2_clear),
(_vte_ft2_get_char_width):
* src/vtegl.c (_vte_gl_create), (_vte_gl_clear),
(_vte_gl_get_char_width), (_vte_gl_draw_text):
* src/vtepango.c (_vte_pango_create), (_vte_pango_start),
(_vte_pango_set_background_image), (_vte_pango_clear):
* src/vtexft.c (_vte_xft_create), (_vte_xft_set_background_image),
(_vte_xft_clear), (_vte_xft_get_char_width):
Simplify backends by relying more on defaults.
Modified:
trunk/ChangeLog
trunk/src/vte.c
trunk/src/vtedraw.c
trunk/src/vtedraw.h
trunk/src/vteft2.c
trunk/src/vtegl.c
trunk/src/vtepango.c
trunk/src/vtexft.c
Modified: trunk/src/vte.c
==============================================================================
--- trunk/src/vte.c (original)
+++ trunk/src/vte.c Thu Nov 13 15:13:26 2008
@@ -12337,12 +12337,12 @@
bgcolor.red, bgcolor.green, bgcolor.blue,
bgcolor.pixel);
gdk_window_set_background(terminal->widget.window, &bgcolor);
- _vte_draw_set_background_color(terminal->pvt->draw, &bgcolor,
- terminal->pvt->bg_opacity);
+ _vte_draw_set_background_color (terminal->pvt->draw, &bgcolor);
+ _vte_draw_set_background_opacity (terminal->pvt->draw, terminal->pvt->bg_opacity);
/* If we're transparent, and either have no root image or are being
* told to update it, get a new copy of the root window. */
- saturation = terminal->pvt->bg_saturation * 1.0;
+ saturation = (double) terminal->pvt->bg_saturation;
saturation /= VTE_SATURATION_MAX;
if (terminal->pvt->bg_transparent) {
if (terminal->pvt->root_pixmap_changed_tag == VTE_INVALID_SOURCE) {
Modified: trunk/src/vtedraw.c
==============================================================================
--- trunk/src/vtedraw.c (original)
+++ trunk/src/vtedraw.c Thu Nov 13 15:13:26 2008
@@ -127,6 +127,14 @@
}
+static void
+_vte_draw_update_requires_clear (struct _vte_draw *draw)
+{
+ draw->requires_clear = draw->impl->always_requires_clear
+ || draw->bg_type != VTE_BG_SOURCE_NONE
+ || draw->bg_opacity != 0xFFFF;
+}
+
struct _vte_draw *
_vte_draw_new (GtkWidget *widget)
{
@@ -135,6 +143,8 @@
/* Create the structure. */
draw = g_slice_new0 (struct _vte_draw);
draw->widget = g_object_ref (widget);
+ draw->bg_type = VTE_BG_SOURCE_NONE;
+ draw->bg_opacity = 0xffff;
/* Allow the user to specify her preferred backends */
if (!_vte_draw_init_user (draw) &&
@@ -145,6 +155,8 @@
draw->impl = &_vte_draw_skel;
}
+ _vte_draw_update_requires_clear (draw);
+
_vte_debug_print (VTE_DEBUG_DRAW,
"draw_new (%s)\n", draw->impl->name);
_vte_debug_print (VTE_DEBUG_MISC, "Using %s.\n", draw->impl->name);
@@ -230,42 +242,46 @@
}
void
-_vte_draw_set_background_color (struct _vte_draw *draw,
- GdkColor *color,
- guint16 opacity)
+_vte_draw_set_background_opacity (struct _vte_draw *draw,
+ guint16 opacity)
{
- g_return_if_fail (draw->impl->set_background_color != NULL);
+ draw->bg_opacity = opacity;
+ _vte_draw_update_requires_clear (draw);
- draw->impl->set_background_color (draw, color, opacity);
+ if (draw->impl->set_background_opacity)
+ draw->impl->set_background_opacity (draw, opacity);
}
void
-_vte_draw_set_background_image (struct _vte_draw *draw,
- enum VteBgSourceType type,
- GdkPixbuf *pixbuf,
- const char *filename,
- const GdkColor *color,
- double saturation)
+_vte_draw_set_background_color (struct _vte_draw *draw,
+ GdkColor *color)
{
- g_return_if_fail (draw->impl->set_background_image != NULL);
+ draw->bg_color = *color;
- draw->impl->set_background_image (draw, type, pixbuf, filename,
- color, saturation);
+ if (draw->impl->set_background_color)
+ draw->impl->set_background_color (draw, color);
}
-gboolean
-_vte_draw_requires_clear (struct _vte_draw *draw)
-{
- return draw->requires_clear;
+void
+_vte_draw_set_background_image (struct _vte_draw *draw,
+ enum VteBgSourceType type,
+ GdkPixbuf *pixbuf,
+ const char *filename,
+ const GdkColor *color,
+ double saturation)
+{
+ draw->bg_type = type;
+ _vte_draw_update_requires_clear (draw);
+
+ if (draw->impl->set_background_image)
+ draw->impl->set_background_image (draw, type, pixbuf, filename,
+ color, saturation);
}
gboolean
-_vte_draw_requires_repaint (struct _vte_draw *draw)
+_vte_draw_requires_clear (struct _vte_draw *draw)
{
- _vte_debug_print (VTE_DEBUG_DRAW, "draw_requires_repaint = %d\n",
- draw->impl->requires_repaint);
-
- return draw->impl->requires_repaint;
+ return draw->requires_clear;
}
gboolean
@@ -404,8 +420,9 @@
if (draw->impl->draw_char)
has_char = draw->impl->draw_char (draw, request, color, alpha);
else {
- _vte_draw_text (draw, request, 1, color, alpha);
has_char =_vte_draw_has_char (draw, request->c);
+ if (has_char)
+ _vte_draw_text (draw, request, 1, color, alpha);
}
return has_char;
@@ -464,9 +481,9 @@
"draw_set_scroll (%d, %d)\n",
x, y);
- if (draw->impl->set_scroll)
- draw->impl->set_scroll (draw, x, y);
-
draw->scrollx = x;
draw->scrolly = y;
+
+ if (draw->impl->set_scroll)
+ draw->impl->set_scroll (draw, x, y);
}
Modified: trunk/src/vtedraw.h
==============================================================================
--- trunk/src/vtedraw.h (original)
+++ trunk/src/vtedraw.h Thu Nov 13 15:13:26 2008
@@ -62,14 +62,15 @@
GdkColormap* (*get_colormap)(struct _vte_draw *draw);
void (*start)(struct _vte_draw *draw);
void (*end)(struct _vte_draw *draw);
- void (*set_background_color)(struct _vte_draw *, GdkColor *, guint16);
+ void (*set_background_opacity)(struct _vte_draw *, guint16);
+ void (*set_background_color)(struct _vte_draw *, GdkColor *);
void (*set_background_image)(struct _vte_draw *,
enum VteBgSourceType type,
GdkPixbuf *pixbuf,
const char *file,
const GdkColor *color,
double saturation);
- gboolean requires_repaint;
+ gboolean always_requires_clear;
void (*clip)(struct _vte_draw *, GdkRegion *);
void (*clear)(struct _vte_draw *, gint, gint, gint, gint);
void (*set_text_font)(struct _vte_draw *,
@@ -98,11 +99,24 @@
struct _vte_draw {
GtkWidget *widget;
+
gboolean started;
- gint width, height, ascent;
+
+ guint16 bg_opacity;
+ GdkColor bg_color;
+ enum VteBgSourceType bg_type;
+
gint scrollx, scrolly;
+
gboolean requires_clear;
+
const struct _vte_draw_impl *impl;
+
+ /* impl should set these */
+ gint width, height, ascent;
+
+
+ /* for use by impl */
gpointer impl_data;
};
@@ -124,9 +138,10 @@
/* Set the background color, a background pixbuf (if you want transparency,
you'll have to do that yourself), and clear an area to the default. */
+void _vte_draw_set_background_opacity(struct _vte_draw *draw,
+ guint16 opacity);
void _vte_draw_set_background_color(struct _vte_draw *draw,
- GdkColor *color,
- guint16 opacity);
+ GdkColor *color);
void _vte_draw_set_background_image(struct _vte_draw *draw,
enum VteBgSourceType type,
GdkPixbuf *pixbuf,
@@ -134,7 +149,6 @@
const GdkColor *color,
double saturation);
gboolean _vte_draw_requires_clear (struct _vte_draw *draw);
-gboolean _vte_draw_requires_repaint(struct _vte_draw *draw);
gboolean _vte_draw_clip(struct _vte_draw *draw, GdkRegion *region);
void _vte_draw_clear(struct _vte_draw *draw,
gint x, gint y, gint width, gint height);
Modified: trunk/src/vteft2.c
==============================================================================
--- trunk/src/vteft2.c (original)
+++ trunk/src/vteft2.c Thu Nov 13 15:13:26 2008
@@ -38,19 +38,10 @@
{
struct _vte_glyph_cache *cache;
struct _vte_rgb_buffer *rgb;
- GdkColor color;
GdkPixbuf *pixbuf;
- gint scrollx, scrolly;
gint left, right, top, bottom;
};
-static gboolean
-_vte_ft2_check(struct _vte_draw *draw, GtkWidget *widget)
-{
- /* We can draw onto any widget. */
- return TRUE;
-}
-
static void
_vte_ft2_create(struct _vte_draw *draw, GtkWidget *widget)
{
@@ -75,18 +66,6 @@
g_slice_free(struct _vte_ft2_data, data);
}
-static GdkVisual *
-_vte_ft2_get_visual(struct _vte_draw *draw)
-{
- return gtk_widget_get_visual(draw->widget);
-}
-
-static GdkColormap *
-_vte_ft2_get_colormap(struct _vte_draw *draw)
-{
- return gtk_widget_get_colormap(draw->widget);
-}
-
static void
_vte_ft2_start(struct _vte_draw *draw)
{
@@ -135,14 +114,6 @@
}
static void
-_vte_ft2_set_background_color(struct _vte_draw *draw, GdkColor *color, guint16 opacity)
-{
- struct _vte_ft2_data *data;
- data = (struct _vte_ft2_data*) draw->impl_data;
- data->color = *color;
-}
-
-static void
_vte_ft2_set_background_image(struct _vte_draw *draw,
enum VteBgSourceType type,
GdkPixbuf *pixbuf,
@@ -165,7 +136,6 @@
g_object_unref(data->pixbuf);
}
data->pixbuf = bgpixbuf;
- draw->requires_clear = bgpixbuf != NULL;
}
static void
@@ -199,11 +169,11 @@
/* Tile a pixbuf in. */
_vte_rgb_draw_pixbuf(data->rgb, x, y, width, height,
data->pixbuf,
- data->scrollx + x, data->scrolly + y);
+ draw->scrollx + x, draw->scrolly + y);
} else {
/* The simple case is a solid color. */
_vte_rgb_draw_color(data->rgb, x, y, width, height,
- &data->color);
+ &draw->bg_color);
}
update_bbox(data, x, y, width, height);
}
@@ -264,11 +234,10 @@
data = (struct _vte_ft2_data*) draw->impl_data;
glyph = _vte_glyph_get(data->cache, c);
- if (glyph != NULL) {
- return glyph->width;
- }
+ if (glyph == NULL)
+ return 0;
- return _vte_ft2_get_text_width(draw) * columns;
+ return glyph->width;
}
static gboolean
@@ -315,24 +284,6 @@
}
static gboolean
-_vte_ft2_draw_char(struct _vte_draw *draw,
- struct _vte_draw_text_request *request,
- GdkColor *color, guchar alpha)
-{
- struct _vte_ft2_data *data;
-
- data = (struct _vte_ft2_data*) draw->impl_data;
-
- if (data->cache != NULL) {
- if (_vte_glyph_get(data->cache, request->c) != NULL) {
- _vte_ft2_draw_text(draw, request, 1, color, alpha);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static gboolean
_vte_ft2_draw_has_char(struct _vte_draw *draw, gunichar c)
{
struct _vte_ft2_data *data;
@@ -388,27 +339,19 @@
update_bbox(data, x, y, width, height);
}
-static void
-_vte_ft2_set_scroll(struct _vte_draw *draw, gint x, gint y)
-{
- struct _vte_ft2_data *data;
- data = (struct _vte_ft2_data*) draw->impl_data;
- data->scrollx = x;
- data->scrolly = y;
-}
-
const struct _vte_draw_impl _vte_draw_ft2 = {
"ft2",
- _vte_ft2_check,
+ NULL, /* check */
_vte_ft2_create,
_vte_ft2_destroy,
- _vte_ft2_get_visual,
- _vte_ft2_get_colormap,
+ NULL, /* get_visual */
+ NULL, /* get_colormap */
_vte_ft2_start,
_vte_ft2_end,
- _vte_ft2_set_background_color,
+ NULL, /* set_background_opacity */
+ NULL, /* set_background_color */
_vte_ft2_set_background_image,
- FALSE,
+ FALSE, /* always_require_clear */
_vte_ft2_clip,
_vte_ft2_clear,
_vte_ft2_set_text_font,
@@ -418,9 +361,9 @@
_vte_ft2_get_char_width,
_vte_ft2_get_using_fontconfig,
_vte_ft2_draw_text,
- _vte_ft2_draw_char,
+ NULL, /* draw_char */
_vte_ft2_draw_has_char,
_vte_ft2_draw_rectangle,
_vte_ft2_fill_rectangle,
- _vte_ft2_set_scroll,
+ NULL /* set_scroll */
};
Modified: trunk/src/vtegl.c
==============================================================================
--- trunk/src/vtegl.c (original)
+++ trunk/src/vtegl.c Thu Nov 13 15:13:26 2008
@@ -44,10 +44,8 @@
XVisualInfo *visual_info;
Display *display;
GLXContext context;
- GdkColor color;
GdkPixbuf *bgpixbuf;
GLXDrawable glwindow;
- gint scrollx, scrolly;
struct _vte_glyph_cache *cache;
struct _vte_buffer *buffer;
};
@@ -141,17 +139,12 @@
g_error("Unable to create a GLX context.\n");
}
- data->color.red = 0;
- data->color.green = 0;
- data->color.blue = 0;
data->bgpixbuf = NULL;
data->glwindow = -1;
- data->scrollx = data->scrolly = 0;
data->cache = _vte_glyph_cache_new();
data->buffer = _vte_buffer_new();
gtk_widget_set_double_buffered(widget, FALSE);
- draw->requires_clear = TRUE;
}
static void
@@ -233,15 +226,6 @@
}
static void
-_vte_gl_set_background_color(struct _vte_draw *draw, GdkColor *color, guint16 opacity)
-{
- struct _vte_gl_data *data;
-
- data = (struct _vte_gl_data*) draw->impl_data;
- data->color = *color;
-}
-
-static void
_vte_gl_set_background_image(struct _vte_draw *draw,
enum VteBgSourceType type,
GdkPixbuf *pixbuf,
@@ -286,10 +270,10 @@
}
if ((pixbufw == 0) || (pixbufh == 0)) {
- glColor4us(data->color.red,
- data->color.green,
- data->color.blue,
- 0xffff);
+ glColor4us(draw->bg_color.red,
+ draw->bg_color.green,
+ draw->bg_color.blue,
+ 0xFFFF);
glBegin(GL_POLYGON);
glVertex2d(x, y);
glVertex2d(x + width, y);
@@ -320,10 +304,10 @@
}
y = ystop - height;
- j = (data->scrolly + y) % pixbufh;
+ j = (draw->scrolly + y) % pixbufh;
while (y < ystop) {
x = xstop - width;
- i = (data->scrollx + x) % pixbufw;
+ i = (draw->scrollx + x) % pixbufw;
/* h = MIN(pixbufh - (j % pixbufh), ystop - y); */
h = 1;
@@ -338,7 +322,7 @@
i = 0;
}
y += h;
- j = (data->scrolly + y) % pixbufh;
+ j = (draw->scrolly + y) % pixbufh;
}
glFlush();
}
@@ -411,17 +395,10 @@
data = (struct _vte_gl_data*) draw->impl_data;
glyph = _vte_glyph_get(data->cache, c);
- if (glyph != NULL) {
- return glyph->width;
- }
+ if (glyph == NULL)
+ return 0;
- return _vte_gl_get_text_width(draw) * columns;
-}
-
-static gboolean
-_vte_gl_get_using_fontconfig(struct _vte_draw *draw)
-{
- return TRUE;
+ return glyph->width;
}
static void
@@ -432,7 +409,8 @@
struct _vte_gl_data *data;
const struct _vte_glyph *glyph;
guint16 a, r, g, b;
- int i, j, x, y, w, pad, rows, columns, src, dest;
+ guint i, j;
+ int k, x, y, w, pad, rows, columns, src, dest;
guchar *pixels;
data = (struct _vte_gl_data*) draw->impl_data;
@@ -459,10 +437,10 @@
_vte_buffer_set_minimum_size(data->buffer, rows * columns * 4);
pixels = data->buffer->bytes;
memset(pixels, 0, rows * columns * 4);
- for (i = 0; i < rows * columns; i++) {
- pixels[i * 4 + 0] = r;
- pixels[i * 4 + 1] = g;
- pixels[i * 4 + 2] = b;
+ for (k = 0; k < rows * columns; k++) {
+ pixels[k * 4 + 0] = r;
+ pixels[k * 4 + 1] = g;
+ pixels[k * 4 + 2] = b;
}
for (i = j = 0; i < n_requests; i++) {
@@ -501,24 +479,6 @@
}
static gboolean
-_vte_gl_draw_char(struct _vte_draw *draw,
- struct _vte_draw_text_request *request,
- GdkColor *color, guchar alpha)
-{
- struct _vte_gl_data *data;
-
- data = (struct _vte_gl_data*) draw->impl_data;
-
- if (data->cache != NULL) {
- if (_vte_glyph_get(data->cache, request->c) != NULL) {
- _vte_gl_draw_text(draw, request, 1, color, alpha);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static gboolean
_vte_gl_draw_has_char(struct _vte_draw *draw, gunichar c)
{
struct _vte_gl_data *data;
@@ -573,16 +533,6 @@
color, alpha);
}
-static void
-_vte_gl_set_scroll(struct _vte_draw *draw, gint x, gint y)
-{
- struct _vte_gl_data *data;
-
- data = (struct _vte_gl_data*) draw->impl_data;
- data->scrollx = x;
- data->scrolly = y;
-}
-
const struct _vte_draw_impl _vte_draw_gl = {
"gl",
_vte_gl_check,
@@ -592,23 +542,24 @@
_vte_gl_get_colormap,
_vte_gl_start,
_vte_gl_end,
- _vte_gl_set_background_color,
+ NULL, /* set_background_opacity */
+ NULL, /* set_background_color */
_vte_gl_set_background_image,
- TRUE,
- NULL,
+ TRUE, /* always_requires_clear */
+ NULL, /* clip */
_vte_gl_clear,
_vte_gl_set_text_font,
_vte_gl_get_text_width,
_vte_gl_get_text_height,
_vte_gl_get_text_ascent,
_vte_gl_get_char_width,
- _vte_gl_get_using_fontconfig,
+ NULL, /* get_using_fontconfig */
_vte_gl_draw_text,
- _vte_gl_draw_char,
+ NULL, /* draw_char */
_vte_gl_draw_has_char,
_vte_gl_draw_rectangle,
_vte_gl_fill_rectangle,
- _vte_gl_set_scroll,
+ NULL /* set_scroll */
};
#endif
Modified: trunk/src/vtepango.c
==============================================================================
--- trunk/src/vtepango.c (original)
+++ trunk/src/vtepango.c Thu Nov 13 15:13:26 2008
@@ -32,23 +32,14 @@
struct _vte_pango_data
{
- GdkColor color;
GdkPixmap *pixmap;
gint pixmapw, pixmaph;
- gint scrollx, scrolly;
PangoContext *ctx;
PangoFontDescription *font;
PangoLayout *layout;
GdkGC *gc;
};
-static gboolean
-_vte_pango_check(struct _vte_draw *draw, GtkWidget *widget)
-{
- /* We can draw onto any widget. */
- return TRUE;
-}
-
static void
_vte_pango_create(struct _vte_draw *draw, GtkWidget *widget)
{
@@ -57,12 +48,8 @@
draw->impl_data = g_slice_new(struct _vte_pango_data);
data = (struct _vte_pango_data*) draw->impl_data;
- data->color.red = 0;
- data->color.green = 0;
- data->color.blue = 0;
data->pixmap = NULL;
data->pixmapw = data->pixmaph = 0;
- data->scrollx = data->scrolly = 0;
data->font = NULL;
data->layout = NULL;
data->gc = NULL;
@@ -89,18 +76,6 @@
g_slice_free (struct _vte_pango_data, draw->impl_data);
}
-static GdkVisual *
-_vte_pango_get_visual(struct _vte_draw *draw)
-{
- return gtk_widget_get_visual(draw->widget);
-}
-
-static GdkColormap *
-_vte_pango_get_colormap(struct _vte_draw *draw)
-{
- return gtk_widget_get_colormap(draw->widget);
-}
-
static void
_vte_pango_start(struct _vte_draw *draw)
{
@@ -123,7 +98,7 @@
data->gc = gdk_gc_new(draw->widget->window);
gdk_rgb_find_color(gdk_drawable_get_colormap(draw->widget->window),
- &data->color);
+ &draw->bg_color);
}
static void
@@ -143,13 +118,6 @@
}
static void
-_vte_pango_set_background_color(struct _vte_draw *draw, GdkColor *color, guint16 opacity)
-{
- struct _vte_pango_data *data = (struct _vte_pango_data*) draw->impl_data;
- data->color = *color;
-}
-
-static void
_vte_pango_set_background_image(struct _vte_draw *draw,
enum VteBgSourceType type,
GdkPixbuf *pixbuf,
@@ -170,14 +138,11 @@
if (data->pixmap != NULL) {
g_object_unref(data->pixmap);
}
- draw->requires_clear = FALSE;
data->pixmap = NULL;
data->pixmapw = data->pixmaph = 0;
if (pixmap) {
data->pixmap = pixmap;
gdk_drawable_get_size(pixmap, &data->pixmapw, &data->pixmaph);
- draw->requires_clear =
- data->pixmapw > 0 && data->pixmaph > 0;
}
}
@@ -198,7 +163,7 @@
if ((data->pixmap == NULL) ||
(data->pixmapw == 0) ||
(data->pixmaph == 0)) {
- gdk_gc_set_foreground(data->gc, &data->color);
+ gdk_gc_set_foreground(data->gc, &draw->bg_color);
gdk_draw_rectangle(draw->widget->window,
data->gc,
TRUE,
@@ -211,10 +176,10 @@
ystop = y + height;
y = ystop - height;
- j = (data->scrolly + y) % data->pixmaph;
+ j = (draw->scrolly + y) % data->pixmaph;
while (y < ystop) {
x = xstop - width;
- i = (data->scrollx + x) % data->pixmapw;
+ i = (draw->scrollx + x) % data->pixmapw;
h = MIN(data->pixmaph - (j % data->pixmaph), ystop - y);
while (x < xstop) {
w = MIN(data->pixmapw - (i % data->pixmapw), xstop - x);
@@ -302,36 +267,6 @@
g_object_unref(layout);
}
-static int
-_vte_pango_get_text_width(struct _vte_draw *draw)
-{
- return draw->width;
-}
-
-static int
-_vte_pango_get_text_height(struct _vte_draw *draw)
-{
- return draw->height;
-}
-
-static int
-_vte_pango_get_text_ascent(struct _vte_draw *draw)
-{
- return draw->ascent;
-}
-
-static int
-_vte_pango_get_char_width(struct _vte_draw *draw, gunichar c, int columns)
-{
- return _vte_pango_get_text_width(draw) * columns;
-}
-
-static gboolean
-_vte_pango_get_using_fontconfig(struct _vte_draw *draw)
-{
- return TRUE;
-}
-
static void
_vte_pango_draw_text(struct _vte_draw *draw,
struct _vte_draw_text_request *requests, gsize n_requests,
@@ -359,15 +294,6 @@
}
static gboolean
-_vte_pango_draw_char(struct _vte_draw *draw,
- struct _vte_draw_text_request *request,
- GdkColor *color, guchar alpha)
-{
- _vte_pango_draw_text(draw, request, 1, color, alpha);
- return TRUE;
-}
-
-static gboolean
_vte_pango_draw_has_char(struct _vte_draw *draw, gunichar c)
{
#if defined(PANGO_VERSION_CHECK) && PANGO_VERSION_CHECK(1,15,4)
@@ -417,38 +343,31 @@
x, y, width, height);
}
-static void
-_vte_pango_set_scroll(struct _vte_draw *draw, gint x, gint y)
-{
- struct _vte_pango_data *data = (struct _vte_pango_data*) draw->impl_data;
- data->scrollx = x;
- data->scrolly = y;
-}
-
const struct _vte_draw_impl _vte_draw_pango = {
"pango",
- _vte_pango_check,
+ NULL, /* check */
_vte_pango_create,
_vte_pango_destroy,
- _vte_pango_get_visual,
- _vte_pango_get_colormap,
+ NULL, /* get_visual */
+ NULL, /* get_colormap */
_vte_pango_start,
_vte_pango_end,
- _vte_pango_set_background_color,
+ NULL, /* set_background_opacity */
+ NULL, /* set_background_color */
_vte_pango_set_background_image,
- FALSE,
+ FALSE, /* always_requires_clear */
_vte_pango_clip,
_vte_pango_clear,
_vte_pango_set_text_font,
- _vte_pango_get_text_width,
- _vte_pango_get_text_height,
- _vte_pango_get_text_ascent,
- _vte_pango_get_char_width,
- _vte_pango_get_using_fontconfig,
+ NULL, /* get_text_width */
+ NULL, /* get_text_height */
+ NULL, /* get_text_ascent */
+ NULL, /* get_char_width */
+ NULL, /* get_using_fontconfig */
_vte_pango_draw_text,
- _vte_pango_draw_char,
+ NULL, /* draw_char */
_vte_pango_draw_has_char,
_vte_pango_draw_rectangle,
_vte_pango_fill_rectangle,
- _vte_pango_set_scroll,
+ NULL /* set_scroll */
};
Modified: trunk/src/vtexft.c
==============================================================================
--- trunk/src/vtexft.c (original)
+++ trunk/src/vtexft.c Thu Nov 13 15:13:26 2008
@@ -68,12 +68,9 @@
Visual *visual;
Colormap colormap;
XftDraw *draw;
- GdkColor color;
- guint16 opacity;
GdkPixmap *pixmap;
Pixmap xpixmap;
gint pixmapw, pixmaph;
- gint scrollx, scrolly;
GPtrArray *locked_fonts[2];
guint cur_locked_fonts;
gboolean has_clip_mask;
@@ -343,13 +340,6 @@
}
-static gboolean
-_vte_xft_check (struct _vte_draw *draw, GtkWidget *widget)
-{
- /* We can draw onto any widget. */
- return TRUE;
-}
-
static void
_vte_xft_create (struct _vte_draw *draw, GtkWidget *widget)
{
@@ -358,8 +348,6 @@
data = g_slice_new0 (struct _vte_xft_data);
draw->impl_data = data;
- data->opacity = 0xffff;
-
data->xpixmap = -1;
data->pixmapw = data->pixmaph = -1;
@@ -400,18 +388,6 @@
g_slice_free (struct _vte_xft_data, data);
}
-static GdkVisual *
-_vte_xft_get_visual (struct _vte_draw *draw)
-{
- return gtk_widget_get_visual (draw->widget);
-}
-
-static GdkColormap *
-_vte_xft_get_colormap (struct _vte_draw *draw)
-{
- return gtk_widget_get_colormap (draw->widget);
-}
-
static void
_vte_xft_start (struct _vte_draw *draw)
{
@@ -472,19 +448,6 @@
}
static void
-_vte_xft_set_background_color (struct _vte_draw *draw, GdkColor *color,
- guint16 opacity)
-{
- struct _vte_xft_data *data;
- data = (struct _vte_xft_data*) draw->impl_data;
- data->color = *color;
- data->opacity = opacity;
-
- draw->requires_clear = opacity != 0xffff
- || (data->pixmapw > 0 && data->pixmaph > 0);
-}
-
-static void
_vte_xft_set_background_image (struct _vte_draw *draw,
enum VteBgSourceType type,
GdkPixbuf *pixbuf,
@@ -497,7 +460,6 @@
data = (struct _vte_xft_data*) draw->impl_data;
- draw->requires_clear = data->opacity != 0xffff;
data->xpixmap = -1;
data->pixmapw = data->pixmaph = 0;
@@ -519,8 +481,6 @@
if (pixmap != NULL) {
data->xpixmap = gdk_x11_drawable_get_xid (pixmap);
gdk_drawable_get_size (pixmap, &data->pixmapw, &data->pixmaph);
- draw->requires_clear |=
- data->pixmapw > 0 && data->pixmaph > 0;
}
}
@@ -577,10 +537,10 @@
if (data->pixmap == NULL ||
(data->pixmapw <= 0) ||
(data->pixmaph <= 0)) {
- rcolor.red = data->color.red * data->opacity / 0xffff;
- rcolor.green = data->color.green * data->opacity / 0xffff;
- rcolor.blue = data->color.blue * data->opacity / 0xffff;
- rcolor.alpha = data->opacity;
+ rcolor.red = draw->bg_color.red * draw->bg_opacity / 0xffff;
+ rcolor.green = draw->bg_color.green * draw->bg_opacity / 0xffff;
+ rcolor.blue = draw->bg_color.blue * draw->bg_opacity / 0xffff;
+ rcolor.alpha = draw->bg_opacity;
if (XftColorAllocValue (data->display, data->visual,
data->colormap, &rcolor, &ftcolor)) {
XftDrawRect (data->draw, &ftcolor,
@@ -601,11 +561,11 @@
/* Flood fill. */
gc = XCreateGC (data->display, data->drawable, 0, NULL);
- sy = (data->scrolly + y) % data->pixmaph;
+ sy = (draw->scrolly + y) % data->pixmaph;
while (ty < tystop) {
h = MIN (data->pixmaph - sy, tystop - ty);
tx = x;
- sx = (data->scrollx + x) % data->pixmapw;
+ sx = (draw->scrollx + x) % data->pixmapw;
while (tx < txstop) {
w = MIN (data->pixmapw - sx, txstop - tx);
XCopyArea (data->display,
@@ -758,24 +718,6 @@
}
}
-static inline int
-_vte_xft_get_text_width (struct _vte_draw *draw)
-{
- return draw->width;
-}
-
-static inline int
-_vte_xft_get_text_height (struct _vte_draw *draw)
-{
- return draw->height;
-}
-
-static inline int
-_vte_xft_get_text_ascent (struct _vte_draw *draw)
-{
- return draw->ascent;
-}
-
static int
_vte_xft_get_char_width (struct _vte_draw *draw, gunichar c, int columns)
{
@@ -794,13 +736,8 @@
}
}
}
- return _vte_xft_get_text_width (draw) * columns;
-}
-static gboolean
-_vte_xft_get_using_fontconfig (struct _vte_draw *draw)
-{
- return TRUE;
+ return 0;
}
static void
@@ -916,23 +853,6 @@
}
static gboolean
-_vte_xft_draw_char (struct _vte_draw *draw,
- struct _vte_draw_text_request *request,
- GdkColor *color, guchar alpha)
-{
- struct _vte_xft_data *data;
-
- data = (struct _vte_xft_data*) draw->impl_data;
- if (data->font != NULL &&
- _vte_xft_font_for_char (data->font, request->c,
- data->locked_fonts[data->cur_locked_fonts&1]) != NULL) {
- _vte_xft_draw_text (draw, request, 1, color, alpha);
- return TRUE;
- }
- return FALSE;
-}
-
-static gboolean
_vte_xft_draw_has_char (struct _vte_draw *draw, gunichar c)
{
struct _vte_xft_data *data;
@@ -1005,39 +925,31 @@
}
}
-static void
-_vte_xft_set_scroll (struct _vte_draw *draw, gint x, gint y)
-{
- struct _vte_xft_data *data;
- data = (struct _vte_xft_data*) draw->impl_data;
- data->scrollx = x;
- data->scrolly = y;
-}
-
const struct _vte_draw_impl _vte_draw_xft = {
"xft",
- _vte_xft_check,
+ NULL, /* check */
_vte_xft_create,
_vte_xft_destroy,
- _vte_xft_get_visual,
- _vte_xft_get_colormap,
+ NULL, /* get_visual */
+ NULL, /* get_colormap */
_vte_xft_start,
_vte_xft_end,
- _vte_xft_set_background_color,
+ NULL, /* set_background_opacity */
+ NULL, /* set_background_color */
_vte_xft_set_background_image,
FALSE,
_vte_xft_clip,
_vte_xft_clear,
_vte_xft_set_text_font,
- _vte_xft_get_text_width,
- _vte_xft_get_text_height,
- _vte_xft_get_text_ascent,
+ NULL, /* get_text_width */
+ NULL, /* get_text_height */
+ NULL, /* get_text_ascent */
_vte_xft_get_char_width,
- _vte_xft_get_using_fontconfig,
+ NULL, /* get_using_fontconfig */
_vte_xft_draw_text,
- _vte_xft_draw_char,
+ NULL, /* draw_char */
_vte_xft_draw_has_char,
_vte_xft_draw_rectangle,
_vte_xft_fill_rectangle,
- _vte_xft_set_scroll,
+ NULL /* set_scroll */
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]