diff --git a/wrlib/gradient.c b/wrlib/gradient.c index 5bbdf79f..22b4eba9 100644 --- a/wrlib/gradient.c +++ b/wrlib/gradient.c @@ -250,13 +250,13 @@ renderDGradient(unsigned width, unsigned height, int r0, int g0, int b0, return NULL; } - a = (((width - 1)<<16) / (height - 1))*3; + a = (((width - 1)<<16) / (height - 1)); width *= 3; /* copy the first line to the other lines with corresponding offset */ for (i=0, j=0, offset = 0; idata[j]), &(tmp->data[(offset>>16)]), width); + memcpy(&(image->data[j]), &(tmp->data[(offset>>16)*3]), width); } RDestroyImage(tmp); return image; diff --git a/wrlib/x86_specific.c b/wrlib/x86_specific.c index 800ede43..f0fa19e9 100644 --- a/wrlib/x86_specific.c +++ b/wrlib/x86_specific.c @@ -31,7 +31,7 @@ x86_check_mmx() { static int result = -1; - return 1; + return 1; if (result >= 0) return result; @@ -74,6 +74,8 @@ x86_check_mmx() * PPlain YES YES * 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 ( - "andl $-8, %ebp \n" // make it align "subl $128, %esp \n" // alloc some more stack "pusha \n" diff --git a/wrlib/xpixmap.c b/wrlib/xpixmap.c index 6a81668c..78c70b8b 100644 --- a/wrlib/xpixmap.c +++ b/wrlib/xpixmap.c @@ -119,9 +119,11 @@ RCreateImageFromXImage(RContext *context, XImage *image, XImage *mask) } } + +#define MIN(a,b) ((a)<(b)?(a):(b)) if (mask) { - for (y = 0; y < mask->height; y++) { - for (x = 0; x < mask->width; x++) { + for (y = 0; y < MIN(mask->height, image->height); y++) { + for (x = 0; x < MIN(mask->width, image->width); x++) { if (XGetPixel(mask, x, y)) { *(data++) = 0xff; } else {