mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
fixed bug with RCreateImageFromXImage() with mask and image of != sizes
fixed dgradient rendering
This commit is contained in:
@@ -250,13 +250,13 @@ renderDGradient(unsigned width, unsigned height, int r0, int g0, int b0,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
a = (((width - 1)<<16) / (height - 1))*3;
|
a = (((width - 1)<<16) / (height - 1));
|
||||||
|
|
||||||
width *= 3;
|
width *= 3;
|
||||||
/* copy the first line to the other lines with corresponding offset */
|
/* copy the first line to the other lines with corresponding offset */
|
||||||
for (i=0, j=0, offset = 0; i<height; i++, j+= width) {
|
for (i=0, j=0, offset = 0; i<height; i++, j+= width) {
|
||||||
offset += a;
|
offset += a;
|
||||||
memcpy(&(image->data[j]), &(tmp->data[(offset>>16)]), width);
|
memcpy(&(image->data[j]), &(tmp->data[(offset>>16)*3]), width);
|
||||||
}
|
}
|
||||||
RDestroyImage(tmp);
|
RDestroyImage(tmp);
|
||||||
return image;
|
return image;
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ x86_check_mmx()
|
|||||||
* PPlain YES YES
|
* PPlain YES YES
|
||||||
* MMX DONE
|
* MMX DONE
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* - try to align stack (local variable space) into quadword boundary
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -107,7 +109,6 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image, // 8
|
|||||||
|
|
||||||
asm volatile
|
asm volatile
|
||||||
(
|
(
|
||||||
"andl $-8, %ebp \n" // make it align
|
|
||||||
"subl $128, %esp \n" // alloc some more stack
|
"subl $128, %esp \n" // alloc some more stack
|
||||||
|
|
||||||
"pusha \n"
|
"pusha \n"
|
||||||
|
|||||||
@@ -119,9 +119,11 @@ RCreateImageFromXImage(RContext *context, XImage *image, XImage *mask)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define MIN(a,b) ((a)<(b)?(a):(b))
|
||||||
if (mask) {
|
if (mask) {
|
||||||
for (y = 0; y < mask->height; y++) {
|
for (y = 0; y < MIN(mask->height, image->height); y++) {
|
||||||
for (x = 0; x < mask->width; x++) {
|
for (x = 0; x < MIN(mask->width, image->width); x++) {
|
||||||
if (XGetPixel(mask, x, y)) {
|
if (XGetPixel(mask, x, y)) {
|
||||||
*(data++) = 0xff;
|
*(data++) = 0xff;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user