diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2014-11-20 12:32:01 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2017-03-08 11:27:55 +0100 |
commit | f2c664a04fa6cf49b3719a0cc4c59f57bab04948 (patch) | |
tree | f0f9fe151dcb2260b953d3bc840bae6b3796a1a6 /wr | |
parent | f897a5ee212491ea5d0560eeb1ca4f6bcfbfe111 (diff) | |
download | fbida-f2c664a04fa6cf49b3719a0cc4c59f57bab04948.tar.gz |
use pixman images for storage
Diffstat (limited to 'wr')
-rw-r--r-- | wr/write-jpeg.c | 6 | ||||
-rw-r--r-- | wr/write-png.c | 2 | ||||
-rw-r--r-- | wr/write-ppm.c | 5 | ||||
-rw-r--r-- | wr/write-ps.c | 4 | ||||
-rw-r--r-- | wr/write-tiff.c | 2 |
5 files changed, 11 insertions, 8 deletions
diff --git a/wr/write-jpeg.c b/wr/write-jpeg.c index 2e39c68..08dade5 100644 --- a/wr/write-jpeg.c +++ b/wr/write-jpeg.c @@ -81,9 +81,11 @@ jpeg_write(FILE *fp, struct ida_image *img) jpeg_set_quality(&cinfo, jpeg_quality, TRUE); jpeg_start_compress(&cinfo, TRUE); - for (i = 0, line = img->data; i < img->i.height; i++, line += img->i.width*3) + for (i = 0; i < img->i.height; i++) { + line = ida_image_scanline(img, i); jpeg_write_scanlines(&cinfo, &line, 1); - + } + jpeg_finish_compress(&(cinfo)); jpeg_destroy_compress(&(cinfo)); return 0; diff --git a/wr/write-png.c b/wr/write-png.c index c8643a5..34f7bed 100644 --- a/wr/write-png.c +++ b/wr/write-png.c @@ -52,7 +52,7 @@ png_write(FILE *fp, struct ida_image *img) png_set_packing(png_ptr); for (y = 0; y < img->i.height; y++) { - row = img->data + y * 3 * img->i.width; + row = ida_image_scanline(img, y); png_write_rows(png_ptr, &row, 1); } png_write_end(png_ptr, info_ptr); diff --git a/wr/write-ppm.c b/wr/write-ppm.c index 016f0ba..1bb1f53 100644 --- a/wr/write-ppm.c +++ b/wr/write-ppm.c @@ -19,13 +19,14 @@ ppm_write(FILE *fp, struct ida_image *img) "# https://www.kraxel.org/blog/linux/fbida/\n" "%d %d\n255\n", img->i.width,img->i.height); - fwrite(img->data, img->i.height, 3*img->i.width, fp); + fwrite(ida_image_scanline(img, 0), + img->i.height, 3*img->i.width, fp); return 0; } static struct ida_writer ppm_writer = { label: "PPM", - ext: { "ppm", NULL}, + ext: { "ppm", NULL }, write: ppm_write, }; diff --git a/wr/write-ps.c b/wr/write-ps.c index 261a092..b1a2877 100644 --- a/wr/write-ps.c +++ b/wr/write-ps.c @@ -436,7 +436,7 @@ ps_write(FILE *fp, struct ida_image *img) /* image data + ps footer */ if (ps.ori == PORTRAIT) { - p = img->data; + p = ida_image_scanline(img, 0); for (y = 0; y < img->i.height; y++) { for (x = 0; x < img->i.width; x++) { if (0 == (x % 10)) @@ -448,7 +448,7 @@ ps_write(FILE *fp, struct ida_image *img) } } else { for (x = img->i.width-1; x != -1; x--) { - p = img->data + 3*x; + p = ida_image_scanline(img, 0) + 3*x; for (y = 0; y < img->i.height; y++) { if (0 == (y % 10)) fprintf(fp,"\n"); diff --git a/wr/write-tiff.c b/wr/write-tiff.c index 29d0788..a52c5a1 100644 --- a/wr/write-tiff.c +++ b/wr/write-tiff.c @@ -42,7 +42,7 @@ tiff_write(FILE *fp, struct ida_image *img) } for (y = 0; y < img->i.height; y++) { - buf = img->data + 3*img->i.width*y; + buf = ida_image_scanline(img, y); TIFFWriteScanline(TiffHndl, buf, y, 0); } TIFFClose(TiffHndl); |