mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-02 22:25:48 +01:00
eliminated gcc-4 compilation warnings
This commit is contained in:
@@ -68,8 +68,9 @@ extern int x86_check_mmx();
|
||||
extern void x86_mmx_TrueColor_32_to_16(unsigned char *image,
|
||||
unsigned short *ximage,
|
||||
short *err, short *nerr,
|
||||
short *rtable, short *gtable,
|
||||
short *btable,
|
||||
const unsigned short *rtable,
|
||||
const unsigned short *gtable,
|
||||
const unsigned short *btable,
|
||||
int dr, int dg, int db,
|
||||
unsigned int roffs,
|
||||
unsigned int goffs,
|
||||
@@ -175,9 +176,9 @@ computeStdTable(unsigned int mult, unsigned int max)
|
||||
static void
|
||||
convertTrueColor_generic(RXImage *ximg, RImage *image,
|
||||
signed char *err, signed char *nerr,
|
||||
const short *rtable,
|
||||
const short *gtable,
|
||||
const short *btable,
|
||||
const unsigned short *rtable,
|
||||
const unsigned short *gtable,
|
||||
const unsigned short *btable,
|
||||
const int dr, const int dg, const int db,
|
||||
const unsigned short roffs,
|
||||
const unsigned short goffs,
|
||||
@@ -408,8 +409,8 @@ image2TrueColor(RContext *ctx, RImage *image)
|
||||
} else
|
||||
#endif /* ASM_X86_MMX */
|
||||
{
|
||||
char *err;
|
||||
char *nerr;
|
||||
signed char *err;
|
||||
signed char *nerr;
|
||||
int ch = (HAS_ALPHA(image) ? 4 : 3);
|
||||
|
||||
err = malloc(ch*(image->width+2));
|
||||
@@ -447,9 +448,9 @@ image2TrueColor(RContext *ctx, RImage *image)
|
||||
static void
|
||||
convertPseudoColor_to_8(RXImage *ximg, RImage *image,
|
||||
signed char *err, signed char *nerr,
|
||||
const short *rtable,
|
||||
const short *gtable,
|
||||
const short *btable,
|
||||
const unsigned short *rtable,
|
||||
const unsigned short *gtable,
|
||||
const unsigned short *btable,
|
||||
const int dr, const int dg, const int db,
|
||||
unsigned long *pixels,
|
||||
int cpc)
|
||||
@@ -459,7 +460,7 @@ convertPseudoColor_to_8(RXImage *ximg, RImage *image,
|
||||
int pixel;
|
||||
int rer, ger, ber;
|
||||
unsigned char *ptr = image->data;
|
||||
unsigned char *optr = ximg->image->data;
|
||||
unsigned char *optr = (unsigned char*)ximg->image->data;
|
||||
int channels = (HAS_ALPHA(image) ? 4 : 3);
|
||||
int cpcpc = cpc*cpc;
|
||||
|
||||
@@ -573,8 +574,8 @@ image2PseudoColor(RContext *ctx, RImage *image)
|
||||
}
|
||||
} else {
|
||||
/* dither */
|
||||
char *err;
|
||||
char *nerr;
|
||||
signed char *err;
|
||||
signed char *nerr;
|
||||
const int dr=0xff/rmask;
|
||||
const int dg=0xff/gmask;
|
||||
const int db=0xff/bmask;
|
||||
|
||||
@@ -242,7 +242,7 @@ renderDGradient(unsigned width, unsigned height, int r0, int g0, int b0,
|
||||
RImage *image, *tmp;
|
||||
int j;
|
||||
float a, offset;
|
||||
char *ptr;
|
||||
unsigned char *ptr;
|
||||
|
||||
if (width == 1)
|
||||
return renderVGradient(width, height, r0, g0, b0, rf, gf, bf);
|
||||
|
||||
@@ -43,8 +43,9 @@ load_graymap(char *file_name, FILE *file, int w, int h, int max, int raw)
|
||||
|
||||
} else {
|
||||
if (max<256) {
|
||||
unsigned char *ptr;
|
||||
char *buf;
|
||||
int x, y;
|
||||
char *buf, *ptr;
|
||||
|
||||
buf = malloc(w+1);
|
||||
if (!buf) {
|
||||
@@ -83,7 +84,7 @@ load_pixmap(char *file_name, FILE *file, int w, int h, int max, int raw)
|
||||
RImage *image;
|
||||
int i;
|
||||
char buf[3];
|
||||
char *ptr;
|
||||
unsigned char *ptr;
|
||||
|
||||
image = RCreateImage(w, h, 0);
|
||||
if (!image) {
|
||||
|
||||
@@ -283,31 +283,37 @@ RCombineImagesWithOpaqueness(RImage *image, RImage *src, int opaqueness)
|
||||
|
||||
int
|
||||
calculateCombineArea(RImage *des, RImage *src, int *sx, int *sy,
|
||||
int *swidth, int *sheight, int *dx, int *dy)
|
||||
unsigned int *swidth, unsigned int *sheight, int *dx, int *dy)
|
||||
{
|
||||
int width = (int)*swidth, height = (int)*sheight;
|
||||
|
||||
if (*dx < 0) {
|
||||
*sx = -*dx;
|
||||
*swidth = *swidth + *dx;
|
||||
width = width + *dx;
|
||||
*dx = 0;
|
||||
}
|
||||
|
||||
if (*dx + *swidth > des->width) {
|
||||
*swidth = des->width - *dx;
|
||||
if (*dx + width > des->width) {
|
||||
width = des->width - *dx;
|
||||
}
|
||||
|
||||
if (*dy < 0) {
|
||||
*sy = -*dy;
|
||||
*sheight = *sheight + *dy;
|
||||
height = height + *dy;
|
||||
*dy = 0;
|
||||
}
|
||||
|
||||
if (*dy + *sheight > des->height) {
|
||||
*sheight = des->height - *dy;
|
||||
if (*dy + height > des->height) {
|
||||
height = des->height - *dy;
|
||||
}
|
||||
|
||||
if (*sheight > 0 && *swidth > 0) {
|
||||
if (height>0 && width>0) {
|
||||
*swidth = width;
|
||||
*sheight = height;
|
||||
return True;
|
||||
} else return False;
|
||||
}
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -85,9 +85,9 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
|
||||
unsigned short *ximage,
|
||||
short *err,
|
||||
short *nerr,
|
||||
short *rtable,
|
||||
short *gtable,
|
||||
short *btable,
|
||||
unsigned short *rtable,
|
||||
unsigned short *gtable,
|
||||
unsigned short *btable,
|
||||
int dr,
|
||||
int dg,
|
||||
int db,
|
||||
@@ -99,13 +99,17 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
|
||||
int line_offset)
|
||||
{
|
||||
union {
|
||||
long long rrggbbaa;
|
||||
struct {short int rr, gg, bb, aa;} words;
|
||||
long long rrggbbaa;
|
||||
struct {
|
||||
short int rr, gg, bb, aa;
|
||||
} words;
|
||||
} rrggbbaa;
|
||||
|
||||
|
||||
union {
|
||||
long long pixel;
|
||||
struct {short int rr, gg, bb, aa;} words;
|
||||
long long pixel;
|
||||
struct {
|
||||
short int rr, gg, bb, aa;
|
||||
} words;
|
||||
} pixel;
|
||||
|
||||
short *tmp_err;
|
||||
@@ -114,7 +118,7 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
|
||||
|
||||
asm volatile
|
||||
(
|
||||
"pushl %%ebx \n\t"
|
||||
"pushl %%ebx \n\t"
|
||||
|
||||
// pack dr, dg and db into mm6
|
||||
"movl %7, %%eax \n\t"
|
||||
@@ -227,7 +231,7 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
|
||||
"movq %%mm0, %%mm1 \n\t"
|
||||
"pmullw %%mm5, %%mm1 \n\t" // mm1 = mm1*7
|
||||
"psrlw %%mm7, %%mm1 \n\t" // mm1 = mm1/16
|
||||
"paddw 8(%%ebx), %%mm1 \n\t"
|
||||
"paddw 8(%%ebx), %%mm1 \n\t"
|
||||
"movq %%mm1, 8(%%ebx) \n\t" // err[x+1,y] = rer*7/16
|
||||
|
||||
|
||||
@@ -236,7 +240,7 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
|
||||
"movq %%mm0, %%mm1 \n\t"
|
||||
"pmullw %%mm4, %%mm1 \n\t" // mm1 = mm1*5
|
||||
"psrlw %%mm7, %%mm1 \n\t" // mm1 = mm1/16
|
||||
"paddw -8(%%ebx), %%mm1 \n\t"
|
||||
"paddw -8(%%ebx), %%mm1 \n\t"
|
||||
"movq %%mm1, -8(%%ebx) \n\t" // err[x-1,y+1] += rer*3/16
|
||||
|
||||
"movq %%mm0, %%mm1 \n\t"
|
||||
@@ -282,7 +286,7 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
|
||||
// because, punpcklbw is used (which reads 8 bytes) and the last
|
||||
// pixel is only 4 bytes. This is no problem because the image data
|
||||
// was allocated with extra 4 bytes when created.
|
||||
"addl $4, %%esi \n\t" // image->data += 4
|
||||
"addl $4, %%esi \n\t" // image->data += 4
|
||||
|
||||
|
||||
"decl %26 \n\t" // x--
|
||||
@@ -298,7 +302,7 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
|
||||
|
||||
".Enda: \n\t" // THE END
|
||||
"emms \n\t"
|
||||
"popl %%ebx \n\t"
|
||||
"popl %%ebx \n\t"
|
||||
:
|
||||
:
|
||||
"m" (image), // %0
|
||||
@@ -317,18 +321,18 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
|
||||
"m" (width), // %13
|
||||
"m" (height), // %14
|
||||
"m" (line_offset), // %15
|
||||
"m" (rrggbbaa.rrggbbaa), // %16 (access to rr)
|
||||
"m" (rrggbbaa.words.rr), // %16 (access to rr)
|
||||
"m" (rrggbbaa.words.gg), // %17 (access to gg)
|
||||
"m" (rrggbbaa.words.bb), // %18 (access to bb)
|
||||
"m" (rrggbbaa.words.aa), // %19 (access to aa)
|
||||
"m" (pixel.pixel), // %20 (access to pixel.r)
|
||||
"m" (pixel.words.rr), // %20 (access to pixel.r)
|
||||
"m" (pixel.words.gg), // %21 (access to pixel.g)
|
||||
"m" (pixel.words.bb), // %22 (access to pixel.b)
|
||||
"m" (pixel.words.aa), // %23 (access to pixel.a)
|
||||
"m" (tmp_err), // %24
|
||||
"m" (tmp_nerr), // %25
|
||||
"m" (x) // %26
|
||||
: "eax", "ecx", "edx", "esi", "edi"
|
||||
: "eax", "ecx", "edx", "esi", "edi"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -352,13 +356,17 @@ x86_mmx_TrueColor_24_to_16(unsigned char *image,
|
||||
int line_offset)
|
||||
{
|
||||
union {
|
||||
long long rrggbbaa;
|
||||
struct {short int rr, gg, bb, aa;} words;
|
||||
long long rrggbbaa;
|
||||
struct {
|
||||
short int rr, gg, bb, aa;
|
||||
} words;
|
||||
} rrggbbaa;
|
||||
|
||||
union {
|
||||
long long pixel;
|
||||
struct {short int rr, gg, bb, aa;} words;
|
||||
long long pixel;
|
||||
struct {
|
||||
short int rr, gg, bb, aa;
|
||||
} words;
|
||||
} pixel;
|
||||
|
||||
short *tmp_err;
|
||||
@@ -370,7 +378,7 @@ x86_mmx_TrueColor_24_to_16(unsigned char *image,
|
||||
|
||||
asm volatile
|
||||
(
|
||||
"pushl %%ebx \n\t"
|
||||
"pushl %%ebx \n\t"
|
||||
|
||||
"movl %13, %%eax \n\t" // eax = width
|
||||
"movl %%eax, %%ebx \n\t"
|
||||
@@ -440,7 +448,7 @@ x86_mmx_TrueColor_24_to_16(unsigned char *image,
|
||||
|
||||
".Endc: \n\t" // THE END
|
||||
"emms \n\t"
|
||||
"popl %%ebx \n\t"
|
||||
"popl %%ebx \n\t"
|
||||
:
|
||||
:
|
||||
"m" (image), // %0
|
||||
@@ -459,11 +467,11 @@ x86_mmx_TrueColor_24_to_16(unsigned char *image,
|
||||
"m" (width), // %13
|
||||
"m" (height), // %14
|
||||
"m" (line_offset), // %15
|
||||
"m" (rrggbbaa.rrggbbaa), // %16 (access to rr)
|
||||
"m" (rrggbbaa.words.rr), // %16 (access to rr)
|
||||
"m" (rrggbbaa.words.gg), // %17 (access to gg)
|
||||
"m" (rrggbbaa.words.bb), // %18 (access to bb)
|
||||
"m" (rrggbbaa.words.aa), // %19 (access to aa)
|
||||
"m" (pixel.pixel), // %20 (access to pixel.r)
|
||||
"m" (pixel.words.rr), // %20 (access to pixel.r)
|
||||
"m" (pixel.words.gg), // %21 (access to pixel.g)
|
||||
"m" (pixel.words.bb), // %22 (access to pixel.b)
|
||||
"m" (pixel.words.aa), // %23 (access to pixel.a)
|
||||
@@ -472,7 +480,7 @@ x86_mmx_TrueColor_24_to_16(unsigned char *image,
|
||||
"m" (x), // %26
|
||||
"m" (w1), // %27
|
||||
"m" (w2) // %28
|
||||
: "eax", "ecx", "edx", "esi", "edi"
|
||||
: "eax", "ecx", "edx", "esi", "edi"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -670,7 +678,7 @@ x86_PseudoColor_32_to_8(unsigned char *image,
|
||||
"movw $0xff, %%dx \n\t" // pixel.blu > 255
|
||||
"jmp .OKBb \n"
|
||||
".NEGBb: \n\t"
|
||||
"xorw %%dx, %%dx \n"
|
||||
"xorw %%dx, %%dx \n"
|
||||
".OKBb: \n\t"
|
||||
//partial reg
|
||||
"leal (%%edi, %%edx, 2), %%ecx \n\t" // ecx = &ctable[pixel.blu]
|
||||
|
||||
Reference in New Issue
Block a user