1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-23 06:38:05 +01:00

gif update from Graham Whitted <gbw@sgrail.com>

removed cycle_bench() from testgrad
This commit is contained in:
kojima
2000-02-29 18:10:27 +00:00
parent fea35bfc99
commit 34c4040d91
2 changed files with 21 additions and 18 deletions

View File

@@ -44,10 +44,10 @@ RImage*
RLoadGIF(RContext *context, char *file, int index)
{
RImage *image = NULL;
#if 0
unsigned char *cptr;
GifFileType *gif = NULL;
GifPixelType *buffer = NULL;
int i, j, k, ofs = 0;
int i, j, k;
int width, height;
GifRecordType recType;
ColorMapObject *colormap;
@@ -136,6 +136,12 @@ RLoadGIF(RContext *context, char *file, int index)
if (gif->Image.Interlace) {
int l;
int pelsPerLine;
if (RRGBAFormat==image->format)
pelsPerLine = width * 4;
else
pelsPerLine = width * 3;
for (j = 0; j < 4; j++) {
for (k = InterlacedOffset[j]; k < height;
@@ -143,25 +149,28 @@ RLoadGIF(RContext *context, char *file, int index)
if (DGifGetLine(gif, buffer, width)==GIF_ERROR) {
goto giferr;
}
ofs = k*width;
for (l = 0; l < width; l++, ofs++) {
cptr = image->data + (k*pelsPerLine);
for (l = 0; l < width; l++) {
int pixel = buffer[l];
image->data[0][ofs] = rmap[pixel];
image->data[1][ofs] = gmap[pixel];
image->data[2][ofs] = bmap[pixel];
*cptr++ = rmap[pixel];
*cptr++ = gmap[pixel];
*cptr++ = bmap[pixel];
}
}
}
} else {
cptr = image->data;
for (j = 0; j < height; j++) {
if (DGifGetLine(gif, buffer, width)==GIF_ERROR) {
goto giferr;
}
for (k = 0; k < width; k++, ofs++) {
for (k = 0; k < width; k++) {
int pixel = buffer[k];
image->data[0][ofs] = rmap[pixel];
image->data[1][ofs] = gmap[pixel];
image->data[2][ofs] = bmap[pixel];
*cptr++ = rmap[pixel];
*cptr++ = gmap[pixel];
*cptr++ = bmap[pixel];
if (RRGBAFormat==image->format)
cptr++;
}
}
}
@@ -209,7 +218,7 @@ did_not_get_any_errors:
if (gif)
DGifCloseFile(gif);
#endif
return image;
}

View File

@@ -190,15 +190,9 @@ int main(int argc, char **argv)
printf("average time per convertion %f sec\n", rt/i);
printf("------------------------------------------\n");
#else
cycle_bench(1);
imgh = RRenderMultiGradient(250, 250, colors, RGRD_HORIZONTAL);
cycle_bench(0);
cycle_bench(1);
imgv = RRenderMultiGradient(250, 250, colors, RGRD_VERTICAL);
cycle_bench(0);
cycle_bench(1);
imgd = RRenderMultiGradient(250, 250, colors, RGRD_DIAGONAL);
cycle_bench(0);
RConvertImage(ctx, imgh, &pix);
XCopyArea(dpy, pix, win, ctx->copy_gc, 0, 0, 250, 250, 0, 0);