- if (l->surface.data.planar.grad == Background_Solid)
- gradient_solid(l, w, h);
- else gradient_render(&l->surface, w, h);
- for (i = 0; i < l->textures; i++) {
- printf("I AM DOING SOMETHING NOW\n");
- }
-//reduce depth
- if (l->surface.data.planar.grad != Background_Solid) {
- im = XCreateImage(ob_display, render_visual, render_depth,
- ZPixmap, 0, NULL, w, h, 32, 0);
- g_assert(im != None);
- im->byte_order = endian;
- im->data = l->surface.data.planar.pixel_data;
- XPutImage(ob_display, l->pixmap, DefaultGC(ob_display, ob_screen),
- im, 0, 0, 0, 0, w, h);
- im->data = NULL;
- XDestroyImage(im);
+ g_free(a->surface.pixel_data);
+ a->surface.pixel_data = g_new(RrPixel32, w * h);
+
+ if (a->surface.grad == RR_SURFACE_PARENTREL) {
+ g_assert (a->surface.parent);
+ g_assert (a->surface.parent->w);
+
+ sw = a->surface.parent->w;
+ source = (a->surface.parent->surface.pixel_data +
+ a->surface.parentx + sw * a->surface.parenty);
+ dest = a->surface.pixel_data;
+ for (i = 0; i < h; i++, source += sw, dest += w) {
+ memcpy(dest, source, w * sizeof(RrPixel32));
+ }
+ } else
+ RrRender(a, w, h);
+
+ {
+ gint l, t, r, b;
+ RrMargins(a, &l, &t, &r, &b);
+ RECT_SET(tarea, l, t, w - l - r, h - t - b);
+ }
+
+ for (i = 0; i < a->textures; i++) {
+ switch (a->texture[i].type) {
+ case RR_TEXTURE_NONE:
+ break;
+ case RR_TEXTURE_TEXT:
+ if (!transferred) {
+ transferred = 1;
+ if (a->surface.grad != RR_SURFACE_SOLID)
+ pixel_data_to_pixmap(a, 0, 0, w, h);
+ }
+ if (a->xftdraw == NULL) {
+ a->xftdraw = XftDrawCreate(RrDisplay(a->inst), a->pixmap,
+ RrVisual(a->inst),
+ RrColormap(a->inst));
+ }
+ RrFontDraw(a->xftdraw, &a->texture[i].data.text, &tarea);
+ break;
+ case RR_TEXTURE_LINE_ART:
+ if (!transferred) {
+ transferred = 1;
+ if (a->surface.grad != RR_SURFACE_SOLID)
+ pixel_data_to_pixmap(a, 0, 0, w, h);
+ }
+ XDrawLine(RrDisplay(a->inst), a->pixmap,
+ RrColorGC(a->texture[i].data.lineart.color),
+ a->texture[i].data.lineart.x1,
+ a->texture[i].data.lineart.y1,
+ a->texture[i].data.lineart.x2,
+ a->texture[i].data.lineart.y2);
+ break;
+ case RR_TEXTURE_MASK:
+ if (!transferred) {
+ transferred = 1;
+ if (a->surface.grad != RR_SURFACE_SOLID)
+ pixel_data_to_pixmap(a, 0, 0, w, h);
+ }
+ RrPixmapMaskDraw(a->pixmap, &a->texture[i].data.mask, &tarea);
+ break;
+ case RR_TEXTURE_RGBA:
+ g_assert(!transferred);
+ RrImageDraw(a->surface.pixel_data,
+ &a->texture[i].data.rgba,
+ a->w, a->h,
+ &tarea);
+ break;
+ }