diff options
author | scuri <scuri> | 2009-08-21 04:01:59 +0000 |
---|---|---|
committer | scuri <scuri> | 2009-08-21 04:01:59 +0000 |
commit | 6c39dd63dc4f91b358155c173a2cfdf4c6c5af3e (patch) | |
tree | 61b709d64e58613bc06b2c2947023d707b764eba /src/libtiff/tif_luv.c | |
parent | 59cda2efbd34938420a506daa60ab47168116484 (diff) |
*** empty log message ***
Diffstat (limited to 'src/libtiff/tif_luv.c')
-rw-r--r-- | src/libtiff/tif_luv.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/src/libtiff/tif_luv.c b/src/libtiff/tif_luv.c index 484bc4f..db1b746 100644 --- a/src/libtiff/tif_luv.c +++ b/src/libtiff/tif_luv.c @@ -1,4 +1,4 @@ -/* $Id: tif_luv.c,v 1.1 2008/10/17 06:16:07 scuri Exp $ */ +/* $Id: tif_luv.c,v 1.2 2009/08/21 04:01:59 scuri Exp $ */ /* * Copyright (c) 1997 Greg Ward Larson @@ -451,7 +451,7 @@ LogL16Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) tif->tif_rawcp = op; tif->tif_rawcc = tif->tif_rawdatasize - occ; - return (0); + return (1); } /* @@ -496,7 +496,7 @@ LogLuvEncode24(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) tif->tif_rawcp = op; tif->tif_rawcc = tif->tif_rawdatasize - occ; - return (0); + return (1); } /* @@ -585,7 +585,7 @@ LogLuvEncode32(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) tif->tif_rawcp = op; tif->tif_rawcc = tif->tif_rawdatasize - occ; - return (0); + return (1); } /* @@ -598,7 +598,7 @@ LogLuvEncodeStrip(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) tsize_t rowlen = TIFFScanlineSize(tif); assert(cc%rowlen == 0); - while (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 0) + while (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 1) bp += rowlen, cc -= rowlen; return (cc == 0); } @@ -613,7 +613,7 @@ LogLuvEncodeTile(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) tsize_t rowlen = TIFFTileRowSize(tif); assert(cc%rowlen == 0); - while (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 0) + while (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 1) bp += rowlen, cc -= rowlen; return (cc == 0); } @@ -1200,7 +1200,10 @@ LogL16InitState(TIFF* tif) "No support for converting user data format to LogL"); return (0); } - sp->tbuflen = multiply(td->td_imagewidth, td->td_rowsperstrip); + if( isTiled(tif) ) + sp->tbuflen = multiply(td->td_tilewidth, td->td_tilelength); + else + sp->tbuflen = multiply(td->td_imagewidth, td->td_rowsperstrip); if (multiply(sp->tbuflen, sizeof (int16)) == 0 || (sp->tbuf = (tidata_t*) _TIFFmalloc(sp->tbuflen * sizeof (int16))) == NULL) { TIFFErrorExt(tif->tif_clientdata, module, "%s: No space for SGILog translation buffer", @@ -1298,7 +1301,10 @@ LogLuvInitState(TIFF* tif) "No support for converting user data format to LogLuv"); return (0); } - sp->tbuflen = multiply(td->td_imagewidth, td->td_rowsperstrip); + if( isTiled(tif) ) + sp->tbuflen = multiply(td->td_tilewidth, td->td_tilelength); + else + sp->tbuflen = multiply(td->td_imagewidth, td->td_rowsperstrip); if (multiply(sp->tbuflen, sizeof (uint32)) == 0 || (sp->tbuf = (tidata_t*) _TIFFmalloc(sp->tbuflen * sizeof (uint32))) == NULL) { TIFFErrorExt(tif->tif_clientdata, module, "%s: No space for SGILog translation buffer", @@ -1561,6 +1567,16 @@ TIFFInitSGILog(TIFF* tif, int scheme) assert(scheme == COMPRESSION_SGILOG24 || scheme == COMPRESSION_SGILOG); /* + * Merge codec-specific tag information. + */ + if (!_TIFFMergeFieldInfo(tif, LogLuvFieldInfo, + TIFFArrayCount(LogLuvFieldInfo))) { + TIFFErrorExt(tif->tif_clientdata, module, + "Merging SGILog codec-specific tags failed"); + return 0; + } + + /* * Allocate state block so tag methods have storage to record values. */ tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (LogLuvState)); @@ -1587,9 +1603,9 @@ TIFFInitSGILog(TIFF* tif, int scheme) tif->tif_close = LogLuvClose; tif->tif_cleanup = LogLuvCleanup; - /* override SetField so we can handle our private pseudo-tag */ - _TIFFMergeFieldInfo(tif, LogLuvFieldInfo, - TIFFArrayCount(LogLuvFieldInfo)); + /* + * Override parent get/set field methods. + */ sp->vgetparent = tif->tif_tagmethods.vgetfield; tif->tif_tagmethods.vgetfield = LogLuvVGetField; /* hook for codec tags */ sp->vsetparent = tif->tif_tagmethods.vsetfield; |