#include <X11/Xft/Xft.h>
#include <glib.h>
+#include "../kernel/geom.h"
void font_startup(void)
{
return (signed) f->xftfont->max_advance_width;
}
-void font_draw(XftDraw *d, TextureText *t, int x, int y, int w, int h)
+void font_draw(XftDraw *d, TextureText *t, Rect *position)
{
+ int x,y,w,h;
XftColor c;
+ x = position->x;
+ y = position->y;
+ w = position->width;
+ h = position->height;
+
/* accomidate for areas bigger/smaller than Xft thinks the font is tall */
y -= (2 * (t->font->xftfont->ascent + t->font->xftfont->descent) -
(t->font->height + h) - 1) / 2;
#define __font_h
#include <X11/Xft/Xft.h>
#include "render.h"
+#include "../kernel/geom.h"
void font_startup(void);
ObFont *font_open(char *fontstring);
int font_measure_string(ObFont *f, char *str, int shadow, int offset);
int font_height(ObFont *f, int shadow, int offset);
int font_max_char_width(ObFont *f);
-void font_draw(XftDraw *d, TextureText *t, int x, int y, int w, int h);
+void font_draw(XftDraw *d, TextureText *t, Rect *position);
#endif /* __font_h */
g_free(m);
}
-void mask_draw(Pixmap p, TextureMask *m, int width, int height)
+void mask_draw(Pixmap p, TextureMask *m, Rect *position)
{
int x, y;
if (m->mask == None) return; /* no mask given */
/* set the clip region */
- x = (width - m->mask->w) / 2;
- y = (height - m->mask->h) / 2;
+ x = position->x + (position->width - m->mask->w) / 2;
+ y = position->y + (position->height - m->mask->h) / 2;
+
+ if (x < 0) x = 0;
+ if (y < 0) y = 0;
+
XSetClipMask(ob_display, m->color->gc, m->mask->mask);
XSetClipOrigin(ob_display, m->color->gc, x, y);
#define __mask_h
#include "render.h"
+#include "../kernel/geom.h"
pixmap_mask *pixmap_mask_new(int w, int h, char *data);
void pixmap_mask_free(pixmap_mask *m);
-void mask_draw(Pixmap p, TextureMask *m, int width, int height);
+void mask_draw(Pixmap p, TextureMask *m, Rect *position);
#endif
l->xftdraw = XftDrawCreate(ob_display, l->pixmap,
render_visual, render_colormap);
}
- font_draw(l->xftdraw, &l->texture[i].data.text, x, y, w, h);
+ font_draw(l->xftdraw, &l->texture[i].data.text,
+ &l->texture[i].position);
break;
case Bitmask:
if (l->texture[i].data.mask.color->gc == None)
color_allocate_gc(l->texture[i].data.mask.color);
- mask_draw(l->pixmap, &l->texture[i].data.mask, w, h);
+ mask_draw(l->pixmap, &l->texture[i].data.mask,
+ &l->texture[i].position);
break;
}
}