WINGs/widgets: rewrite makePixmap to use RImage + RConvertImage
Replace X11 XDrawPoint pixel rendering with RImage construction and RConvertImage, which dispatches through the backend vtable. Fixes checkbox/radio button images not appearing in Wayland mode.
This commit is contained in:
parent
fdf0956c02
commit
c26a3bec30
|
|
@ -406,19 +406,49 @@ static void renderPixmap(W_Screen * screen, Pixmap d, Pixmap mask, char **data,
|
|||
|
||||
static WMPixmap *makePixmap(W_Screen * sPtr, char **data, int width, int height, int masked)
|
||||
{
|
||||
Pixmap pixmap, mask = None;
|
||||
RImage *img;
|
||||
WMPixmap *pix;
|
||||
int x, y;
|
||||
RColor white_c = {0xff, 0xff, 0xff, 0xff};
|
||||
RColor light_c = {0xae, 0xaa, 0xae, 0xff};
|
||||
RColor dark_c = {0x55, 0x55, 0x55, 0xff};
|
||||
RColor black_c = {0x00, 0x00, 0x00, 0xff};
|
||||
RColor trans_c = {0xae, 0xaa, 0xae, 0x00};
|
||||
|
||||
pixmap = XCreatePixmap(sPtr->display, W_DRAWABLE(sPtr), width, height, sPtr->depth);
|
||||
img = RCreateImage(width, height, True);
|
||||
|
||||
if (masked) {
|
||||
mask = XCreatePixmap(sPtr->display, W_DRAWABLE(sPtr), width, height, 1);
|
||||
XSetForeground(sPtr->display, sPtr->monoGC, 1);
|
||||
XFillRectangle(sPtr->display, mask, sPtr->monoGC, 0, 0, width, height);
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
RColor *c;
|
||||
switch (data[y][x]) {
|
||||
case ' ':
|
||||
case 'w':
|
||||
c = &white_c;
|
||||
break;
|
||||
case '=':
|
||||
c = masked ? &trans_c : &light_c;
|
||||
break;
|
||||
case '.':
|
||||
case 'l':
|
||||
c = &light_c;
|
||||
break;
|
||||
case '%':
|
||||
case 'd':
|
||||
c = &dark_c;
|
||||
break;
|
||||
case '#':
|
||||
case 'b':
|
||||
default:
|
||||
c = &black_c;
|
||||
break;
|
||||
}
|
||||
RPutPixel(img, x, y, c);
|
||||
}
|
||||
}
|
||||
|
||||
renderPixmap(sPtr, pixmap, mask, data, width, height);
|
||||
|
||||
return WMCreatePixmapFromXPixmaps(sPtr, pixmap, mask, width, height, sPtr->depth);
|
||||
pix = WMCreatePixmapFromRImage(sPtr, img, 128);
|
||||
RReleaseImage(img);
|
||||
return pix;
|
||||
}
|
||||
|
||||
#define T_WINGS_IMAGES_FILE RESOURCE_PATH"/Images.tiff"
|
||||
|
|
|
|||
Loading…
Reference in New Issue