1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00
This commit is contained in:
id
2000-12-17 16:23:43 +00:00
parent 210ff264b9
commit 37f811de3e

View File

@@ -93,7 +93,6 @@ RCreateImageFromXImage(RContext *context, XImage *image, XImage *mask)
data = img->data; data = img->data;
if (image->depth==1) { if (image->depth==1) {
if (mask) {
for (y = 0; y < image->height; y++) { for (y = 0; y < image->height; y++) {
for (x = 0; x < image->width; x++) { for (x = 0; x < image->width; x++) {
pixel = XGetPixel(image, x, y); pixel = XGetPixel(image, x, y);
@@ -106,34 +105,7 @@ RCreateImageFromXImage(RContext *context, XImage *image, XImage *mask)
*data++ = 0xff; *data++ = 0xff;
*data++ = 0xff; *data++ = 0xff;
} }
data++; if (mask) data++;
}
}
} else {
for (y = 0; y < image->height; y++) {
for (x = 0; x < image->width; x++) {
pixel = XGetPixel(image, x, y);
if (pixel) {
*data++ = 0;
*data++ = 0;
*data++ = 0;
} else {
*data++ = 0xff;
*data++ = 0xff;
*data++ = 0xff;
}
}
}
}
} else {
if (mask) {
for (y = 0; y < image->height; y++) {
for (x = 0; x < image->width; x++) {
pixel = XGetPixel(image, x, y);
*(data++) = NORMALIZE_RED(pixel);
*(data++) = NORMALIZE_GREEN(pixel);
*(data++) = NORMALIZE_BLUE(pixel);
data++;
} }
} }
} else { } else {
@@ -143,15 +115,14 @@ RCreateImageFromXImage(RContext *context, XImage *image, XImage *mask)
*(data++) = NORMALIZE_RED(pixel); *(data++) = NORMALIZE_RED(pixel);
*(data++) = NORMALIZE_GREEN(pixel); *(data++) = NORMALIZE_GREEN(pixel);
*(data++) = NORMALIZE_BLUE(pixel); *(data++) = NORMALIZE_BLUE(pixel);
} if (mask) data++;
} }
} }
} }
#define MIN(a,b) ((a)<(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b))
if (mask) { if (mask) {
data = img->data; data = img->data + 3; /* Skip R, G & B */
data += 3; /* Skip R, G & B */
for (y = 0; y < MIN(mask->height, image->height); y++) { for (y = 0; y < MIN(mask->height, image->height); y++) {
for (x = 0; x < MIN(mask->width, image->width); x++) { for (x = 0; x < MIN(mask->width, image->width); x++) {
if (mask->width <= image->width && XGetPixel(mask, x, y)) { if (mask->width <= image->width && XGetPixel(mask, x, y)) {