]>
git.saurik.com Git - wxWidgets.git/blob - src/tiff/tif_dumpmode.c
   4  * Copyright (c) 1988-1997 Sam Leffler 
   5  * Copyright (c) 1991-1997 Silicon Graphics, Inc. 
   7  * Permission to use, copy, modify, distribute, and sell this software and 
   8  * its documentation for any purpose is hereby granted without fee, provided 
   9  * that (i) the above copyright notices and this permission notice appear in 
  10  * all copies of the software and related documentation, and (ii) the names of 
  11  * Sam Leffler and Silicon Graphics may not be used in any advertising or 
  12  * publicity relating to the software without the specific, prior written 
  13  * permission of Sam Leffler and Silicon Graphics. 
  15  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  16  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  17  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 
  19  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR 
  20  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, 
  21  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
  22  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  23  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  30  * "Null" Compression Algorithm Support. 
  35  * Encode a hunk of pixels. 
  37 static int LINKAGEMODE
 
  38 DumpModeEncode(TIFF
* tif
, tidata_t pp
, tsize_t cc
, tsample_t s
) 
  45                 if (tif
->tif_rawcc 
+ n 
> tif
->tif_rawdatasize
) 
  46                         n 
= tif
->tif_rawdatasize 
- tif
->tif_rawcc
; 
  48                  * Avoid copy if client has setup raw 
  49                  * data buffer to avoid extra copy. 
  51                 if (tif
->tif_rawcp 
!= pp
) 
  52                         _TIFFmemcpy(tif
->tif_rawcp
, pp
, n
); 
  57                 if (tif
->tif_rawcc 
>= tif
->tif_rawdatasize 
&& 
  65  * Decode a hunk of pixels. 
  67 static int LINKAGEMODE
 
  68 DumpModeDecode(TIFF
* tif
, tidata_t buf
, tsize_t cc
, tsample_t s
) 
  71         if (tif
->tif_rawcc 
< cc
) { 
  72                 TIFFError(tif
->tif_name
, 
  73                     "DumpModeDecode: Not enough data for scanline %d", 
  78          * Avoid copy if client has setup raw 
  79          * data buffer to avoid extra copy. 
  81         if (tif
->tif_rawcp 
!= buf
) 
  82                 _TIFFmemcpy(buf
, tif
->tif_rawcp
, cc
); 
  89  * Seek forwards nrows in the current strip. 
  91 static int LINKAGEMODE
 
  92 DumpModeSeek(TIFF
* tif
, uint32 nrows
) 
  94         tif
->tif_rawcp 
+= nrows 
* tif
->tif_scanlinesize
; 
  95         tif
->tif_rawcc 
-= nrows 
* tif
->tif_scanlinesize
; 
 100  * Initialize dump mode. 
 103 TIFFInitDumpMode(TIFF
* tif
, int scheme
) 
 106         tif
->tif_decoderow 
= DumpModeDecode
; 
 107         tif
->tif_decodestrip 
= DumpModeDecode
; 
 108         tif
->tif_decodetile 
= DumpModeDecode
; 
 109         tif
->tif_encoderow 
= DumpModeEncode
; 
 110         tif
->tif_encodestrip 
= DumpModeEncode
; 
 111         tif
->tif_encodetile 
= DumpModeEncode
; 
 112         tif
->tif_seek 
= DumpModeSeek
;