Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/imbuf/intern/tiff.c')
-rw-r--r--source/blender/imbuf/intern/tiff.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c
index 914fcc4e847..0d650daa1c9 100644
--- a/source/blender/imbuf/intern/tiff.c
+++ b/source/blender/imbuf/intern/tiff.c
@@ -47,7 +47,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
-
+
#include "BKE_global.h"
#include "IMB_imbuf_types.h"
@@ -137,10 +137,10 @@ static tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n)
nRemaining = 0;
else
nRemaining = mfile->size - mfile->offset;
-
+
if (nCopy > nRemaining)
nCopy = nRemaining;
-
+
/* on EOF, return immediately and read (copy) nothing */
if (nCopy <= 0)
return (0);
@@ -165,7 +165,7 @@ static tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n)
(void)handle;
(void)data;
(void)n;
-
+
printf("imb_tiff_WriteProc: this function should not be called.\n");
return (-1);
}
@@ -208,7 +208,7 @@ static toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence)
break;
default:
/* no other types are supported - return an error */
- fprintf(stderr,
+ fprintf(stderr,
"imb_tiff_SeekProc: "
"Unsupported TIFF SEEK type.\n");
return (-1);
@@ -243,12 +243,12 @@ static int imb_tiff_CloseProc(thandle_t handle)
fprintf(stderr, "imb_tiff_CloseProc: !mfile || !mfile->mem!\n");
return (0);
}
-
+
/* virtually close the file */
mfile->mem = NULL;
mfile->offset = 0;
mfile->size = 0;
-
+
return (0);
}
@@ -281,7 +281,7 @@ static TIFF *imb_tiff_client_open(ImbTIFFMemFile *memFile, const unsigned char *
memFile->offset = 0;
memFile->size = size;
- return TIFFClientOpen("(Blender TIFF Interface Layer)",
+ return TIFFClientOpen("(Blender TIFF Interface Layer)",
"r", (thandle_t)(memFile),
imb_tiff_ReadProc, imb_tiff_WriteProc,
imb_tiff_SeekProc, imb_tiff_CloseProc,
@@ -369,7 +369,7 @@ static void imb_read_tiff_resolution(ImBuf *ibuf, TIFF *image)
}
}
-/*
+/*
* Use the libTIFF scanline API to read a TIFF image.
* This method is most flexible and can handle multiple different bit depths
* and RGB channel orderings.
@@ -408,7 +408,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image)
imb_read_tiff_resolution(ibuf, image);
scanline = TIFFScanlineSize(image);
-
+
if (bitspersample == 32) {
ib_flag = IB_rectfloat;
fbuf = (float *)_TIFFmalloc(scanline);
@@ -426,12 +426,12 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image)
else {
ib_flag = IB_rect;
}
-
+
tmpibuf = IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->planes, ib_flag);
if (!tmpibuf) {
goto cleanup;
}
-
+
/* simple RGBA image */
if (!(bitspersample == 32 || bitspersample == 16)) {
success |= TIFFReadRGBAImage(image, ibuf->x, ibuf->y, tmpibuf->rect, 0);
@@ -440,11 +440,11 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image)
else if (config == PLANARCONFIG_CONTIG) {
for (row = 0; row < ibuf->y; row++) {
size_t ib_offset = (size_t)ibuf->x * 4 * ((size_t)ibuf->y - ((size_t)row + 1));
-
+
if (bitspersample == 32) {
success |= TIFFReadScanline(image, fbuf, row, 0);
scanline_contig_32bit(tmpibuf->rect_float + ib_offset, fbuf, ibuf->x, spp);
-
+
}
else if (bitspersample == 16) {
success |= TIFFReadScanline(image, sbuf, row, 0);
@@ -454,13 +454,13 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image)
/* separate channels: RRRGGGBBB */
}
else if (config == PLANARCONFIG_SEPARATE) {
-
+
/* imbufs always have 4 channels of data, so we iterate over all of them
* but only fill in from the TIFF scanline where necessary. */
for (chan = 0; chan < 4; chan++) {
for (row = 0; row < ibuf->y; row++) {
size_t ib_offset = (size_t)ibuf->x * 4 * ((size_t)ibuf->y - ((size_t)row + 1));
-
+
if (bitspersample == 32) {
if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */
copy_vn_fl(fbuf, ibuf->x, 1.0f);
@@ -469,7 +469,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image)
else
success |= TIFFReadScanline(image, fbuf, row, chan);
scanline_separate_32bit(tmpibuf->rect_float + ib_offset, fbuf, ibuf->x, chan);
-
+
}
else if (bitspersample == 16) {
if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */
@@ -479,7 +479,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image)
else
success |= TIFFReadScanline(image, sbuf, row, chan);
scanline_separate_16bit(tmpibuf->rect_float + ib_offset, sbuf, ibuf->x, chan);
-
+
}
}
}
@@ -490,7 +490,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image)
if (bitspersample < 16)
if (ENDIAN_ORDER == B_ENDIAN)
IMB_convert_rgba_to_abgr(tmpibuf);
-
+
/* assign rect last */
if (tmpibuf->rect_float)
ibuf->rect_float = tmpibuf->rect_float;
@@ -498,7 +498,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image)
ibuf->rect = tmpibuf->rect;
ibuf->mall |= ib_flag;
ibuf->flags |= ib_flag;
-
+
tmpibuf->mall &= ~ib_flag;
}
@@ -509,7 +509,7 @@ cleanup:
_TIFFfree(sbuf);
IMB_freeImBuf(tmpibuf);
-
+
return success;
}
@@ -564,15 +564,15 @@ ImBuf *imb_loadtiff(const unsigned char *mem, size_t size, int flags, char color
TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &width);
TIFFGetField(image, TIFFTAG_IMAGELENGTH, &height);
TIFFGetField(image, TIFFTAG_SAMPLESPERPIXEL, &spp);
-
+
ib_depth = (spp == 3) ? 24 : 32;
-
+
ibuf = IMB_allocImBuf(width, height, ib_depth, 0);
if (ibuf) {
ibuf->ftype = IMB_FTYPE_TIF;
}
else {
- fprintf(stderr,
+ fprintf(stderr,
"imb_loadtiff: could not allocate memory for TIFF "
"image.\n");
TIFFClose(image);
@@ -808,7 +808,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
/* RGBA images */
TIFFSetField(image, TIFFTAG_EXTRASAMPLES, 1,
extraSampleTypes);
- TIFFSetField(image, TIFFTAG_PHOTOMETRIC,
+ TIFFSetField(image, TIFFTAG_PHOTOMETRIC,
PHOTOMETRIC_RGB);
}
else if (samplesperpixel == 3) {