| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "core/fxcodec/codec/codec_int.h" | 7 #include "core/fxcodec/codec/codec_int.h" |
| 8 #include "core/fxcodec/include/fx_codec.h" | 8 #include "core/fxcodec/include/fx_codec.h" |
| 9 #include "core/fxge/include/fx_dib.h" | 9 #include "core/fxge/include/fx_dib.h" |
| 10 | 10 |
| 11 extern "C" { | 11 extern "C" { |
| 12 #include "third_party/libtiff/tiffiop.h" | 12 #include "third_party/libtiff/tiffiop.h" |
| 13 } | 13 } |
| 14 | 14 |
| 15 void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData, | |
| 16 unsigned int dwProfileSize, | |
| 17 int nComponents, | |
| 18 int intent, | |
| 19 uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT); | |
| 20 void IccLib_TranslateImage(void* pTransform, | |
| 21 unsigned char* pDest, | |
| 22 const unsigned char* pSrc, | |
| 23 int pixels); | |
| 24 void IccLib_DestroyTransform(void* pTransform); | |
| 25 class CCodec_TiffContext { | 15 class CCodec_TiffContext { |
| 26 public: | 16 public: |
| 27 CCodec_TiffContext(); | 17 CCodec_TiffContext(); |
| 28 ~CCodec_TiffContext(); | 18 ~CCodec_TiffContext(); |
| 29 | 19 |
| 30 FX_BOOL InitDecoder(IFX_FileRead* file_ptr); | 20 bool InitDecoder(IFX_FileRead* file_ptr); |
| 31 void GetFrames(int32_t& frames); | 21 bool LoadFrameInfo(int32_t frame, |
| 32 FX_BOOL LoadFrameInfo(int32_t frame, | 22 int32_t* width, |
| 33 uint32_t& width, | 23 int32_t* height, |
| 34 uint32_t& height, | 24 int32_t* comps, |
| 35 uint32_t& comps, | 25 int32_t* bpc, |
| 36 uint32_t& bpc, | 26 CFX_DIBAttribute* pAttribute); |
| 37 CFX_DIBAttribute* pAttribute); | 27 bool Decode(CFX_DIBitmap* pDIBitmap); |
| 38 FX_BOOL Decode(CFX_DIBitmap* pDIBitmap); | |
| 39 | 28 |
| 40 union { | 29 IFX_FileRead* io_in() const { return m_io_in; } |
| 41 IFX_FileRead* in; | 30 uint32_t offset() const { return m_offset; } |
| 42 IFX_FileStream* out; | 31 void set_offset(uint32_t offset) { m_offset = offset; } |
| 43 } io; | 32 void increment_offset(uint32_t offset) { m_offset += offset; } |
| 44 | |
| 45 uint32_t offset; | |
| 46 | |
| 47 TIFF* tif_ctx; | |
| 48 void* icc_ctx; | |
| 49 int32_t frame_num; | |
| 50 int32_t frame_cur; | |
| 51 FX_BOOL isDecoder; | |
| 52 | 33 |
| 53 private: | 34 private: |
| 54 FX_BOOL isSupport(CFX_DIBitmap* pDIBitmap); | 35 bool IsSupport(CFX_DIBitmap* pDIBitmap); |
| 55 void SetPalette(CFX_DIBitmap* pDIBitmap, uint16_t bps); | 36 void SetPalette(CFX_DIBitmap* pDIBitmap, uint16_t bps); |
| 56 FX_BOOL Decode1bppRGB(CFX_DIBitmap* pDIBitmap, | 37 bool Decode1bppRGB(CFX_DIBitmap* pDIBitmap, |
| 57 int32_t height, | 38 int32_t height, |
| 58 int32_t width, | 39 int32_t width, |
| 59 uint16_t bps, | 40 uint16_t bps, |
| 60 uint16_t spp); | 41 uint16_t spp); |
| 61 FX_BOOL Decode8bppRGB(CFX_DIBitmap* pDIBitmap, | 42 bool Decode8bppRGB(CFX_DIBitmap* pDIBitmap, |
| 62 int32_t height, | 43 int32_t height, |
| 63 int32_t width, | 44 int32_t width, |
| 64 uint16_t bps, | 45 uint16_t bps, |
| 65 uint16_t spp); | 46 uint16_t spp); |
| 66 FX_BOOL Decode24bppRGB(CFX_DIBitmap* pDIBitmap, | 47 bool Decode24bppRGB(CFX_DIBitmap* pDIBitmap, |
| 67 int32_t height, | 48 int32_t height, |
| 68 int32_t width, | 49 int32_t width, |
| 69 uint16_t bps, | 50 uint16_t bps, |
| 70 uint16_t spp); | 51 uint16_t spp); |
| 52 |
| 53 IFX_FileRead* m_io_in; |
| 54 uint32_t m_offset; |
| 55 TIFF* m_tif_ctx; |
| 71 }; | 56 }; |
| 72 CCodec_TiffContext::CCodec_TiffContext() { | 57 |
| 73 offset = 0; | |
| 74 frame_num = 0; | |
| 75 frame_cur = 0; | |
| 76 io.in = nullptr; | |
| 77 tif_ctx = nullptr; | |
| 78 icc_ctx = nullptr; | |
| 79 isDecoder = TRUE; | |
| 80 } | |
| 81 CCodec_TiffContext::~CCodec_TiffContext() { | |
| 82 if (icc_ctx) { | |
| 83 IccLib_DestroyTransform(icc_ctx); | |
| 84 icc_ctx = nullptr; | |
| 85 } | |
| 86 if (tif_ctx) { | |
| 87 TIFFClose(tif_ctx); | |
| 88 } | |
| 89 } | |
| 90 static tsize_t _tiff_read(thandle_t context, tdata_t buf, tsize_t length) { | |
| 91 CCodec_TiffContext* pTiffContext = (CCodec_TiffContext*)context; | |
| 92 FX_BOOL ret = FALSE; | |
| 93 if (pTiffContext->isDecoder) { | |
| 94 ret = pTiffContext->io.in->ReadBlock(buf, pTiffContext->offset, length); | |
| 95 } else { | |
| 96 ret = pTiffContext->io.out->ReadBlock(buf, pTiffContext->offset, length); | |
| 97 } | |
| 98 if (!ret) { | |
| 99 return 0; | |
| 100 } | |
| 101 pTiffContext->offset += (uint32_t)length; | |
| 102 return length; | |
| 103 } | |
| 104 static tsize_t _tiff_write(thandle_t context, tdata_t buf, tsize_t length) { | |
| 105 CCodec_TiffContext* pTiffContext = (CCodec_TiffContext*)context; | |
| 106 ASSERT(!pTiffContext->isDecoder); | |
| 107 if (!pTiffContext->io.out->WriteBlock(buf, pTiffContext->offset, length)) { | |
| 108 return 0; | |
| 109 } | |
| 110 pTiffContext->offset += (uint32_t)length; | |
| 111 return length; | |
| 112 } | |
| 113 static toff_t _tiff_seek(thandle_t context, toff_t offset, int whence) { | |
| 114 CCodec_TiffContext* pTiffContext = (CCodec_TiffContext*)context; | |
| 115 switch (whence) { | |
| 116 case 0: | |
| 117 pTiffContext->offset = (uint32_t)offset; | |
| 118 break; | |
| 119 case 1: | |
| 120 pTiffContext->offset += (uint32_t)offset; | |
| 121 break; | |
| 122 case 2: | |
| 123 if (pTiffContext->isDecoder) { | |
| 124 if (pTiffContext->io.in->GetSize() < (FX_FILESIZE)offset) { | |
| 125 return static_cast<toff_t>(-1); | |
| 126 } | |
| 127 pTiffContext->offset = | |
| 128 (uint32_t)(pTiffContext->io.in->GetSize() - offset); | |
| 129 } else { | |
| 130 if (pTiffContext->io.out->GetSize() < (FX_FILESIZE)offset) { | |
| 131 return static_cast<toff_t>(-1); | |
| 132 } | |
| 133 pTiffContext->offset = | |
| 134 (uint32_t)(pTiffContext->io.out->GetSize() - offset); | |
| 135 } | |
| 136 break; | |
| 137 default: | |
| 138 return static_cast<toff_t>(-1); | |
| 139 } | |
| 140 ASSERT(pTiffContext->isDecoder ? (pTiffContext->offset <= | |
| 141 (uint32_t)pTiffContext->io.in->GetSize()) | |
| 142 : TRUE); | |
| 143 return pTiffContext->offset; | |
| 144 } | |
| 145 static int _tiff_close(thandle_t context) { | |
| 146 return 0; | |
| 147 } | |
| 148 static toff_t _tiff_get_size(thandle_t context) { | |
| 149 CCodec_TiffContext* pTiffContext = (CCodec_TiffContext*)context; | |
| 150 return pTiffContext->isDecoder ? (toff_t)pTiffContext->io.in->GetSize() | |
| 151 : (toff_t)pTiffContext->io.out->GetSize(); | |
| 152 } | |
| 153 static int _tiff_map(thandle_t context, tdata_t*, toff_t*) { | |
| 154 return 0; | |
| 155 } | |
| 156 static void _tiff_unmap(thandle_t context, tdata_t, toff_t) {} | |
| 157 TIFF* _tiff_open(void* context, const char* mode) { | |
| 158 TIFF* tif = TIFFClientOpen("Tiff Image", mode, (thandle_t)context, _tiff_read, | |
| 159 _tiff_write, _tiff_seek, _tiff_close, | |
| 160 _tiff_get_size, _tiff_map, _tiff_unmap); | |
| 161 if (tif) { | |
| 162 tif->tif_fd = (int)(intptr_t)context; | |
| 163 } | |
| 164 return tif; | |
| 165 } | |
| 166 void* _TIFFmalloc(tmsize_t size) { | 58 void* _TIFFmalloc(tmsize_t size) { |
| 167 return FXMEM_DefaultAlloc(size, 0); | 59 return FXMEM_DefaultAlloc(size, 0); |
| 168 } | 60 } |
| 61 |
| 169 void _TIFFfree(void* ptr) { | 62 void _TIFFfree(void* ptr) { |
| 170 FXMEM_DefaultFree(ptr, 0); | 63 FXMEM_DefaultFree(ptr, 0); |
| 171 } | 64 } |
| 65 |
| 172 void* _TIFFrealloc(void* ptr, tmsize_t size) { | 66 void* _TIFFrealloc(void* ptr, tmsize_t size) { |
| 173 return FXMEM_DefaultRealloc(ptr, size, 0); | 67 return FXMEM_DefaultRealloc(ptr, size, 0); |
| 174 } | 68 } |
| 69 |
| 175 void _TIFFmemset(void* ptr, int val, tmsize_t size) { | 70 void _TIFFmemset(void* ptr, int val, tmsize_t size) { |
| 176 FXSYS_memset(ptr, val, (size_t)size); | 71 FXSYS_memset(ptr, val, (size_t)size); |
| 177 } | 72 } |
| 73 |
| 178 void _TIFFmemcpy(void* des, const void* src, tmsize_t size) { | 74 void _TIFFmemcpy(void* des, const void* src, tmsize_t size) { |
| 179 FXSYS_memcpy(des, src, (size_t)size); | 75 FXSYS_memcpy(des, src, (size_t)size); |
| 180 } | 76 } |
| 77 |
| 181 int _TIFFmemcmp(const void* ptr1, const void* ptr2, tmsize_t size) { | 78 int _TIFFmemcmp(const void* ptr1, const void* ptr2, tmsize_t size) { |
| 182 return FXSYS_memcmp(ptr1, ptr2, (size_t)size); | 79 return FXSYS_memcmp(ptr1, ptr2, (size_t)size); |
| 183 } | 80 } |
| 184 | 81 |
| 185 TIFFErrorHandler _TIFFwarningHandler = nullptr; | 82 TIFFErrorHandler _TIFFwarningHandler = nullptr; |
| 186 TIFFErrorHandler _TIFFerrorHandler = nullptr; | 83 TIFFErrorHandler _TIFFerrorHandler = nullptr; |
| 187 | 84 |
| 188 int TIFFCmyk2Rgb(thandle_t context, | 85 namespace { |
| 189 uint8 c, | 86 |
| 190 uint8 m, | 87 tsize_t tiff_read(thandle_t context, tdata_t buf, tsize_t length) { |
| 191 uint8 y, | 88 CCodec_TiffContext* pTiffContext = (CCodec_TiffContext*)context; |
| 192 uint8 k, | 89 if (!pTiffContext->io_in()->ReadBlock(buf, pTiffContext->offset(), length)) |
| 193 uint8* r, | |
| 194 uint8* g, | |
| 195 uint8* b) { | |
| 196 if (!context) | |
| 197 return 0; | 90 return 0; |
| 198 | 91 |
| 199 CCodec_TiffContext* p = (CCodec_TiffContext*)context; | 92 pTiffContext->increment_offset(length); |
| 200 if (p->icc_ctx) { | 93 return length; |
| 201 unsigned char cmyk[4], bgr[3]; | 94 } |
| 202 cmyk[0] = c, cmyk[1] = m, cmyk[2] = y, cmyk[3] = k; | 95 |
| 203 IccLib_TranslateImage(p->icc_ctx, bgr, cmyk, 1); | 96 tsize_t tiff_write(thandle_t context, tdata_t buf, tsize_t length) { |
| 204 *r = bgr[2], *g = bgr[1], *b = bgr[0]; | 97 ASSERT(false); |
| 205 } else { | 98 return 0; |
| 206 AdobeCMYK_to_sRGB1(c, m, y, k, *r, *g, *b); | 99 } |
| 100 |
| 101 toff_t tiff_seek(thandle_t context, toff_t offset, int whence) { |
| 102 CCodec_TiffContext* pTiffContext = (CCodec_TiffContext*)context; |
| 103 switch (whence) { |
| 104 case 0: |
| 105 pTiffContext->set_offset(offset); |
| 106 break; |
| 107 case 1: |
| 108 pTiffContext->increment_offset(offset); |
| 109 break; |
| 110 case 2: |
| 111 if (pTiffContext->io_in()->GetSize() < (FX_FILESIZE)offset) |
| 112 return static_cast<toff_t>(-1); |
| 113 pTiffContext->set_offset(pTiffContext->io_in()->GetSize() - offset); |
| 114 break; |
| 115 default: |
| 116 return static_cast<toff_t>(-1); |
| 207 } | 117 } |
| 208 return 1; | 118 ASSERT(pTiffContext->offset() <= (uint32_t)pTiffContext->io_in()->GetSize()); |
| 119 return pTiffContext->offset(); |
| 209 } | 120 } |
| 210 FX_BOOL CCodec_TiffContext::InitDecoder(IFX_FileRead* file_ptr) { | 121 |
| 211 io.in = file_ptr; | 122 int tiff_close(thandle_t context) { |
| 212 return !!_tiff_open(this, "r"); | 123 return 0; |
| 213 } | 124 } |
| 214 void CCodec_TiffContext::GetFrames(int32_t& frames) { | 125 |
| 215 frames = frame_num = TIFFNumberOfDirectories(tif_ctx); | 126 toff_t tiff_get_size(thandle_t context) { |
| 127 CCodec_TiffContext* pTiffContext = (CCodec_TiffContext*)context; |
| 128 return (toff_t)pTiffContext->io_in()->GetSize(); |
| 216 } | 129 } |
| 217 #define TIFF_EXIF_GETINFO(key, T, tag) \ | |
| 218 { \ | |
| 219 T val = (T)0; \ | |
| 220 TIFFGetField(tif_ctx, tag, &val); \ | |
| 221 if (val) { \ | |
| 222 (key) = FX_Alloc(uint8_t, sizeof(T)); \ | |
| 223 if ((key)) { \ | |
| 224 T* ptr = (T*)(key); \ | |
| 225 *ptr = val; \ | |
| 226 pExif->m_TagVal.SetAt(tag, (key)); \ | |
| 227 } \ | |
| 228 } \ | |
| 229 } \ | |
| 230 (key) = nullptr; | |
| 231 #define TIFF_EXIF_GETSTRINGINFO(key, tag) \ | |
| 232 { \ | |
| 233 uint32_t size = 0; \ | |
| 234 uint8_t* buf = nullptr; \ | |
| 235 TIFFGetField(tif_ctx, tag, &size, &buf); \ | |
| 236 if (size && buf) { \ | |
| 237 (key) = FX_Alloc(uint8_t, size); \ | |
| 238 if ((key)) { \ | |
| 239 FXSYS_memcpy((key), buf, size); \ | |
| 240 pExif->m_TagVal.SetAt(tag, (key)); \ | |
| 241 } \ | |
| 242 } \ | |
| 243 } \ | |
| 244 (key) = nullptr; | |
| 245 | 130 |
| 246 namespace { | 131 int tiff_map(thandle_t context, tdata_t*, toff_t*) { |
| 132 return 0; |
| 133 } |
| 134 |
| 135 void tiff_unmap(thandle_t context, tdata_t, toff_t) {} |
| 136 |
| 137 TIFF* tiff_open(void* context, const char* mode) { |
| 138 TIFF* tif = TIFFClientOpen("Tiff Image", mode, (thandle_t)context, tiff_read, |
| 139 tiff_write, tiff_seek, tiff_close, tiff_get_size, |
| 140 tiff_map, tiff_unmap); |
| 141 if (tif) { |
| 142 tif->tif_fd = (int)(intptr_t)context; |
| 143 } |
| 144 return tif; |
| 145 } |
| 247 | 146 |
| 248 template <class T> | 147 template <class T> |
| 249 FX_BOOL Tiff_Exif_GetInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttribute* pAttr) { | 148 bool Tiff_Exif_GetInfo(TIFF* tif_ctx, ttag_t tag, CFX_DIBAttribute* pAttr) { |
| 250 T val = 0; | 149 T val = 0; |
| 251 TIFFGetField(tif_ctx, tag, &val); | 150 TIFFGetField(tif_ctx, tag, &val); |
| 252 if (!val) | 151 if (!val) |
| 253 return FALSE; | 152 return false; |
| 254 T* ptr = FX_Alloc(T, 1); | 153 T* ptr = FX_Alloc(T, 1); |
| 255 *ptr = val; | 154 *ptr = val; |
| 256 pAttr->m_Exif[tag] = (void*)ptr; | 155 pAttr->m_Exif[tag] = (void*)ptr; |
| 257 return TRUE; | 156 return true; |
| 258 } | 157 } |
| 158 |
| 259 void Tiff_Exif_GetStringInfo(TIFF* tif_ctx, | 159 void Tiff_Exif_GetStringInfo(TIFF* tif_ctx, |
| 260 ttag_t tag, | 160 ttag_t tag, |
| 261 CFX_DIBAttribute* pAttr) { | 161 CFX_DIBAttribute* pAttr) { |
| 262 FX_CHAR* buf = nullptr; | 162 FX_CHAR* buf = nullptr; |
| 263 TIFFGetField(tif_ctx, tag, &buf); | 163 TIFFGetField(tif_ctx, tag, &buf); |
| 264 if (!buf) | 164 if (!buf) |
| 265 return; | 165 return; |
| 266 FX_STRSIZE size = FXSYS_strlen(buf); | 166 FX_STRSIZE size = FXSYS_strlen(buf); |
| 267 uint8_t* ptr = FX_Alloc(uint8_t, size + 1); | 167 uint8_t* ptr = FX_Alloc(uint8_t, size + 1); |
| 268 FXSYS_memcpy(ptr, buf, size); | 168 FXSYS_memcpy(ptr, buf, size); |
| 269 ptr[size] = 0; | 169 ptr[size] = 0; |
| 270 pAttr->m_Exif[tag] = ptr; | 170 pAttr->m_Exif[tag] = ptr; |
| 271 } | 171 } |
| 272 | 172 |
| 273 } // namespace | 173 void TiffBGRA2RGBA(uint8_t* pBuf, int32_t pixel, int32_t spp) { |
| 274 | |
| 275 FX_BOOL CCodec_TiffContext::LoadFrameInfo(int32_t frame, | |
| 276 uint32_t& width, | |
| 277 uint32_t& height, | |
| 278 uint32_t& comps, | |
| 279 uint32_t& bpc, | |
| 280 CFX_DIBAttribute* pAttribute) { | |
| 281 if (!TIFFSetDirectory(tif_ctx, (uint16)frame)) { | |
| 282 return FALSE; | |
| 283 } | |
| 284 uint16_t tif_cs; | |
| 285 uint32_t tif_icc_size = 0; | |
| 286 uint8_t* tif_icc_buf = nullptr; | |
| 287 uint16_t tif_bpc = 0; | |
| 288 uint16_t tif_cps; | |
| 289 uint32_t tif_rps; | |
| 290 width = height = comps = 0; | |
| 291 TIFFGetField(tif_ctx, TIFFTAG_IMAGEWIDTH, &width); | |
| 292 TIFFGetField(tif_ctx, TIFFTAG_IMAGELENGTH, &height); | |
| 293 TIFFGetField(tif_ctx, TIFFTAG_SAMPLESPERPIXEL, &comps); | |
| 294 TIFFGetField(tif_ctx, TIFFTAG_BITSPERSAMPLE, &tif_bpc); | |
| 295 TIFFGetField(tif_ctx, TIFFTAG_PHOTOMETRIC, &tif_cs); | |
| 296 TIFFGetField(tif_ctx, TIFFTAG_COMPRESSION, &tif_cps); | |
| 297 TIFFGetField(tif_ctx, TIFFTAG_ROWSPERSTRIP, &tif_rps); | |
| 298 TIFFGetField(tif_ctx, TIFFTAG_ICCPROFILE, &tif_icc_size, &tif_icc_buf); | |
| 299 if (pAttribute) { | |
| 300 pAttribute->m_wDPIUnit = FXCODEC_RESUNIT_INCH; | |
| 301 if (TIFFGetField(tif_ctx, TIFFTAG_RESOLUTIONUNIT, | |
| 302 &pAttribute->m_wDPIUnit)) { | |
| 303 pAttribute->m_wDPIUnit -= 1; | |
| 304 } | |
| 305 Tiff_Exif_GetInfo<uint16_t>(tif_ctx, TIFFTAG_ORIENTATION, pAttribute); | |
| 306 if (Tiff_Exif_GetInfo<FX_FLOAT>(tif_ctx, TIFFTAG_XRESOLUTION, pAttribute)) { | |
| 307 void* val = pAttribute->m_Exif[TIFFTAG_XRESOLUTION]; | |
| 308 FX_FLOAT fDpi = val ? *reinterpret_cast<FX_FLOAT*>(val) : 0; | |
| 309 pAttribute->m_nXDPI = (int32_t)(fDpi + 0.5f); | |
| 310 } | |
| 311 if (Tiff_Exif_GetInfo<FX_FLOAT>(tif_ctx, TIFFTAG_YRESOLUTION, pAttribute)) { | |
| 312 void* val = pAttribute->m_Exif[TIFFTAG_YRESOLUTION]; | |
| 313 FX_FLOAT fDpi = val ? *reinterpret_cast<FX_FLOAT*>(val) : 0; | |
| 314 pAttribute->m_nYDPI = (int32_t)(fDpi + 0.5f); | |
| 315 } | |
| 316 Tiff_Exif_GetStringInfo(tif_ctx, TIFFTAG_IMAGEDESCRIPTION, pAttribute); | |
| 317 Tiff_Exif_GetStringInfo(tif_ctx, TIFFTAG_MAKE, pAttribute); | |
| 318 Tiff_Exif_GetStringInfo(tif_ctx, TIFFTAG_MODEL, pAttribute); | |
| 319 } | |
| 320 bpc = tif_bpc; | |
| 321 if (tif_rps > height) { | |
| 322 TIFFSetField(tif_ctx, TIFFTAG_ROWSPERSTRIP, tif_rps = height); | |
| 323 } | |
| 324 return TRUE; | |
| 325 } | |
| 326 void _TiffBGRA2RGBA(uint8_t* pBuf, int32_t pixel, int32_t spp) { | |
| 327 for (int32_t n = 0; n < pixel; n++) { | 174 for (int32_t n = 0; n < pixel; n++) { |
| 328 uint8_t tmp = pBuf[0]; | 175 uint8_t tmp = pBuf[0]; |
| 329 pBuf[0] = pBuf[2]; | 176 pBuf[0] = pBuf[2]; |
| 330 pBuf[2] = tmp; | 177 pBuf[2] = tmp; |
| 331 pBuf += spp; | 178 pBuf += spp; |
| 332 } | 179 } |
| 333 } | 180 } |
| 334 FX_BOOL CCodec_TiffContext::isSupport(CFX_DIBitmap* pDIBitmap) { | 181 |
| 335 if (TIFFIsTiled(tif_ctx)) { | 182 } // namespace |
| 336 return FALSE; | 183 |
| 184 CCodec_TiffContext::CCodec_TiffContext() |
| 185 : m_io_in(nullptr), m_offset(0), m_tif_ctx(nullptr) {} |
| 186 |
| 187 CCodec_TiffContext::~CCodec_TiffContext() { |
| 188 if (m_tif_ctx) |
| 189 TIFFClose(m_tif_ctx); |
| 190 } |
| 191 |
| 192 bool CCodec_TiffContext::InitDecoder(IFX_FileRead* file_ptr) { |
| 193 m_io_in = file_ptr; |
| 194 m_tif_ctx = tiff_open(this, "r"); |
| 195 return !!m_tif_ctx; |
| 196 } |
| 197 |
| 198 bool CCodec_TiffContext::LoadFrameInfo(int32_t frame, |
| 199 int32_t* width, |
| 200 int32_t* height, |
| 201 int32_t* comps, |
| 202 int32_t* bpc, |
| 203 CFX_DIBAttribute* pAttribute) { |
| 204 if (!TIFFSetDirectory(m_tif_ctx, (uint16)frame)) |
| 205 return false; |
| 206 |
| 207 uint16_t tif_bpc = 0; |
| 208 int32_t tif_rps; |
| 209 *width = 0; |
| 210 *height = 0; |
| 211 *comps = 0; |
| 212 TIFFGetField(m_tif_ctx, TIFFTAG_IMAGEWIDTH, width); |
| 213 TIFFGetField(m_tif_ctx, TIFFTAG_IMAGELENGTH, height); |
| 214 TIFFGetField(m_tif_ctx, TIFFTAG_SAMPLESPERPIXEL, comps); |
| 215 TIFFGetField(m_tif_ctx, TIFFTAG_BITSPERSAMPLE, &tif_bpc); |
| 216 TIFFGetField(m_tif_ctx, TIFFTAG_ROWSPERSTRIP, &tif_rps); |
| 217 if (pAttribute) { |
| 218 pAttribute->m_wDPIUnit = FXCODEC_RESUNIT_INCH; |
| 219 if (TIFFGetField(m_tif_ctx, TIFFTAG_RESOLUTIONUNIT, |
| 220 &pAttribute->m_wDPIUnit)) { |
| 221 pAttribute->m_wDPIUnit -= 1; |
| 222 } |
| 223 Tiff_Exif_GetInfo<uint16_t>(m_tif_ctx, TIFFTAG_ORIENTATION, pAttribute); |
| 224 if (Tiff_Exif_GetInfo<FX_FLOAT>(m_tif_ctx, TIFFTAG_XRESOLUTION, |
| 225 pAttribute)) { |
| 226 void* val = pAttribute->m_Exif[TIFFTAG_XRESOLUTION]; |
| 227 FX_FLOAT fDpi = val ? *reinterpret_cast<FX_FLOAT*>(val) : 0; |
| 228 pAttribute->m_nXDPI = (int32_t)(fDpi + 0.5f); |
| 229 } |
| 230 if (Tiff_Exif_GetInfo<FX_FLOAT>(m_tif_ctx, TIFFTAG_YRESOLUTION, |
| 231 pAttribute)) { |
| 232 void* val = pAttribute->m_Exif[TIFFTAG_YRESOLUTION]; |
| 233 FX_FLOAT fDpi = val ? *reinterpret_cast<FX_FLOAT*>(val) : 0; |
| 234 pAttribute->m_nYDPI = (int32_t)(fDpi + 0.5f); |
| 235 } |
| 236 Tiff_Exif_GetStringInfo(m_tif_ctx, TIFFTAG_IMAGEDESCRIPTION, pAttribute); |
| 237 Tiff_Exif_GetStringInfo(m_tif_ctx, TIFFTAG_MAKE, pAttribute); |
| 238 Tiff_Exif_GetStringInfo(m_tif_ctx, TIFFTAG_MODEL, pAttribute); |
| 337 } | 239 } |
| 240 *bpc = tif_bpc; |
| 241 if (tif_rps > *height) { |
| 242 tif_rps = *height; |
| 243 TIFFSetField(m_tif_ctx, TIFFTAG_ROWSPERSTRIP, tif_rps); |
| 244 } |
| 245 return true; |
| 246 } |
| 247 |
| 248 bool CCodec_TiffContext::IsSupport(CFX_DIBitmap* pDIBitmap) { |
| 249 if (TIFFIsTiled(m_tif_ctx)) |
| 250 return false; |
| 251 |
| 338 uint16_t photometric; | 252 uint16_t photometric; |
| 339 if (!TIFFGetField(tif_ctx, TIFFTAG_PHOTOMETRIC, &photometric)) { | 253 if (!TIFFGetField(m_tif_ctx, TIFFTAG_PHOTOMETRIC, &photometric)) |
| 340 return FALSE; | 254 return false; |
| 341 } | 255 |
| 342 switch (pDIBitmap->GetBPP()) { | 256 switch (pDIBitmap->GetBPP()) { |
| 343 case 1: | 257 case 1: |
| 344 case 8: | 258 case 8: |
| 345 if (photometric != PHOTOMETRIC_PALETTE) { | 259 if (photometric != PHOTOMETRIC_PALETTE) { |
| 346 return FALSE; | 260 return false; |
| 347 } | 261 } |
| 348 break; | 262 break; |
| 349 case 24: | 263 case 24: |
| 350 if (photometric != PHOTOMETRIC_RGB) { | 264 if (photometric != PHOTOMETRIC_RGB) { |
| 351 return FALSE; | 265 return false; |
| 352 } | 266 } |
| 353 break; | 267 break; |
| 354 default: | 268 default: |
| 355 return FALSE; | 269 return false; |
| 356 } | 270 } |
| 357 uint16_t planarconfig; | 271 uint16_t planarconfig; |
| 358 if (!TIFFGetFieldDefaulted(tif_ctx, TIFFTAG_PLANARCONFIG, &planarconfig)) { | 272 if (!TIFFGetFieldDefaulted(m_tif_ctx, TIFFTAG_PLANARCONFIG, &planarconfig)) |
| 359 return FALSE; | 273 return false; |
| 360 } | 274 |
| 361 if (planarconfig == PLANARCONFIG_SEPARATE) { | 275 return planarconfig != PLANARCONFIG_SEPARATE; |
| 362 return FALSE; | |
| 363 } | |
| 364 return TRUE; | |
| 365 } | 276 } |
| 277 |
| 366 void CCodec_TiffContext::SetPalette(CFX_DIBitmap* pDIBitmap, uint16_t bps) { | 278 void CCodec_TiffContext::SetPalette(CFX_DIBitmap* pDIBitmap, uint16_t bps) { |
| 367 uint16_t *red_orig, *green_orig, *blue_orig; | 279 uint16_t *red_orig, *green_orig, *blue_orig; |
| 368 TIFFGetField(tif_ctx, TIFFTAG_COLORMAP, &red_orig, &green_orig, &blue_orig); | 280 TIFFGetField(m_tif_ctx, TIFFTAG_COLORMAP, &red_orig, &green_orig, &blue_orig); |
| 369 for (int32_t i = (1L << bps) - 1; i >= 0; i--) { | 281 for (int32_t i = (1L << bps) - 1; i >= 0; i--) { |
| 370 #define CVT(x) ((uint16_t)((x) >> 8)) | 282 #define CVT(x) ((uint16_t)((x) >> 8)) |
| 371 red_orig[i] = CVT(red_orig[i]); | 283 red_orig[i] = CVT(red_orig[i]); |
| 372 green_orig[i] = CVT(green_orig[i]); | 284 green_orig[i] = CVT(green_orig[i]); |
| 373 blue_orig[i] = CVT(blue_orig[i]); | 285 blue_orig[i] = CVT(blue_orig[i]); |
| 374 #undef CVT | 286 #undef CVT |
| 375 } | 287 } |
| 376 int32_t len = 1 << bps; | 288 int32_t len = 1 << bps; |
| 377 for (int32_t index = 0; index < len; index++) { | 289 for (int32_t index = 0; index < len; index++) { |
| 378 uint32_t r = red_orig[index] & 0xFF; | 290 uint32_t r = red_orig[index] & 0xFF; |
| 379 uint32_t g = green_orig[index] & 0xFF; | 291 uint32_t g = green_orig[index] & 0xFF; |
| 380 uint32_t b = blue_orig[index] & 0xFF; | 292 uint32_t b = blue_orig[index] & 0xFF; |
| 381 uint32_t color = (uint32_t)b | ((uint32_t)g << 8) | ((uint32_t)r << 16) | | 293 uint32_t color = (uint32_t)b | ((uint32_t)g << 8) | ((uint32_t)r << 16) | |
| 382 (((uint32)0xffL) << 24); | 294 (((uint32)0xffL) << 24); |
| 383 pDIBitmap->SetPaletteEntry(index, color); | 295 pDIBitmap->SetPaletteEntry(index, color); |
| 384 } | 296 } |
| 385 } | 297 } |
| 386 FX_BOOL CCodec_TiffContext::Decode1bppRGB(CFX_DIBitmap* pDIBitmap, | 298 |
| 387 int32_t height, | 299 bool CCodec_TiffContext::Decode1bppRGB(CFX_DIBitmap* pDIBitmap, |
| 388 int32_t width, | 300 int32_t height, |
| 389 uint16_t bps, | 301 int32_t width, |
| 390 uint16_t spp) { | 302 uint16_t bps, |
| 303 uint16_t spp) { |
| 391 if (pDIBitmap->GetBPP() != 1 || spp != 1 || bps != 1 || | 304 if (pDIBitmap->GetBPP() != 1 || spp != 1 || bps != 1 || |
| 392 !isSupport(pDIBitmap)) { | 305 !IsSupport(pDIBitmap)) { |
| 393 return FALSE; | 306 return false; |
| 394 } | 307 } |
| 395 SetPalette(pDIBitmap, bps); | 308 SetPalette(pDIBitmap, bps); |
| 396 int32_t size = (int32_t)TIFFScanlineSize(tif_ctx); | 309 int32_t size = (int32_t)TIFFScanlineSize(m_tif_ctx); |
| 397 uint8_t* buf = (uint8_t*)_TIFFmalloc(size); | 310 uint8_t* buf = (uint8_t*)_TIFFmalloc(size); |
| 398 if (!buf) { | 311 if (!buf) { |
| 399 TIFFError(TIFFFileName(tif_ctx), "No space for scanline buffer"); | 312 TIFFError(TIFFFileName(m_tif_ctx), "No space for scanline buffer"); |
| 400 return FALSE; | 313 return false; |
| 401 } | 314 } |
| 402 uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer(); | 315 uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer(); |
| 403 uint32_t pitch = pDIBitmap->GetPitch(); | 316 uint32_t pitch = pDIBitmap->GetPitch(); |
| 404 for (int32_t row = 0; row < height; row++) { | 317 for (int32_t row = 0; row < height; row++) { |
| 405 TIFFReadScanline(tif_ctx, buf, row, 0); | 318 TIFFReadScanline(m_tif_ctx, buf, row, 0); |
| 406 for (int32_t j = 0; j < size; j++) { | 319 for (int32_t j = 0; j < size; j++) { |
| 407 bitMapbuffer[row * pitch + j] = buf[j]; | 320 bitMapbuffer[row * pitch + j] = buf[j]; |
| 408 } | 321 } |
| 409 } | 322 } |
| 410 _TIFFfree(buf); | 323 _TIFFfree(buf); |
| 411 return TRUE; | 324 return true; |
| 412 } | 325 } |
| 413 FX_BOOL CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap, | 326 |
| 414 int32_t height, | 327 bool CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap, |
| 415 int32_t width, | 328 int32_t height, |
| 416 uint16_t bps, | 329 int32_t width, |
| 417 uint16_t spp) { | 330 uint16_t bps, |
| 331 uint16_t spp) { |
| 418 if (pDIBitmap->GetBPP() != 8 || spp != 1 || (bps != 4 && bps != 8) || | 332 if (pDIBitmap->GetBPP() != 8 || spp != 1 || (bps != 4 && bps != 8) || |
| 419 !isSupport(pDIBitmap)) { | 333 !IsSupport(pDIBitmap)) { |
| 420 return FALSE; | 334 return false; |
| 421 } | 335 } |
| 422 SetPalette(pDIBitmap, bps); | 336 SetPalette(pDIBitmap, bps); |
| 423 int32_t size = (int32_t)TIFFScanlineSize(tif_ctx); | 337 int32_t size = (int32_t)TIFFScanlineSize(m_tif_ctx); |
| 424 uint8_t* buf = (uint8_t*)_TIFFmalloc(size); | 338 uint8_t* buf = (uint8_t*)_TIFFmalloc(size); |
| 425 if (!buf) { | 339 if (!buf) { |
| 426 TIFFError(TIFFFileName(tif_ctx), "No space for scanline buffer"); | 340 TIFFError(TIFFFileName(m_tif_ctx), "No space for scanline buffer"); |
| 427 return FALSE; | 341 return false; |
| 428 } | 342 } |
| 429 uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer(); | 343 uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer(); |
| 430 uint32_t pitch = pDIBitmap->GetPitch(); | 344 uint32_t pitch = pDIBitmap->GetPitch(); |
| 431 for (int32_t row = 0; row < height; row++) { | 345 for (int32_t row = 0; row < height; row++) { |
| 432 TIFFReadScanline(tif_ctx, buf, row, 0); | 346 TIFFReadScanline(m_tif_ctx, buf, row, 0); |
| 433 for (int32_t j = 0; j < size; j++) { | 347 for (int32_t j = 0; j < size; j++) { |
| 434 switch (bps) { | 348 switch (bps) { |
| 435 case 4: | 349 case 4: |
| 436 bitMapbuffer[row * pitch + 2 * j + 0] = (buf[j] & 0xF0) >> 4; | 350 bitMapbuffer[row * pitch + 2 * j + 0] = (buf[j] & 0xF0) >> 4; |
| 437 bitMapbuffer[row * pitch + 2 * j + 1] = (buf[j] & 0x0F) >> 0; | 351 bitMapbuffer[row * pitch + 2 * j + 1] = (buf[j] & 0x0F) >> 0; |
| 438 break; | 352 break; |
| 439 case 8: | 353 case 8: |
| 440 bitMapbuffer[row * pitch + j] = buf[j]; | 354 bitMapbuffer[row * pitch + j] = buf[j]; |
| 441 break; | 355 break; |
| 442 } | 356 } |
| 443 } | 357 } |
| 444 } | 358 } |
| 445 _TIFFfree(buf); | 359 _TIFFfree(buf); |
| 446 return TRUE; | 360 return true; |
| 447 } | 361 } |
| 448 FX_BOOL CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap, | 362 |
| 449 int32_t height, | 363 bool CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap, |
| 450 int32_t width, | 364 int32_t height, |
| 451 uint16_t bps, | 365 int32_t width, |
| 452 uint16_t spp) { | 366 uint16_t bps, |
| 453 if (pDIBitmap->GetBPP() != 24 || !isSupport(pDIBitmap)) { | 367 uint16_t spp) { |
| 454 return FALSE; | 368 if (pDIBitmap->GetBPP() != 24 || !IsSupport(pDIBitmap)) |
| 455 } | 369 return false; |
| 456 int32_t size = (int32_t)TIFFScanlineSize(tif_ctx); | 370 |
| 371 int32_t size = (int32_t)TIFFScanlineSize(m_tif_ctx); |
| 457 uint8_t* buf = (uint8_t*)_TIFFmalloc(size); | 372 uint8_t* buf = (uint8_t*)_TIFFmalloc(size); |
| 458 if (!buf) { | 373 if (!buf) { |
| 459 TIFFError(TIFFFileName(tif_ctx), "No space for scanline buffer"); | 374 TIFFError(TIFFFileName(m_tif_ctx), "No space for scanline buffer"); |
| 460 return FALSE; | 375 return false; |
| 461 } | 376 } |
| 462 uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer(); | 377 uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer(); |
| 463 uint32_t pitch = pDIBitmap->GetPitch(); | 378 uint32_t pitch = pDIBitmap->GetPitch(); |
| 464 for (int32_t row = 0; row < height; row++) { | 379 for (int32_t row = 0; row < height; row++) { |
| 465 TIFFReadScanline(tif_ctx, buf, row, 0); | 380 TIFFReadScanline(m_tif_ctx, buf, row, 0); |
| 466 for (int32_t j = 0; j < size - 2; j += 3) { | 381 for (int32_t j = 0; j < size - 2; j += 3) { |
| 467 bitMapbuffer[row * pitch + j + 0] = buf[j + 2]; | 382 bitMapbuffer[row * pitch + j + 0] = buf[j + 2]; |
| 468 bitMapbuffer[row * pitch + j + 1] = buf[j + 1]; | 383 bitMapbuffer[row * pitch + j + 1] = buf[j + 1]; |
| 469 bitMapbuffer[row * pitch + j + 2] = buf[j + 0]; | 384 bitMapbuffer[row * pitch + j + 2] = buf[j + 0]; |
| 470 } | 385 } |
| 471 } | 386 } |
| 472 _TIFFfree(buf); | 387 _TIFFfree(buf); |
| 473 return TRUE; | 388 return true; |
| 474 } | 389 } |
| 475 FX_BOOL CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) { | 390 |
| 391 bool CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) { |
| 476 uint32_t img_wid = pDIBitmap->GetWidth(); | 392 uint32_t img_wid = pDIBitmap->GetWidth(); |
| 477 uint32_t img_hei = pDIBitmap->GetHeight(); | 393 uint32_t img_hei = pDIBitmap->GetHeight(); |
| 478 uint32_t width = 0; | 394 uint32_t width = 0; |
| 479 uint32_t height = 0; | 395 uint32_t height = 0; |
| 480 TIFFGetField(tif_ctx, TIFFTAG_IMAGEWIDTH, &width); | 396 TIFFGetField(m_tif_ctx, TIFFTAG_IMAGEWIDTH, &width); |
| 481 TIFFGetField(tif_ctx, TIFFTAG_IMAGELENGTH, &height); | 397 TIFFGetField(m_tif_ctx, TIFFTAG_IMAGELENGTH, &height); |
| 482 if (img_wid != width || img_hei != height) { | 398 if (img_wid != width || img_hei != height) |
| 483 return FALSE; | 399 return false; |
| 484 } | 400 |
| 485 if (pDIBitmap->GetBPP() == 32) { | 401 if (pDIBitmap->GetBPP() == 32) { |
| 486 uint16_t rotation = ORIENTATION_TOPLEFT; | 402 uint16_t rotation = ORIENTATION_TOPLEFT; |
| 487 TIFFGetField(tif_ctx, TIFFTAG_ORIENTATION, &rotation); | 403 TIFFGetField(m_tif_ctx, TIFFTAG_ORIENTATION, &rotation); |
| 488 if (TIFFReadRGBAImageOriented(tif_ctx, img_wid, img_hei, | 404 if (TIFFReadRGBAImageOriented(m_tif_ctx, img_wid, img_hei, |
| 489 (uint32*)pDIBitmap->GetBuffer(), rotation, | 405 (uint32*)pDIBitmap->GetBuffer(), rotation, |
| 490 1)) { | 406 1)) { |
| 491 for (uint32_t row = 0; row < img_hei; row++) { | 407 for (uint32_t row = 0; row < img_hei; row++) { |
| 492 uint8_t* row_buf = (uint8_t*)pDIBitmap->GetScanline(row); | 408 uint8_t* row_buf = (uint8_t*)pDIBitmap->GetScanline(row); |
| 493 _TiffBGRA2RGBA(row_buf, img_wid, 4); | 409 TiffBGRA2RGBA(row_buf, img_wid, 4); |
| 494 } | 410 } |
| 495 return TRUE; | 411 return true; |
| 496 } | 412 } |
| 497 } | 413 } |
| 498 uint16_t spp, bps; | 414 uint16_t spp; |
| 499 TIFFGetField(tif_ctx, TIFFTAG_SAMPLESPERPIXEL, &spp); | 415 uint16_t bps; |
| 500 TIFFGetField(tif_ctx, TIFFTAG_BITSPERSAMPLE, &bps); | 416 TIFFGetField(m_tif_ctx, TIFFTAG_SAMPLESPERPIXEL, &spp); |
| 417 TIFFGetField(m_tif_ctx, TIFFTAG_BITSPERSAMPLE, &bps); |
| 501 uint32_t bpp = bps * spp; | 418 uint32_t bpp = bps * spp; |
| 502 if (bpp == 1) { | 419 if (bpp == 1) |
| 503 return Decode1bppRGB(pDIBitmap, height, width, bps, spp); | 420 return Decode1bppRGB(pDIBitmap, height, width, bps, spp); |
| 504 } else if (bpp <= 8) { | 421 if (bpp <= 8) |
| 505 return Decode8bppRGB(pDIBitmap, height, width, bps, spp); | 422 return Decode8bppRGB(pDIBitmap, height, width, bps, spp); |
| 506 } else if (bpp <= 24) { | 423 if (bpp <= 24) |
| 507 return Decode24bppRGB(pDIBitmap, height, width, bps, spp); | 424 return Decode24bppRGB(pDIBitmap, height, width, bps, spp); |
| 508 } | 425 return false; |
| 509 return FALSE; | |
| 510 } | 426 } |
| 511 | 427 |
| 512 CCodec_TiffContext* CCodec_TiffModule::CreateDecoder(IFX_FileRead* file_ptr) { | 428 CCodec_TiffContext* CCodec_TiffModule::CreateDecoder(IFX_FileRead* file_ptr) { |
| 513 CCodec_TiffContext* pDecoder = new CCodec_TiffContext; | 429 CCodec_TiffContext* pDecoder = new CCodec_TiffContext; |
| 514 if (!pDecoder->InitDecoder(file_ptr)) { | 430 if (!pDecoder->InitDecoder(file_ptr)) { |
| 515 delete pDecoder; | 431 delete pDecoder; |
| 516 return nullptr; | 432 return nullptr; |
| 517 } | 433 } |
| 518 return pDecoder; | 434 return pDecoder; |
| 519 } | 435 } |
| 520 | 436 |
| 521 void CCodec_TiffModule::GetFrames(CCodec_TiffContext* ctx, int32_t& frames) { | 437 bool CCodec_TiffModule::LoadFrameInfo(CCodec_TiffContext* ctx, |
| 522 ctx->GetFrames(frames); | 438 int32_t frame, |
| 523 } | 439 int32_t* width, |
| 524 | 440 int32_t* height, |
| 525 FX_BOOL CCodec_TiffModule::LoadFrameInfo(CCodec_TiffContext* ctx, | 441 int32_t* comps, |
| 526 int32_t frame, | 442 int32_t* bpc, |
| 527 uint32_t& width, | 443 CFX_DIBAttribute* pAttribute) { |
| 528 uint32_t& height, | |
| 529 uint32_t& comps, | |
| 530 uint32_t& bpc, | |
| 531 CFX_DIBAttribute* pAttribute) { | |
| 532 return ctx->LoadFrameInfo(frame, width, height, comps, bpc, pAttribute); | 444 return ctx->LoadFrameInfo(frame, width, height, comps, bpc, pAttribute); |
| 533 } | 445 } |
| 534 | 446 |
| 535 FX_BOOL CCodec_TiffModule::Decode(CCodec_TiffContext* ctx, | 447 bool CCodec_TiffModule::Decode(CCodec_TiffContext* ctx, |
| 536 class CFX_DIBitmap* pDIBitmap) { | 448 class CFX_DIBitmap* pDIBitmap) { |
| 537 return ctx->Decode(pDIBitmap); | 449 return ctx->Decode(pDIBitmap); |
| 538 } | 450 } |
| 539 | 451 |
| 540 void CCodec_TiffModule::DestroyDecoder(CCodec_TiffContext* ctx) { | 452 void CCodec_TiffModule::DestroyDecoder(CCodec_TiffContext* ctx) { |
| 541 delete ctx; | 453 delete ctx; |
| 542 } | 454 } |
| OLD | NEW |