OS/2 support added
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6081 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
# Author: David Webster
|
# Author: David Webster
|
||||||
# Created: 2000
|
# Created: 2000
|
||||||
# Updated:
|
# Updated:
|
||||||
# Copyright: c) 1993, AIAI, University of Edinburgh
|
# Copyright: c) 2000, BHM
|
||||||
#
|
#
|
||||||
# "%W% %G%"
|
# "%W% %G%"
|
||||||
#
|
#
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
OBJSUFF=obj
|
OBJSUFF=obj
|
||||||
SRCSUFF=cpp
|
SRCSUFF=cpp
|
||||||
|
|
||||||
OS2FLAGS=/c /W2 /DOS232 /D__VISAGECPP__ /DOS2_32 /Q /N100
|
OS2FLAGS=/c /W2 /DOS232 /D__VISAGECPP__ /D__VISAGECPP30__ /DOS2_32 /Tdc /Q /N100
|
||||||
OS2LINKFLAGS=/BASE:0x00010000 /PMTYPE:PM /NOE /NOD /ALIGN:16
|
OS2LINKFLAGS=/BASE:0x00010000 /PMTYPE:PM /NOE /NOD /ALIGN:16
|
||||||
OS2LIBFLAGS=/NOL /NOE
|
OS2LIBFLAGS=/NOL /NOE
|
||||||
OS2LIBS=CPPOM30.lib CPPOOC3.LIB OS2386.LIB
|
OS2LIBS=CPPOM30.lib CPPOOC3.LIB OS2386.LIB
|
||||||
@@ -89,6 +89,7 @@ OBJECTS = \
|
|||||||
..\tiff\$D\tif_lzw.obj \
|
..\tiff\$D\tif_lzw.obj \
|
||||||
..\tiff\$D\tif_next.obj \
|
..\tiff\$D\tif_next.obj \
|
||||||
..\tiff\$D\tif_open.obj \
|
..\tiff\$D\tif_open.obj \
|
||||||
|
..\tiff\$D\tif_os2.obj \
|
||||||
..\tiff\$D\tif_packbits.obj \
|
..\tiff\$D\tif_packbits.obj \
|
||||||
..\tiff\$D\tif_pixarlog.obj \
|
..\tiff\$D\tif_pixarlog.obj \
|
||||||
..\tiff\$D\tif_predict.obj \
|
..\tiff\$D\tif_predict.obj \
|
||||||
@@ -100,7 +101,6 @@ OBJECTS = \
|
|||||||
..\tiff\$D\tif_tile.obj \
|
..\tiff\$D\tif_tile.obj \
|
||||||
..\tiff\$D\tif_version.obj \
|
..\tiff\$D\tif_version.obj \
|
||||||
..\tiff\$D\tif_warning.obj \
|
..\tiff\$D\tif_warning.obj \
|
||||||
..\tiff\$D\tif_win32.obj \
|
|
||||||
..\tiff\$D\tif_write.obj \
|
..\tiff\$D\tif_write.obj \
|
||||||
..\tiff\$D\tif_zip.obj
|
..\tiff\$D\tif_zip.obj
|
||||||
|
|
||||||
@@ -124,6 +124,7 @@ LIBOBJECTS = \
|
|||||||
tif_lzw.obj \
|
tif_lzw.obj \
|
||||||
tif_next.obj \
|
tif_next.obj \
|
||||||
tif_open.obj \
|
tif_open.obj \
|
||||||
|
tif_os2.obj \
|
||||||
tif_packbits.obj \
|
tif_packbits.obj \
|
||||||
tif_pixarlog.obj \
|
tif_pixarlog.obj \
|
||||||
tif_predict.obj \
|
tif_predict.obj \
|
||||||
@@ -135,7 +136,6 @@ LIBOBJECTS = \
|
|||||||
tif_tile.obj \
|
tif_tile.obj \
|
||||||
tif_version.obj \
|
tif_version.obj \
|
||||||
tif_warning.obj \
|
tif_warning.obj \
|
||||||
tif_win32.obj \
|
|
||||||
tif_write.obj \
|
tif_write.obj \
|
||||||
tif_zip.obj
|
tif_zip.obj
|
||||||
|
|
||||||
@@ -157,37 +157,37 @@ clean:
|
|||||||
cleanall: clean
|
cleanall: clean
|
||||||
|
|
||||||
$(LIBOBJECTS):
|
$(LIBOBJECTS):
|
||||||
copy ..\tiff\$D\tif_aux.obj \
|
copy ..\tiff\$D\tif_aux.obj
|
||||||
copy ..\tiff\$D\tif_close.obj \
|
copy ..\tiff\$D\tif_close.obj
|
||||||
copy ..\tiff\$D\tif_codec.obj \
|
copy ..\tiff\$D\tif_codec.obj
|
||||||
copy ..\tiff\$D\tif_compress.obj \
|
copy ..\tiff\$D\tif_compress.obj
|
||||||
copy ..\tiff\$D\tif_dir.obj \
|
copy ..\tiff\$D\tif_dir.obj
|
||||||
copy ..\tiff\$D\tif_dirinfo.obj \
|
copy ..\tiff\$D\tif_dirinfo.obj
|
||||||
copy ..\tiff\$D\tif_dirread.obj \
|
copy ..\tiff\$D\tif_dirread.obj
|
||||||
copy ..\tiff\$D\tif_dirwrite.obj \
|
copy ..\tiff\$D\tif_dirwrite.obj
|
||||||
copy ..\tiff\$D\tif_dumpmode.obj \
|
copy ..\tiff\$D\tif_dumpmode.obj
|
||||||
copy ..\tiff\$D\tif_error.obj \
|
copy ..\tiff\$D\tif_error.obj
|
||||||
copy ..\tiff\$D\tif_fax3.obj \
|
copy ..\tiff\$D\tif_fax3.obj
|
||||||
copy ..\tiff\$D\tif_fax3sm.obj \
|
copy ..\tiff\$D\tif_fax3sm.obj
|
||||||
copy ..\tiff\$D\tif_flush.obj \
|
copy ..\tiff\$D\tif_flush.obj
|
||||||
copy ..\tiff\$D\tif_getimage.obj \
|
copy ..\tiff\$D\tif_getimage.obj
|
||||||
copy ..\tiff\$D\tif_jpeg.obj \
|
copy ..\tiff\$D\tif_jpeg.obj
|
||||||
copy ..\tiff\$D\tif_luv.obj \
|
copy ..\tiff\$D\tif_luv.obj
|
||||||
copy ..\tiff\$D\tif_lzw.obj \
|
copy ..\tiff\$D\tif_lzw.obj
|
||||||
copy ..\tiff\$D\tif_next.obj \
|
copy ..\tiff\$D\tif_next.obj
|
||||||
copy ..\tiff\$D\tif_open.obj \
|
copy ..\tiff\$D\tif_open.obj
|
||||||
copy ..\tiff\$D\tif_packbits.obj \
|
copy ..\tiff\$D\tif_os2.obj
|
||||||
copy ..\tiff\$D\tif_pixarlog.obj \
|
copy ..\tiff\$D\tif_packbits.obj
|
||||||
copy ..\tiff\$D\tif_predict.obj \
|
copy ..\tiff\$D\tif_pixarlog.obj
|
||||||
copy ..\tiff\$D\tif_print.obj \
|
copy ..\tiff\$D\tif_predict.obj
|
||||||
copy ..\tiff\$D\tif_read.obj \
|
copy ..\tiff\$D\tif_print.obj
|
||||||
copy ..\tiff\$D\tif_strip.obj \
|
copy ..\tiff\$D\tif_read.obj
|
||||||
copy ..\tiff\$D\tif_swab.obj \
|
copy ..\tiff\$D\tif_strip.obj
|
||||||
copy ..\tiff\$D\tif_thunder.obj \
|
copy ..\tiff\$D\tif_swab.obj
|
||||||
copy ..\tiff\$D\tif_tile.obj \
|
copy ..\tiff\$D\tif_thunder.obj
|
||||||
copy ..\tiff\$D\tif_version.obj \
|
copy ..\tiff\$D\tif_tile.obj
|
||||||
copy ..\tiff\$D\tif_warning.obj \
|
copy ..\tiff\$D\tif_version.obj
|
||||||
copy ..\tiff\$D\tif_win32.obj \
|
copy ..\tiff\$D\tif_warning.obj
|
||||||
copy ..\tiff\$D\tif_write.obj \
|
copy ..\tiff\$D\tif_write.obj
|
||||||
copy ..\tiff\$D\tif_zip.obj
|
copy ..\tiff\$D\tif_zip.obj
|
||||||
|
|
||||||
|
@@ -85,13 +85,13 @@ typedef struct {
|
|||||||
#define DecoderState(tif) ((Fax3DecodeState*) Fax3State(tif))
|
#define DecoderState(tif) ((Fax3DecodeState*) Fax3State(tif))
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Fax3BaseState b;
|
Fax3BaseState b;
|
||||||
int data; /* current i/o byte */
|
int data; /* current i/o byte */
|
||||||
int bit; /* current i/o bit in byte */
|
int bit; /* current i/o bit in byte */
|
||||||
enum { G3_1D, G3_2D } tag; /* encoding state */
|
enum { G3_1D, G3_2D } tag; /* encoding state */
|
||||||
u_char* refline; /* reference line for 2d decoding */
|
u_char* refline; /* reference line for 2d decoding */
|
||||||
int k; /* #rows left that can be 2d encoded */
|
int k; /* #rows left that can be 2d encoded */
|
||||||
int maxk; /* max #rows that can be 2d encoded */
|
int maxk; /* max #rows that can be 2d encoded */
|
||||||
} Fax3EncodeState;
|
} Fax3EncodeState;
|
||||||
#define EncoderState(tif) ((Fax3EncodeState*) Fax3State(tif))
|
#define EncoderState(tif) ((Fax3EncodeState*) Fax3State(tif))
|
||||||
|
|
||||||
@@ -678,7 +678,12 @@ Fax3PutEOL(TIFF* tif)
|
|||||||
}
|
}
|
||||||
code = EOL, length = 12;
|
code = EOL, length = 12;
|
||||||
if (is2DEncoding(sp))
|
if (is2DEncoding(sp))
|
||||||
|
#if defined(__VISAGECPP30__)
|
||||||
|
/* VA 3.0 is just plain wierd. */
|
||||||
|
code = (code<<1) | (sp->tag == Fax3EncodeState::G3_1D), length++;
|
||||||
|
#else
|
||||||
code = (code<<1) | (sp->tag == G3_1D), length++;
|
code = (code<<1) | (sp->tag == G3_1D), length++;
|
||||||
|
#endif
|
||||||
_PutBits(tif, code, length);
|
_PutBits(tif, code, length);
|
||||||
|
|
||||||
sp->data = data;
|
sp->data = data;
|
||||||
@@ -697,7 +702,12 @@ Fax3PreEncode(TIFF* tif, tsample_t s)
|
|||||||
assert(sp != NULL);
|
assert(sp != NULL);
|
||||||
sp->bit = 8;
|
sp->bit = 8;
|
||||||
sp->data = 0;
|
sp->data = 0;
|
||||||
|
#if defined(__VISAGECPP30__)
|
||||||
|
/* VA 3.0 is just plain wierd. */
|
||||||
|
sp->tag = Fax3EncodeState::G3_1D;
|
||||||
|
#else
|
||||||
sp->tag = G3_1D;
|
sp->tag = G3_1D;
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* This is necessary for Group 4; otherwise it isn't
|
* This is necessary for Group 4; otherwise it isn't
|
||||||
* needed because the first scanline of each strip ends
|
* needed because the first scanline of each strip ends
|
||||||
@@ -1017,17 +1027,32 @@ Fax3Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
if ((sp->b.mode & FAXMODE_NOEOL) == 0)
|
if ((sp->b.mode & FAXMODE_NOEOL) == 0)
|
||||||
Fax3PutEOL(tif);
|
Fax3PutEOL(tif);
|
||||||
if (is2DEncoding(sp)) {
|
if (is2DEncoding(sp)) {
|
||||||
|
#if defined(__VISAGECPP30__)
|
||||||
|
/* VA 3.0 is just plain wierd. */
|
||||||
|
if (sp->tag == Fax3EncodeState::G3_1D) {
|
||||||
|
#else
|
||||||
if (sp->tag == G3_1D) {
|
if (sp->tag == G3_1D) {
|
||||||
|
#endif
|
||||||
if (!Fax3Encode1DRow(tif, bp, sp->b.rowpixels))
|
if (!Fax3Encode1DRow(tif, bp, sp->b.rowpixels))
|
||||||
return (0);
|
return (0);
|
||||||
|
#if defined(__VISAGECPP30__)
|
||||||
|
/* VA 3.0 is just plain wierd. */
|
||||||
|
sp->tag = Fax3EncodeState::G3_2D;
|
||||||
|
#else
|
||||||
sp->tag = G3_2D;
|
sp->tag = G3_2D;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if (!Fax3Encode2DRow(tif, bp, sp->refline, sp->b.rowpixels))
|
if (!Fax3Encode2DRow(tif, bp, sp->refline, sp->b.rowpixels))
|
||||||
return (0);
|
return (0);
|
||||||
sp->k--;
|
sp->k--;
|
||||||
}
|
}
|
||||||
if (sp->k == 0) {
|
if (sp->k == 0) {
|
||||||
|
#if defined(__VISAGECPP30__)
|
||||||
|
/* VA 3.0 is just plain wierd. */
|
||||||
|
sp->tag = Fax3EncodeState::G3_1D;
|
||||||
|
#else
|
||||||
sp->tag = G3_1D;
|
sp->tag = G3_1D;
|
||||||
|
#endif
|
||||||
sp->k = sp->maxk-1;
|
sp->k = sp->maxk-1;
|
||||||
} else
|
} else
|
||||||
_TIFFmemcpy(sp->refline, bp, sp->b.rowbytes);
|
_TIFFmemcpy(sp->refline, bp, sp->b.rowbytes);
|
||||||
@@ -1063,7 +1088,12 @@ Fax3Close(TIFF* tif)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (is2DEncoding(sp))
|
if (is2DEncoding(sp))
|
||||||
|
#if defined(__VISAGECPP30__)
|
||||||
|
/* VA 3.0 is just plain wierd. */
|
||||||
|
code = (code<<1) | (sp->tag == Fax3EncodeState::G3_1D), length++;
|
||||||
|
#else
|
||||||
code = (code<<1) | (sp->tag == G3_1D), length++;
|
code = (code<<1) | (sp->tag == G3_1D), length++;
|
||||||
|
#endif
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++)
|
||||||
Fax3PutBits(tif, code, length);
|
Fax3PutBits(tif, code, length);
|
||||||
Fax3FlushBits(tif, sp);
|
Fax3FlushBits(tif, sp);
|
||||||
@@ -1280,9 +1310,15 @@ InitCCITTFax3(TIFF* tif)
|
|||||||
* Allocate state block so tag methods have storage to record values.
|
* Allocate state block so tag methods have storage to record values.
|
||||||
*/
|
*/
|
||||||
if (tif->tif_mode == O_RDONLY)
|
if (tif->tif_mode == O_RDONLY)
|
||||||
|
#if defined(__VISAGECPP__)
|
||||||
|
tif->tif_data = (tidata_t)_TIFFmalloc(sizeof (Fax3DecodeState));
|
||||||
|
else
|
||||||
|
tif->tif_data = (tidata_t)_TIFFmalloc(sizeof (Fax3EncodeState));
|
||||||
|
#else
|
||||||
tif->tif_data = _TIFFmalloc(sizeof (Fax3DecodeState));
|
tif->tif_data = _TIFFmalloc(sizeof (Fax3DecodeState));
|
||||||
else
|
else
|
||||||
tif->tif_data = _TIFFmalloc(sizeof (Fax3EncodeState));
|
tif->tif_data = _TIFFmalloc(sizeof (Fax3EncodeState));
|
||||||
|
#endif
|
||||||
if (tif->tif_data == NULL) {
|
if (tif->tif_data == NULL) {
|
||||||
TIFFError("TIFFInitCCITTFax3",
|
TIFFError("TIFFInitCCITTFax3",
|
||||||
"%s: No space for state block", tif->tif_name);
|
"%s: No space for state block", tif->tif_name);
|
||||||
|
@@ -4,23 +4,23 @@
|
|||||||
* Copyright (c) 1991-1997 Sam Leffler
|
* Copyright (c) 1991-1997 Sam Leffler
|
||||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and
|
* Permission to use, copy, modify, distribute, and sell this software and
|
||||||
* its documentation for any purpose is hereby granted without fee, provided
|
* its documentation for any purpose is hereby granted without fee, provided
|
||||||
* that (i) the above copyright notices and this permission notice appear in
|
* that (i) the above copyright notices and this permission notice appear in
|
||||||
* all copies of the software and related documentation, and (ii) the names of
|
* all copies of the software and related documentation, and (ii) the names of
|
||||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||||
* publicity relating to the software without the specific, prior written
|
* publicity relating to the software without the specific, prior written
|
||||||
* permission of Sam Leffler and Silicon Graphics.
|
* permission of Sam Leffler and Silicon Graphics.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
* OF THIS SOFTWARE.
|
* OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -33,12 +33,12 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static int gtTileContig(TIFFRGBAImage*, uint32*, uint32, uint32);
|
static int LINKAGEMODE gtTileContig(TIFFRGBAImage*, uint32*, uint32, uint32);
|
||||||
static int gtTileSeparate(TIFFRGBAImage*, uint32*, uint32, uint32);
|
static int LINKAGEMODE gtTileSeparate(TIFFRGBAImage*, uint32*, uint32, uint32);
|
||||||
static int gtStripContig(TIFFRGBAImage*, uint32*, uint32, uint32);
|
static int LINKAGEMODE gtStripContig(TIFFRGBAImage*, uint32*, uint32, uint32);
|
||||||
static int gtStripSeparate(TIFFRGBAImage*, uint32*, uint32, uint32);
|
static int LINKAGEMODE gtStripSeparate(TIFFRGBAImage*, uint32*, uint32, uint32);
|
||||||
static int pickTileContigCase(TIFFRGBAImage*);
|
static int LINKAGEMODE pickTileContigCase(TIFFRGBAImage*);
|
||||||
static int pickTileSeparateCase(TIFFRGBAImage*);
|
static int LINKAGEMODE pickTileSeparateCase(TIFFRGBAImage*);
|
||||||
|
|
||||||
static const char photoTag[] = "PhotometricInterpretation";
|
static const char photoTag[] = "PhotometricInterpretation";
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PHOTOMETRIC_RGB:
|
case PHOTOMETRIC_RGB:
|
||||||
if (colorchannels < 3) {
|
if (colorchannels < 3) {
|
||||||
sprintf(emsg, "Sorry, can not handle RGB image with %s=%d",
|
sprintf(emsg, "Sorry, can not handle RGB image with %s=%d",
|
||||||
"Color channels", colorchannels);
|
"Color channels", colorchannels);
|
||||||
@@ -193,7 +193,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
|
|||||||
img->redcmap = NULL;
|
img->redcmap = NULL;
|
||||||
img->greencmap = NULL;
|
img->greencmap = NULL;
|
||||||
img->bluecmap = NULL;
|
img->bluecmap = NULL;
|
||||||
|
|
||||||
img->tif = tif;
|
img->tif = tif;
|
||||||
img->stoponerr = stop;
|
img->stoponerr = stop;
|
||||||
TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &img->bitspersample);
|
TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &img->bitspersample);
|
||||||
@@ -257,7 +257,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
|
|||||||
memcpy( img->redcmap, red_orig, n_color * 2 );
|
memcpy( img->redcmap, red_orig, n_color * 2 );
|
||||||
memcpy( img->greencmap, green_orig, n_color * 2 );
|
memcpy( img->greencmap, green_orig, n_color * 2 );
|
||||||
memcpy( img->bluecmap, blue_orig, n_color * 2 );
|
memcpy( img->bluecmap, blue_orig, n_color * 2 );
|
||||||
|
|
||||||
/* fall thru... */
|
/* fall thru... */
|
||||||
case PHOTOMETRIC_MINISWHITE:
|
case PHOTOMETRIC_MINISWHITE:
|
||||||
case PHOTOMETRIC_MINISBLACK:
|
case PHOTOMETRIC_MINISBLACK:
|
||||||
@@ -283,7 +283,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
|
|||||||
img->photometric = PHOTOMETRIC_RGB;
|
img->photometric = PHOTOMETRIC_RGB;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PHOTOMETRIC_RGB:
|
case PHOTOMETRIC_RGB:
|
||||||
if (colorchannels < 3) {
|
if (colorchannels < 3) {
|
||||||
sprintf(emsg, "Sorry, can not handle RGB image with %s=%d",
|
sprintf(emsg, "Sorry, can not handle RGB image with %s=%d",
|
||||||
"Color channels", colorchannels);
|
"Color channels", colorchannels);
|
||||||
@@ -716,7 +716,7 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
op2; \
|
op2; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SKEW(r,g,b,skew) { r += skew; g += skew; b += skew; }
|
#define SKEW(r,g,b,skew) { r += skew; g += skew; b += skew; }
|
||||||
#define SKEW4(r,g,b,a,skew) { r += skew; g += skew; b += skew; a+= skew; }
|
#define SKEW4(r,g,b,a,skew) { r += skew; g += skew; b += skew; a+= skew; }
|
||||||
|
|
||||||
@@ -732,7 +732,7 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
|||||||
((uint32)W2B(r)|((uint32)W2B(g)<<8)|((uint32)W2B(b)<<16)|((uint32)W2B(a)<<24))
|
((uint32)W2B(r)|((uint32)W2B(g)<<8)|((uint32)W2B(b)<<16)|((uint32)W2B(a)<<24))
|
||||||
|
|
||||||
#define DECLAREContigPutFunc(name) \
|
#define DECLAREContigPutFunc(name) \
|
||||||
static void name(\
|
static void LINKAGEMODE name(\
|
||||||
TIFFRGBAImage* img, \
|
TIFFRGBAImage* img, \
|
||||||
uint32* cp, \
|
uint32* cp, \
|
||||||
uint32 x, uint32 y, \
|
uint32 x, uint32 y, \
|
||||||
@@ -1019,7 +1019,7 @@ DECLAREContigPutFunc(putRGBUAcontig16bittile)
|
|||||||
* we divide by (0xffff * 0xfff) / 0xff == 0x10eff.
|
* we divide by (0xffff * 0xfff) / 0xff == 0x10eff.
|
||||||
*/
|
*/
|
||||||
for (x = w; x-- > 0;) {
|
for (x = w; x-- > 0;) {
|
||||||
a = wp[3] >> 4;
|
a = wp[3] >> 4;
|
||||||
r = (wp[0] * a) / 0x10eff;
|
r = (wp[0] * a) / 0x10eff;
|
||||||
g = (wp[1] * a) / 0x10eff;
|
g = (wp[1] * a) / 0x10eff;
|
||||||
b = (wp[2] * a) / 0x10eff;
|
b = (wp[2] * a) / 0x10eff;
|
||||||
@@ -1084,7 +1084,7 @@ DECLAREContigPutFunc(putRGBcontig8bitCMYKMaptile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define DECLARESepPutFunc(name) \
|
#define DECLARESepPutFunc(name) \
|
||||||
static void name(\
|
static void LINKAGEMODE name(\
|
||||||
TIFFRGBAImage* img,\
|
TIFFRGBAImage* img,\
|
||||||
uint32* cp,\
|
uint32* cp,\
|
||||||
uint32 x, uint32 y, \
|
uint32 x, uint32 y, \
|
||||||
@@ -1214,7 +1214,7 @@ DECLARESepPutFunc(putRGBUAseparate16bittile)
|
|||||||
* we divide by (0xffff * 0xfff) / 0xff == 0x10eff.
|
* we divide by (0xffff * 0xfff) / 0xff == 0x10eff.
|
||||||
*/
|
*/
|
||||||
for (x = w; x-- > 0;) {
|
for (x = w; x-- > 0;) {
|
||||||
a = *wa++ >> 4;
|
a = *wa++ >> 4;
|
||||||
r = (*wr++ * a) / 0x10eff;
|
r = (*wr++ * a) / 0x10eff;
|
||||||
g = (*wg++ * a) / 0x10eff;
|
g = (*wg++ * a) / 0x10eff;
|
||||||
b = (*wb++ * a) / 0x10eff;
|
b = (*wb++ * a) / 0x10eff;
|
||||||
@@ -1613,7 +1613,7 @@ makebwmap(TIFFRGBAImage* img)
|
|||||||
* Construct a mapping table to convert from the range
|
* Construct a mapping table to convert from the range
|
||||||
* of the data samples to [0,255] --for display. This
|
* of the data samples to [0,255] --for display. This
|
||||||
* process also handles inverting B&W images when needed.
|
* process also handles inverting B&W images when needed.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
setupMap(TIFFRGBAImage* img)
|
setupMap(TIFFRGBAImage* img)
|
||||||
{
|
{
|
||||||
@@ -1738,7 +1738,7 @@ makecmap(TIFFRGBAImage* img)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Construct any mapping table used
|
* Construct any mapping table used
|
||||||
* by the associated put routine.
|
* by the associated put routine.
|
||||||
*/
|
*/
|
||||||
@@ -1910,7 +1910,7 @@ TIFFReadRGBAStrip(TIFF* tif, uint32 row, uint32 * raster )
|
|||||||
"Can't use TIFFReadRGBAStrip() with tiled file.");
|
"Can't use TIFFReadRGBAStrip() with tiled file.");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
|
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
|
||||||
if( (row % rowsperstrip) != 0 )
|
if( (row % rowsperstrip) != 0 )
|
||||||
{
|
{
|
||||||
@@ -1928,15 +1928,15 @@ TIFFReadRGBAStrip(TIFF* tif, uint32 row, uint32 * raster )
|
|||||||
rows_to_read = img.height - row;
|
rows_to_read = img.height - row;
|
||||||
else
|
else
|
||||||
rows_to_read = rowsperstrip;
|
rows_to_read = rowsperstrip;
|
||||||
|
|
||||||
ok = TIFFRGBAImageGet(&img, raster, img.width, rows_to_read );
|
ok = TIFFRGBAImageGet(&img, raster, img.width, rows_to_read );
|
||||||
|
|
||||||
TIFFRGBAImageEnd(&img);
|
TIFFRGBAImageEnd(&img);
|
||||||
} else {
|
} else {
|
||||||
TIFFError(TIFFFileName(tif), emsg);
|
TIFFError(TIFFFileName(tif), emsg);
|
||||||
ok = 0;
|
ok = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ok);
|
return (ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1961,14 +1961,14 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster)
|
|||||||
* Verify that our request is legal - on a tile file, and on a
|
* Verify that our request is legal - on a tile file, and on a
|
||||||
* tile boundary.
|
* tile boundary.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if( !TIFFIsTiled( tif ) )
|
if( !TIFFIsTiled( tif ) )
|
||||||
{
|
{
|
||||||
TIFFError(TIFFFileName(tif),
|
TIFFError(TIFFFileName(tif),
|
||||||
"Can't use TIFFReadRGBATile() with stripped file.");
|
"Can't use TIFFReadRGBATile() with stripped file.");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TIFFGetFieldDefaulted(tif, TIFFTAG_TILEWIDTH, &tile_xsize);
|
TIFFGetFieldDefaulted(tif, TIFFTAG_TILEWIDTH, &tile_xsize);
|
||||||
TIFFGetFieldDefaulted(tif, TIFFTAG_TILELENGTH, &tile_ysize);
|
TIFFGetFieldDefaulted(tif, TIFFTAG_TILELENGTH, &tile_ysize);
|
||||||
if( (col % tile_xsize) != 0 || (row % tile_ysize) != 0 )
|
if( (col % tile_xsize) != 0 || (row % tile_ysize) != 0 )
|
||||||
@@ -1982,7 +1982,7 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster)
|
|||||||
/*
|
/*
|
||||||
* Setup the RGBA reader.
|
* Setup the RGBA reader.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !TIFFRGBAImageBegin(&img, tif, 0, emsg)) {
|
if ( !TIFFRGBAImageBegin(&img, tif, 0, emsg)) {
|
||||||
TIFFError(TIFFFileName(tif), emsg);
|
TIFFError(TIFFFileName(tif), emsg);
|
||||||
return( 0 );
|
return( 0 );
|
||||||
@@ -1999,7 +1999,7 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster)
|
|||||||
read_ysize = img.height - row;
|
read_ysize = img.height - row;
|
||||||
else
|
else
|
||||||
read_ysize = tile_ysize;
|
read_ysize = tile_ysize;
|
||||||
|
|
||||||
if( col + tile_xsize > img.width )
|
if( col + tile_xsize > img.width )
|
||||||
read_xsize = img.width - col;
|
read_xsize = img.width - col;
|
||||||
else
|
else
|
||||||
@@ -2008,12 +2008,12 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster)
|
|||||||
/*
|
/*
|
||||||
* Read the chunk of imagery.
|
* Read the chunk of imagery.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
img.row_offset = row;
|
img.row_offset = row;
|
||||||
img.col_offset = col;
|
img.col_offset = col;
|
||||||
|
|
||||||
ok = TIFFRGBAImageGet(&img, raster, read_xsize, read_ysize );
|
ok = TIFFRGBAImageGet(&img, raster, read_xsize, read_ysize );
|
||||||
|
|
||||||
TIFFRGBAImageEnd(&img);
|
TIFFRGBAImageEnd(&img);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2021,7 +2021,7 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster)
|
|||||||
* shifting the data around as if a full tile of data is being returned.
|
* shifting the data around as if a full tile of data is being returned.
|
||||||
*
|
*
|
||||||
* This is all the more complicated because the image is organized in
|
* This is all the more complicated because the image is organized in
|
||||||
* bottom to top format.
|
* bottom to top format.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if( read_xsize == tile_xsize && read_ysize == tile_ysize )
|
if( read_xsize == tile_xsize && read_ysize == tile_ysize )
|
||||||
@@ -2041,6 +2041,6 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster)
|
|||||||
_TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize,
|
_TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize,
|
||||||
0, sizeof(uint32) * tile_xsize );
|
0, sizeof(uint32) * tile_xsize );
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ok);
|
return (ok);
|
||||||
}
|
}
|
||||||
|
@@ -2,23 +2,23 @@
|
|||||||
* Copyright (c) 1997 Greg Ward Larson
|
* Copyright (c) 1997 Greg Ward Larson
|
||||||
* Copyright (c) 1997 Silicon Graphics, Inc.
|
* Copyright (c) 1997 Silicon Graphics, Inc.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and
|
* Permission to use, copy, modify, distribute, and sell this software and
|
||||||
* its documentation for any purpose is hereby granted without fee, provided
|
* its documentation for any purpose is hereby granted without fee, provided
|
||||||
* that (i) the above copyright notices and this permission notice appear in
|
* that (i) the above copyright notices and this permission notice appear in
|
||||||
* all copies of the software and related documentation, and (ii) the names of
|
* all copies of the software and related documentation, and (ii) the names of
|
||||||
* Sam Leffler, Greg Larson and Silicon Graphics may not be used in any
|
* Sam Leffler, Greg Larson and Silicon Graphics may not be used in any
|
||||||
* advertising or publicity relating to the software without the specific,
|
* advertising or publicity relating to the software without the specific,
|
||||||
* prior written permission of Sam Leffler, Greg Larson and Silicon Graphics.
|
* prior written permission of Sam Leffler, Greg Larson and Silicon Graphics.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* IN NO EVENT SHALL SAM LEFFLER, GREG LARSON OR SILICON GRAPHICS BE LIABLE
|
* IN NO EVENT SHALL SAM LEFFLER, GREG LARSON OR SILICON GRAPHICS BE LIABLE
|
||||||
* FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
* FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
* OF THIS SOFTWARE.
|
* OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
* LogLuv image support uses the TIFF library to store 16 or 10-bit
|
* LogLuv image support uses the TIFF library to store 16 or 10-bit
|
||||||
* log luminance values with 8 bits each of u and v or a 14-bit index.
|
* log luminance values with 8 bits each of u and v or a 14-bit index.
|
||||||
*
|
*
|
||||||
* The codec can take as input and produce as output 32-bit IEEE float values
|
* The codec can take as input and produce as output 32-bit IEEE float values
|
||||||
* as well as 16-bit integer values. A 16-bit luminance is interpreted
|
* as well as 16-bit integer values. A 16-bit luminance is interpreted
|
||||||
* as a sign bit followed by a 15-bit integer that is converted
|
* as a sign bit followed by a 15-bit integer that is converted
|
||||||
* to and from a linear magnitude using the transformation:
|
* to and from a linear magnitude using the transformation:
|
||||||
@@ -156,7 +156,7 @@ struct logLuvState {
|
|||||||
/*
|
/*
|
||||||
* Decode a string of 16-bit gray pixels.
|
* Decode a string of 16-bit gray pixels.
|
||||||
*/
|
*/
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
LogL16Decode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
|
LogL16Decode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
|
||||||
{
|
{
|
||||||
LogLuvState* sp = DecoderState(tif);
|
LogLuvState* sp = DecoderState(tif);
|
||||||
@@ -213,7 +213,7 @@ LogL16Decode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
|
|||||||
/*
|
/*
|
||||||
* Decode a string of 24-bit pixels.
|
* Decode a string of 24-bit pixels.
|
||||||
*/
|
*/
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
LogLuvDecode24(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
|
LogLuvDecode24(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
|
||||||
{
|
{
|
||||||
LogLuvState* sp = DecoderState(tif);
|
LogLuvState* sp = DecoderState(tif);
|
||||||
@@ -256,7 +256,7 @@ LogLuvDecode24(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
|
|||||||
/*
|
/*
|
||||||
* Decode a string of 32-bit pixels.
|
* Decode a string of 32-bit pixels.
|
||||||
*/
|
*/
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
LogLuvDecode32(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
|
LogLuvDecode32(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
|
||||||
{
|
{
|
||||||
LogLuvState* sp;
|
LogLuvState* sp;
|
||||||
@@ -316,7 +316,7 @@ LogLuvDecode32(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
|
|||||||
* maintain synchrony with the encode algorithm, which
|
* maintain synchrony with the encode algorithm, which
|
||||||
* is row by row.
|
* is row by row.
|
||||||
*/
|
*/
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
LogLuvDecodeStrip(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
LogLuvDecodeStrip(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
||||||
{
|
{
|
||||||
tsize_t rowlen = TIFFScanlineSize(tif);
|
tsize_t rowlen = TIFFScanlineSize(tif);
|
||||||
@@ -332,7 +332,7 @@ LogLuvDecodeStrip(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
* maintain synchrony with the encode algorithm, which
|
* maintain synchrony with the encode algorithm, which
|
||||||
* is row by row.
|
* is row by row.
|
||||||
*/
|
*/
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
LogLuvDecodeTile(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
LogLuvDecodeTile(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
||||||
{
|
{
|
||||||
tsize_t rowlen = TIFFTileRowSize(tif);
|
tsize_t rowlen = TIFFTileRowSize(tif);
|
||||||
@@ -346,7 +346,7 @@ LogLuvDecodeTile(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
/*
|
/*
|
||||||
* Encode a row of 16-bit pixels.
|
* Encode a row of 16-bit pixels.
|
||||||
*/
|
*/
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
LogL16Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
LogL16Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
||||||
{
|
{
|
||||||
LogLuvState* sp = EncoderState(tif);
|
LogLuvState* sp = EncoderState(tif);
|
||||||
@@ -434,7 +434,7 @@ LogL16Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
/*
|
/*
|
||||||
* Encode a row of 24-bit pixels.
|
* Encode a row of 24-bit pixels.
|
||||||
*/
|
*/
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
LogLuvEncode24(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
LogLuvEncode24(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
||||||
{
|
{
|
||||||
LogLuvState* sp = EncoderState(tif);
|
LogLuvState* sp = EncoderState(tif);
|
||||||
@@ -479,7 +479,7 @@ LogLuvEncode24(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
/*
|
/*
|
||||||
* Encode a row of 32-bit pixels.
|
* Encode a row of 32-bit pixels.
|
||||||
*/
|
*/
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
LogLuvEncode32(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
LogLuvEncode32(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
||||||
{
|
{
|
||||||
LogLuvState* sp = EncoderState(tif);
|
LogLuvState* sp = EncoderState(tif);
|
||||||
@@ -569,7 +569,7 @@ LogLuvEncode32(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
* Encode a strip of pixels. We break it into rows to
|
* Encode a strip of pixels. We break it into rows to
|
||||||
* avoid encoding runs across row boundaries.
|
* avoid encoding runs across row boundaries.
|
||||||
*/
|
*/
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
LogLuvEncodeStrip(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
LogLuvEncodeStrip(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
||||||
{
|
{
|
||||||
tsize_t rowlen = TIFFScanlineSize(tif);
|
tsize_t rowlen = TIFFScanlineSize(tif);
|
||||||
@@ -584,7 +584,7 @@ LogLuvEncodeStrip(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
* Encode a tile of pixels. We break it into rows to
|
* Encode a tile of pixels. We break it into rows to
|
||||||
* avoid encoding runs across row boundaries.
|
* avoid encoding runs across row boundaries.
|
||||||
*/
|
*/
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
LogLuvEncodeTile(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
LogLuvEncodeTile(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
||||||
{
|
{
|
||||||
tsize_t rowlen = TIFFTileRowSize(tif);
|
tsize_t rowlen = TIFFTileRowSize(tif);
|
||||||
|
@@ -4,23 +4,23 @@
|
|||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and
|
* Permission to use, copy, modify, distribute, and sell this software and
|
||||||
* its documentation for any purpose is hereby granted without fee, provided
|
* its documentation for any purpose is hereby granted without fee, provided
|
||||||
* that (i) the above copyright notices and this permission notice appear in
|
* that (i) the above copyright notices and this permission notice appear in
|
||||||
* all copies of the software and related documentation, and (ii) the names of
|
* all copies of the software and related documentation, and (ii) the names of
|
||||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||||
* publicity relating to the software without the specific, prior written
|
* publicity relating to the software without the specific, prior written
|
||||||
* permission of Sam Leffler and Silicon Graphics.
|
* permission of Sam Leffler and Silicon Graphics.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
* OF THIS SOFTWARE.
|
* OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ typedef struct code_ent {
|
|||||||
u_char firstchar; /* first token of string */
|
u_char firstchar; /* first token of string */
|
||||||
} code_t;
|
} code_t;
|
||||||
|
|
||||||
typedef int (*decodeFunc)(TIFF*, tidata_t, tsize_t, tsample_t);
|
typedef int (LINKAGEMODE *decodeFunc)(TIFF*, tidata_t, tsize_t, tsample_t);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
LZWBaseState base;
|
LZWBaseState base;
|
||||||
@@ -157,9 +157,9 @@ typedef struct {
|
|||||||
#define DecoderState(tif) ((LZWDecodeState*) LZWState(tif))
|
#define DecoderState(tif) ((LZWDecodeState*) LZWState(tif))
|
||||||
#define EncoderState(tif) ((LZWEncodeState*) LZWState(tif))
|
#define EncoderState(tif) ((LZWEncodeState*) LZWState(tif))
|
||||||
|
|
||||||
static int LZWDecode(TIFF*, tidata_t, tsize_t, tsample_t);
|
static int LINKAGEMODE LZWDecode(TIFF*, tidata_t, tsize_t, tsample_t);
|
||||||
#ifdef LZW_COMPAT
|
#ifdef LZW_COMPAT
|
||||||
static int LZWDecodeCompat(TIFF*, tidata_t, tsize_t, tsample_t);
|
static int LINKAGEMODE LZWDecodeCompat(TIFF*, tidata_t, tsize_t, tsample_t);
|
||||||
#endif
|
#endif
|
||||||
static void cl_hash(LZWEncodeState*);
|
static void cl_hash(LZWEncodeState*);
|
||||||
|
|
||||||
@@ -489,7 +489,7 @@ LZWDecode(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
|
|||||||
nextbits -= nbits; \
|
nextbits -= nbits; \
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
LZWDecodeCompat(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
|
LZWDecodeCompat(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
|
||||||
{
|
{
|
||||||
LZWDecodeState *sp = DecoderState(tif);
|
LZWDecodeState *sp = DecoderState(tif);
|
||||||
@@ -706,18 +706,18 @@ LZWPreEncode(TIFF* tif, tsample_t s)
|
|||||||
/*
|
/*
|
||||||
* Encode a chunk of pixels.
|
* Encode a chunk of pixels.
|
||||||
*
|
*
|
||||||
* Uses an open addressing double hashing (no chaining) on the
|
* Uses an open addressing double hashing (no chaining) on the
|
||||||
* prefix code/next character combination. We do a variant of
|
* prefix code/next character combination. We do a variant of
|
||||||
* Knuth's algorithm D (vol. 3, sec. 6.4) along with G. Knott's
|
* Knuth's algorithm D (vol. 3, sec. 6.4) along with G. Knott's
|
||||||
* relatively-prime secondary probe. Here, the modular division
|
* relatively-prime secondary probe. Here, the modular division
|
||||||
* first probe is gives way to a faster exclusive-or manipulation.
|
* first probe is gives way to a faster exclusive-or manipulation.
|
||||||
* Also do block compression with an adaptive reset, whereby the
|
* Also do block compression with an adaptive reset, whereby the
|
||||||
* code table is cleared when the compression ratio decreases,
|
* code table is cleared when the compression ratio decreases,
|
||||||
* but after the table fills. The variable-length output codes
|
* but after the table fills. The variable-length output codes
|
||||||
* are re-sized at this point, and a CODE_CLEAR is generated
|
* are re-sized at this point, and a CODE_CLEAR is generated
|
||||||
* for the decoder.
|
* for the decoder.
|
||||||
*/
|
*/
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
LZWEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
LZWEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
||||||
{
|
{
|
||||||
register LZWEncodeState *sp = EncoderState(tif);
|
register LZWEncodeState *sp = EncoderState(tif);
|
||||||
@@ -899,7 +899,7 @@ LZWPostEncode(TIFF* tif)
|
|||||||
sp->enc_oldcode = (hcode_t) -1;
|
sp->enc_oldcode = (hcode_t) -1;
|
||||||
}
|
}
|
||||||
PutNextCode(op, CODE_EOI);
|
PutNextCode(op, CODE_EOI);
|
||||||
if (nextbits > 0)
|
if (nextbits > 0)
|
||||||
*op++ = (u_char)(nextdata << (8-nextbits));
|
*op++ = (u_char)(nextdata << (8-nextbits));
|
||||||
tif->tif_rawcc = (tsize_t)(op - tif->tif_rawdata);
|
tif->tif_rawcc = (tsize_t)(op - tif->tif_rawdata);
|
||||||
return (1);
|
return (1);
|
||||||
|
@@ -4,23 +4,23 @@
|
|||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and
|
* Permission to use, copy, modify, distribute, and sell this software and
|
||||||
* its documentation for any purpose is hereby granted without fee, provided
|
* its documentation for any purpose is hereby granted without fee, provided
|
||||||
* that (i) the above copyright notices and this permission notice appear in
|
* that (i) the above copyright notices and this permission notice appear in
|
||||||
* all copies of the software and related documentation, and (ii) the names of
|
* all copies of the software and related documentation, and (ii) the names of
|
||||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||||
* publicity relating to the software without the specific, prior written
|
* publicity relating to the software without the specific, prior written
|
||||||
* permission of Sam Leffler and Silicon Graphics.
|
* permission of Sam Leffler and Silicon Graphics.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
* OF THIS SOFTWARE.
|
* OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
#define LITERALSPAN 0x40
|
#define LITERALSPAN 0x40
|
||||||
#define WHITE ((1<<2)-1)
|
#define WHITE ((1<<2)-1)
|
||||||
|
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
NeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
|
NeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
|
||||||
{
|
{
|
||||||
register u_char *bp, *op;
|
register u_char *bp, *op;
|
||||||
|
338
src/tiff/tif_os2.c
Normal file
338
src/tiff/tif_os2.c
Normal file
@@ -0,0 +1,338 @@
|
|||||||
|
/* $Header$ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
|
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||||
|
*
|
||||||
|
* modifed for use with OS/2 by David Webster
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software and
|
||||||
|
* its documentation for any purpose is hereby granted without fee, provided
|
||||||
|
* that (i) the above copyright notices and this permission notice appear in
|
||||||
|
* all copies of the software and related documentation, and (ii) the names of
|
||||||
|
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||||
|
* publicity relating to the software without the specific, prior written
|
||||||
|
* permission of Sam Leffler and Silicon Graphics.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||||
|
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||||
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
|
* OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TIFF Library OS/2-specific Routines. Adapted from tif_win32.c 2/16/00 by
|
||||||
|
* David Webster (dwebster@bhmi.com), Baldwin, Hackett, and Meeks, Inc., Omaha, NE USA
|
||||||
|
*/
|
||||||
|
#define INCL_PM
|
||||||
|
#define INCL_BASE
|
||||||
|
#include <os2.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "tiffiop.h"
|
||||||
|
|
||||||
|
/* Some windows datatypes */
|
||||||
|
|
||||||
|
typedef ULONG DWORD;
|
||||||
|
typedef ULONG HANDLE;
|
||||||
|
typedef PCHAR LPTSTR;
|
||||||
|
typedef const PCHAR LPCTSTR;
|
||||||
|
typedef CHAR TCHAR;
|
||||||
|
#define GlobalAlloc(a,b) malloc(b)
|
||||||
|
#define LocalAlloc(a,b) malloc(b)
|
||||||
|
#define GlobalFree(b) free(b)
|
||||||
|
#define LocalFree(b) free(b)
|
||||||
|
#define GlobalReAlloc(p, s, t) realloc(p, s)
|
||||||
|
#define CopyMemory(p, v, s) memcpy(p, v, s)
|
||||||
|
#define FillMemory(p, c, s) memset(p, c, s)
|
||||||
|
#define GlobalSize(p) sizeof(p)
|
||||||
|
#define wsprintf sprintf
|
||||||
|
#define wvsprintf vsprintf
|
||||||
|
#define lstrlen strlen
|
||||||
|
|
||||||
|
static tsize_t LINKAGEMODE
|
||||||
|
_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)
|
||||||
|
{
|
||||||
|
DWORD dwSizeRead;
|
||||||
|
if (!DosRead((HFILE)fd, buf, size, &dwSizeRead))
|
||||||
|
return(0);
|
||||||
|
return ((tsize_t) dwSizeRead);
|
||||||
|
}
|
||||||
|
|
||||||
|
static tsize_t LINKAGEMODE
|
||||||
|
_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
|
||||||
|
{
|
||||||
|
DWORD dwSizeWritten;
|
||||||
|
if (!DosWrite((HFILE)fd, buf, size, &dwSizeWritten))
|
||||||
|
return(0);
|
||||||
|
return ((tsize_t) dwSizeWritten);
|
||||||
|
}
|
||||||
|
|
||||||
|
static toff_t LINKAGEMODE
|
||||||
|
_tiffSeekProc(thandle_t fd, toff_t off, int whence)
|
||||||
|
{
|
||||||
|
DWORD dwMoveMethod;
|
||||||
|
ULONG ibActual;
|
||||||
|
switch(whence)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
dwMoveMethod = FILE_BEGIN;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
dwMoveMethod = FILE_CURRENT;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
dwMoveMethod = FILE_END;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dwMoveMethod = FILE_BEGIN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DosSetFilePtr((HFILE)fd, off, dwMoveMethod, &ibActual);
|
||||||
|
return((toff_t)ibActual);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int LINKAGEMODE
|
||||||
|
_tiffCloseProc(thandle_t fd)
|
||||||
|
{
|
||||||
|
return (DosClose((HFILE)fd) ? 0 : -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static toff_t LINKAGEMODE
|
||||||
|
_tiffSizeProc(thandle_t fd)
|
||||||
|
{
|
||||||
|
FILESTATUS3 vStatus;
|
||||||
|
|
||||||
|
DosQueryFileInfo((HFILE)fd, FIL_STANDARD, &vStatus, sizeof(FILESTATUS3));
|
||||||
|
return (vStatus.cbFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int LINKAGEMODE
|
||||||
|
_tiffDummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
|
||||||
|
{
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* From "Hermann Josef Hill" <lhill@rhein-zeitung.de>:
|
||||||
|
*
|
||||||
|
* Windows uses both a handle and a pointer for file mapping,
|
||||||
|
* but according to the SDK documentation and Richter's book
|
||||||
|
* "Advanced Windows Programming" it is safe to free the handle
|
||||||
|
* after obtaining the file mapping pointer
|
||||||
|
*
|
||||||
|
* This removes a nasty OS dependency and cures a problem
|
||||||
|
* with Visual C++ 5.0
|
||||||
|
*/
|
||||||
|
static int LINKAGEMODE
|
||||||
|
_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
|
||||||
|
{
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void LINKAGEMODE
|
||||||
|
_tiffDummyUnmapProc(thandle_t fd, tdata_t base, toff_t size)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void LINKAGEMODE
|
||||||
|
_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Open a TIFF file descriptor for read/writing.
|
||||||
|
* Note that TIFFFdOpen and TIFFOpen recognise the character 'u' in the mode
|
||||||
|
* string, which forces the file to be opened unmapped.
|
||||||
|
*/
|
||||||
|
TIFF*
|
||||||
|
TIFFFdOpen(int ifd, const char* name, const char* mode)
|
||||||
|
{
|
||||||
|
TIFF* tif;
|
||||||
|
BOOL fSuppressMap = (mode[1] == 'u' || mode[2] == 'u');
|
||||||
|
|
||||||
|
tif = TIFFClientOpen(name, mode,
|
||||||
|
(thandle_t)ifd,
|
||||||
|
_tiffReadProc, _tiffWriteProc,
|
||||||
|
_tiffSeekProc, _tiffCloseProc, _tiffSizeProc,
|
||||||
|
fSuppressMap ? _tiffDummyMapProc : _tiffMapProc,
|
||||||
|
fSuppressMap ? _tiffDummyUnmapProc : _tiffUnmapProc);
|
||||||
|
if (tif)
|
||||||
|
tif->tif_fd = ifd;
|
||||||
|
return (tif);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Open a TIFF file for read/writing.
|
||||||
|
*/
|
||||||
|
TIFF*
|
||||||
|
TIFFOpen(const char* name, const char* mode)
|
||||||
|
{
|
||||||
|
static const char module[] = "TIFFOpen";
|
||||||
|
thandle_t fd;
|
||||||
|
int m;
|
||||||
|
DWORD dwOpenMode;
|
||||||
|
DWORD dwOpenFlags;
|
||||||
|
DWORD dwAction;
|
||||||
|
APIRET ulrc;
|
||||||
|
|
||||||
|
m = _TIFFgetMode(mode, module);
|
||||||
|
|
||||||
|
switch(m)
|
||||||
|
{
|
||||||
|
case O_RDONLY:
|
||||||
|
dwOpenMode = OPEN_ACCESS_READONLY;
|
||||||
|
dwOpenFlags = OPEN_ACTION_FAIL_IF_NEW;
|
||||||
|
break;
|
||||||
|
case O_RDWR:
|
||||||
|
dwOpenMode = OPEN_ACCESS_READWRITE;
|
||||||
|
dwOpenFlags = OPEN_ACTION_FAIL_IF_NEW;
|
||||||
|
break;
|
||||||
|
case O_RDWR|O_CREAT:
|
||||||
|
dwOpenMode = OPEN_ACCESS_READWRITE;
|
||||||
|
dwOpenFlags = OPEN_ACTION_CREATE_IF_NEW;
|
||||||
|
break;
|
||||||
|
case O_RDWR|O_TRUNC:
|
||||||
|
dwOpenMode = OPEN_ACCESS_READWRITE;
|
||||||
|
dwOpenFlags = OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS;
|
||||||
|
break;
|
||||||
|
case O_RDWR|O_CREAT|O_TRUNC:
|
||||||
|
dwOpenMode = OPEN_ACCESS_READWRITE;
|
||||||
|
dwOpenFlags = OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_REPLACE_IF_EXISTS;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return ((TIFF*)0);
|
||||||
|
}
|
||||||
|
ulrc = DosOpen( name, (HFILE*)&fd, &dwAction, FILE_ARCHIVED|FILE_NORMAL
|
||||||
|
,1000L, dwOpenFlags, dwOpenMode, NULL
|
||||||
|
);
|
||||||
|
if (fd != NO_ERROR) {
|
||||||
|
TIFFError(module, "%s: Cannot open", name);
|
||||||
|
return ((TIFF *)0);
|
||||||
|
}
|
||||||
|
return (TIFFFdOpen((int)fd, name, mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
tdata_t
|
||||||
|
_TIFFmalloc(tsize_t s)
|
||||||
|
{
|
||||||
|
return ((tdata_t)GlobalAlloc(GMEM_FIXED, s));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_TIFFfree(tdata_t p)
|
||||||
|
{
|
||||||
|
GlobalFree(p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tdata_t
|
||||||
|
_TIFFrealloc(tdata_t p, tsize_t s)
|
||||||
|
{
|
||||||
|
void* pvTmp;
|
||||||
|
if ((pvTmp = GlobalReAlloc(p, s, 0)) == NULL) {
|
||||||
|
if ((pvTmp = GlobalAlloc(sGMEM_FIXED, s)) != NULL) {
|
||||||
|
CopyMemory(pvTmp, p, GlobalSize(p));
|
||||||
|
GlobalFree(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ((tdata_t)pvTmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_TIFFmemset(void* p, int v, tsize_t c)
|
||||||
|
{
|
||||||
|
FillMemory(p, c, (BYTE)v);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_TIFFmemcpy(void* d, const tdata_t s, tsize_t c)
|
||||||
|
{
|
||||||
|
CopyMemory(d, s, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)
|
||||||
|
{
|
||||||
|
register const *pb1 = (const int*)p1;
|
||||||
|
register const *pb2 = (const int*)p2;
|
||||||
|
register DWORD dwTmp = c;
|
||||||
|
register int iTmp;
|
||||||
|
for (iTmp = 0; dwTmp-- && !iTmp; iTmp = (int)*pb1++ - (int)*pb2++)
|
||||||
|
;
|
||||||
|
return (iTmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void LINKAGEMODE
|
||||||
|
Os2WarningHandler(const char* module, const char* fmt, va_list ap)
|
||||||
|
{
|
||||||
|
#ifndef TIF_PLATFORM_CONSOLE
|
||||||
|
LPTSTR szTitle;
|
||||||
|
LPTSTR szTmp;
|
||||||
|
LPCTSTR szTitleText = "%s Warning";
|
||||||
|
LPCTSTR szDefaultModule = "TIFFLIB";
|
||||||
|
szTmp = (module == NULL) ? (LPTSTR)szDefaultModule : (LPTSTR)module;
|
||||||
|
if ((szTitle = (LPTSTR)LocalAlloc(LMEM_FIXED, (lstrlen(szTmp) +
|
||||||
|
lstrlen(szTitleText) + lstrlen(fmt) + 128)*sizeof(TCHAR))) == NULL)
|
||||||
|
return;
|
||||||
|
wsprintf(szTitle, szTitleText, szTmp);
|
||||||
|
szTmp = szTitle + (lstrlen(szTitle)+2)*sizeof(TCHAR);
|
||||||
|
wvsprintf(szTmp, fmt, ap);
|
||||||
|
WinMessageBox( HWND_DESKTOP
|
||||||
|
,WinQueryFocus(HWND_DESKTOP)
|
||||||
|
,szTmp
|
||||||
|
,szTitle
|
||||||
|
,0
|
||||||
|
,MB_OK | MB_INFORMATION
|
||||||
|
);
|
||||||
|
LocalFree(szTitle);
|
||||||
|
return;
|
||||||
|
#else
|
||||||
|
if (module != NULL)
|
||||||
|
fprintf(stderr, "%s: ", module);
|
||||||
|
fprintf(stderr, "Warning, ");
|
||||||
|
vfprintf(stderr, fmt, ap);
|
||||||
|
fprintf(stderr, ".\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
TIFFErrorHandler _TIFFwarningHandler = Os2WarningHandler;
|
||||||
|
|
||||||
|
static void LINKAGEMODE
|
||||||
|
Os2ErrorHandler(const char* module, const char* fmt, va_list ap)
|
||||||
|
{
|
||||||
|
#ifndef TIF_PLATFORM_CONSOLE
|
||||||
|
LPTSTR szTitle;
|
||||||
|
LPTSTR szTmp;
|
||||||
|
LPCTSTR szTitleText = "%s Error";
|
||||||
|
LPCTSTR szDefaultModule = "TIFFLIB";
|
||||||
|
szTmp = (module == NULL) ? (LPTSTR)szDefaultModule : (LPTSTR)module;
|
||||||
|
if ((szTitle = (LPTSTR)LocalAlloc(LMEM_FIXED, (lstrlen(szTmp) +
|
||||||
|
lstrlen(szTitleText) + lstrlen(fmt) + 128)*sizeof(TCHAR))) == NULL)
|
||||||
|
return;
|
||||||
|
wsprintf(szTitle, szTitleText, szTmp);
|
||||||
|
szTmp = szTitle + (lstrlen(szTitle)+2)*sizeof(TCHAR);
|
||||||
|
wvsprintf(szTmp, fmt, ap);
|
||||||
|
WinMessageBox( HWND_DESKTOP
|
||||||
|
,WinQueryFocus(HWND_DESKTOP)
|
||||||
|
,szTmp
|
||||||
|
,szTitle
|
||||||
|
,0
|
||||||
|
,MB_OK | MB_ICONEXCLAMATION
|
||||||
|
);
|
||||||
|
LocalFree(szTitle);
|
||||||
|
return;
|
||||||
|
#else
|
||||||
|
if (module != NULL)
|
||||||
|
fprintf(stderr, "%s: ", module);
|
||||||
|
vfprintf(stderr, fmt, ap);
|
||||||
|
fprintf(stderr, ".\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
TIFFErrorHandler _TIFFerrorHandler = Os2ErrorHandler;
|
||||||
|
|
@@ -4,23 +4,23 @@
|
|||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and
|
* Permission to use, copy, modify, distribute, and sell this software and
|
||||||
* its documentation for any purpose is hereby granted without fee, provided
|
* its documentation for any purpose is hereby granted without fee, provided
|
||||||
* that (i) the above copyright notices and this permission notice appear in
|
* that (i) the above copyright notices and this permission notice appear in
|
||||||
* all copies of the software and related documentation, and (ii) the names of
|
* all copies of the software and related documentation, and (ii) the names of
|
||||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||||
* publicity relating to the software without the specific, prior written
|
* publicity relating to the software without the specific, prior written
|
||||||
* permission of Sam Leffler and Silicon Graphics.
|
* permission of Sam Leffler and Silicon Graphics.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
* OF THIS SOFTWARE.
|
* OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ typedef unsigned char tidata;
|
|||||||
/*
|
/*
|
||||||
* Encode a run of pixels.
|
* Encode a run of pixels.
|
||||||
*/
|
*/
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
PackBitsEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
|
PackBitsEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
|
||||||
{
|
{
|
||||||
u_char* bp = (u_char*) buf;
|
u_char* bp = (u_char*) buf;
|
||||||
@@ -185,7 +185,7 @@ PackBitsEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
|
|||||||
* the decoder if data is read, for example, by scanlines
|
* the decoder if data is read, for example, by scanlines
|
||||||
* when it was encoded by strips.
|
* when it was encoded by strips.
|
||||||
*/
|
*/
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
PackBitsEncodeChunk(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
PackBitsEncodeChunk(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
||||||
{
|
{
|
||||||
tsize_t rowsize = (tsize_t) tif->tif_data;
|
tsize_t rowsize = (tsize_t) tif->tif_data;
|
||||||
@@ -200,7 +200,7 @@ PackBitsEncodeChunk(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
PackBitsDecode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
|
PackBitsDecode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
|
||||||
{
|
{
|
||||||
char *bp;
|
char *bp;
|
||||||
|
@@ -4,23 +4,23 @@
|
|||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and
|
* Permission to use, copy, modify, distribute, and sell this software and
|
||||||
* its documentation for any purpose is hereby granted without fee, provided
|
* its documentation for any purpose is hereby granted without fee, provided
|
||||||
* that (i) the above copyright notices and this permission notice appear in
|
* that (i) the above copyright notices and this permission notice appear in
|
||||||
* all copies of the software and related documentation, and (ii) the names of
|
* all copies of the software and related documentation, and (ii) the names of
|
||||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||||
* publicity relating to the software without the specific, prior written
|
* publicity relating to the software without the specific, prior written
|
||||||
* permission of Sam Leffler and Silicon Graphics.
|
* permission of Sam Leffler and Silicon Graphics.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
* OF THIS SOFTWARE.
|
* OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -36,15 +36,15 @@
|
|||||||
|
|
||||||
#define PredictorState(tif) ((TIFFPredictorState*) (tif)->tif_data)
|
#define PredictorState(tif) ((TIFFPredictorState*) (tif)->tif_data)
|
||||||
|
|
||||||
static void horAcc8(TIFF*, tidata_t, tsize_t);
|
static void LINKAGEMODE horAcc8(TIFF*, tidata_t, tsize_t);
|
||||||
static void horAcc16(TIFF*, tidata_t, tsize_t);
|
static void LINKAGEMODE horAcc16(TIFF*, tidata_t, tsize_t);
|
||||||
static void swabHorAcc16(TIFF*, tidata_t, tsize_t);
|
static void LINKAGEMODE swabHorAcc16(TIFF*, tidata_t, tsize_t);
|
||||||
static void horDiff8(TIFF*, tidata_t, tsize_t);
|
static void LINKAGEMODE horDiff8(TIFF*, tidata_t, tsize_t);
|
||||||
static void horDiff16(TIFF*, tidata_t, tsize_t);
|
static void LINKAGEMODE horDiff16(TIFF*, tidata_t, tsize_t);
|
||||||
static int PredictorDecodeRow(TIFF*, tidata_t, tsize_t, tsample_t);
|
static int LINKAGEMODE PredictorDecodeRow(TIFF*, tidata_t, tsize_t, tsample_t);
|
||||||
static int PredictorDecodeTile(TIFF*, tidata_t, tsize_t, tsample_t);
|
static int LINKAGEMODE PredictorDecodeTile(TIFF*, tidata_t, tsize_t, tsample_t);
|
||||||
static int PredictorEncodeRow(TIFF*, tidata_t, tsize_t, tsample_t);
|
static int LINKAGEMODE PredictorEncodeRow(TIFF*, tidata_t, tsize_t, tsample_t);
|
||||||
static int PredictorEncodeTile(TIFF*, tidata_t, tsize_t, tsample_t);
|
static int LINKAGEMODE PredictorEncodeTile(TIFF*, tidata_t, tsize_t, tsample_t);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
PredictorSetup(TIFF* tif)
|
PredictorSetup(TIFF* tif)
|
||||||
@@ -415,7 +415,7 @@ PredictorVGetField(TIFF* tif, ttag_t tag, va_list ap)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void LINKAGEMODE
|
||||||
PredictorPrintDir(TIFF* tif, FILE* fd, long flags)
|
PredictorPrintDir(TIFF* tif, FILE* fd, long flags)
|
||||||
{
|
{
|
||||||
TIFFPredictorState* sp = PredictorState(tif);
|
TIFFPredictorState* sp = PredictorState(tif);
|
||||||
|
@@ -4,23 +4,23 @@
|
|||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and
|
* Permission to use, copy, modify, distribute, and sell this software and
|
||||||
* its documentation for any purpose is hereby granted without fee, provided
|
* its documentation for any purpose is hereby granted without fee, provided
|
||||||
* that (i) the above copyright notices and this permission notice appear in
|
* that (i) the above copyright notices and this permission notice appear in
|
||||||
* all copies of the software and related documentation, and (ii) the names of
|
* all copies of the software and related documentation, and (ii) the names of
|
||||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||||
* publicity relating to the software without the specific, prior written
|
* publicity relating to the software without the specific, prior written
|
||||||
* permission of Sam Leffler and Silicon Graphics.
|
* permission of Sam Leffler and Silicon Graphics.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
* OF THIS SOFTWARE.
|
* OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ ThunderDecode(TIFF* tif, tidata_t op, tsize_t maxpixels)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int LINKAGEMODE
|
||||||
ThunderDecodeRow(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
|
ThunderDecodeRow(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
|
||||||
{
|
{
|
||||||
tidata_t row = buf;
|
tidata_t row = buf;
|
||||||
|
@@ -88,7 +88,7 @@ typedef HFILE thandle_t; /* client data handle */
|
|||||||
typedef void* thandle_t; /* client data handle */
|
typedef void* thandle_t; /* client data handle */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OS2_32)
|
#if defined(__VISAGECPP__)
|
||||||
#define LINKAGEMODE _Optlink
|
#define LINKAGEMODE _Optlink
|
||||||
#else
|
#else
|
||||||
#define LINKAGEMODE
|
#define LINKAGEMODE
|
||||||
|
Reference in New Issue
Block a user