1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-05 21:34:17 +01:00

changed format of RImage, added x86 speicfic optimized code

This commit is contained in:
kojima
2000-01-14 16:39:15 +00:00
parent f2de1c9dcf
commit a30475fc0f
23 changed files with 1527 additions and 1324 deletions

View File

@@ -65,7 +65,7 @@ RLoadPNG(RContext *context, char *file, int index)
png_uint_32 width, height;
int depth, junk, color_type;
png_bytep *png_rows;
unsigned char *r, *g, *b, *a;
unsigned char *ptr;
f = fopen(file, "r");
if (!f) {
@@ -207,27 +207,19 @@ RLoadPNG(RContext *context, char *file, int index)
fclose(f);
r = image->data[0];
g = image->data[1];
b = image->data[2];
a = image->data[3];
ptr = image->data;
/* convert to RImage */
if (alpha) {
for (y=0; y<height; y++) {
for (x=0, i=0; x<width; x++) {
*(r++) = *(png_rows[y]+i++);
*(g++) = *(png_rows[y]+i++);
*(b++) = *(png_rows[y]+i++);
*(a++) = *(png_rows[y]+i++);
for (x=0, i=width*4; x<i; x++, ptr++) {
*ptr = *(png_rows[y]+x);
}
}
} else {
for (y=0; y<height; y++) {
for (x=0, i=0; x<width; x++) {
*(r++) = *(png_rows[y]+i++);
*(g++) = *(png_rows[y]+i++);
*(b++) = *(png_rows[y]+i++);
for (x=0, i=width*3; x<i; x++, ptr++) {
*ptr = *(png_rows[y]+x);
}
}
}