| 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 "../../../../third_party/base/nonstd_unique_ptr.h" | 7 #include "../../../../third_party/base/nonstd_unique_ptr.h" |
| 8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
| 9 #include "../../../include/fpdfapi/fpdf_pageobj.h" | 9 #include "../../../include/fpdfapi/fpdf_pageobj.h" |
| 10 #include "../../../include/fpdfapi/fpdf_render.h" | 10 #include "../../../include/fpdfapi/fpdf_render.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 void* ctx_; // Decoder context, owned. | 98 void* ctx_; // Decoder context, owned. |
| 99 unsigned char* output_offsets_; // Output offsets for decoding, owned. | 99 unsigned char* output_offsets_; // Output offsets for decoding, owned. |
| 100 | 100 |
| 101 // Disallow evil constructors | 101 // Disallow evil constructors |
| 102 JpxBitMapContext(const JpxBitMapContext&); | 102 JpxBitMapContext(const JpxBitMapContext&); |
| 103 void operator=(const JpxBitMapContext&); | 103 void operator=(const JpxBitMapContext&); |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 } // namespace | 106 } // namespace |
| 107 | 107 |
| 108 CFX_DIBSource* CPDF_Image::LoadDIBSource(CFX_DIBSource** ppMask, FX_DWORD* pMatt
eColor, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask) const | 108 CFX_DIBSource* CPDF_Image::LoadDIBSource(CFX_DIBSource** ppMask, FX_DWORD* pMatt
eColor, bool bStdCS, FX_DWORD GroupFamily, bool bLoadMask) const |
| 109 { | 109 { |
| 110 CPDF_DIBSource* pSource = new CPDF_DIBSource; | 110 CPDF_DIBSource* pSource = new CPDF_DIBSource; |
| 111 if (pSource->Load(m_pDocument, m_pStream, (CPDF_DIBSource**)ppMask, pMatteCo
lor, NULL, NULL, bStdCS, GroupFamily, bLoadMask)) { | 111 if (pSource->Load(m_pDocument, m_pStream, (CPDF_DIBSource**)ppMask, pMatteCo
lor, NULL, NULL, bStdCS, GroupFamily, bLoadMask)) { |
| 112 return pSource; | 112 return pSource; |
| 113 } | 113 } |
| 114 delete pSource; | 114 delete pSource; |
| 115 return NULL; | 115 return NULL; |
| 116 } | 116 } |
| 117 CFX_DIBSource* CPDF_Image::DetachBitmap() | 117 CFX_DIBSource* CPDF_Image::DetachBitmap() |
| 118 { | 118 { |
| 119 CFX_DIBSource* pBitmap = m_pDIBSource; | 119 CFX_DIBSource* pBitmap = m_pDIBSource; |
| 120 m_pDIBSource = NULL; | 120 m_pDIBSource = NULL; |
| 121 return pBitmap; | 121 return pBitmap; |
| 122 } | 122 } |
| 123 CFX_DIBSource* CPDF_Image::DetachMask() | 123 CFX_DIBSource* CPDF_Image::DetachMask() |
| 124 { | 124 { |
| 125 CFX_DIBSource* pBitmap = m_pMask; | 125 CFX_DIBSource* pBitmap = m_pMask; |
| 126 m_pMask = NULL; | 126 m_pMask = NULL; |
| 127 return pBitmap; | 127 return pBitmap; |
| 128 } | 128 } |
| 129 FX_BOOL CPDF_Image::StartLoadDIBSource(CPDF_Dictionary* pFormResource, CPDF_Dict
ionary* pPageResource, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask) | 129 bool CPDF_Image::StartLoadDIBSource(CPDF_Dictionary* pFormResource, CPDF_Diction
ary* pPageResource, bool bStdCS, FX_DWORD GroupFamily, bool bLoadMask) |
| 130 { | 130 { |
| 131 m_pDIBSource = new CPDF_DIBSource; | 131 m_pDIBSource = new CPDF_DIBSource; |
| 132 int ret = ((CPDF_DIBSource*)m_pDIBSource)->StartLoadDIBSource(m_pDocument, m
_pStream, TRUE, pFormResource, pPageResource, bStdCS, GroupFamily, bLoadMask); | 132 int ret = ((CPDF_DIBSource*)m_pDIBSource)->StartLoadDIBSource(m_pDocument, m
_pStream, true, pFormResource, pPageResource, bStdCS, GroupFamily, bLoadMask); |
| 133 if (ret == 2) { | 133 if (ret == 2) { |
| 134 return TRUE; | 134 return true; |
| 135 } | 135 } |
| 136 if (!ret) { | 136 if (!ret) { |
| 137 delete m_pDIBSource; | 137 delete m_pDIBSource; |
| 138 m_pDIBSource = NULL; | 138 m_pDIBSource = NULL; |
| 139 return FALSE; | 139 return false; |
| 140 } | 140 } |
| 141 m_pMask = ((CPDF_DIBSource*)m_pDIBSource)->DetachMask(); | 141 m_pMask = ((CPDF_DIBSource*)m_pDIBSource)->DetachMask(); |
| 142 m_MatteColor = ((CPDF_DIBSource*)m_pDIBSource)->m_MatteColor; | 142 m_MatteColor = ((CPDF_DIBSource*)m_pDIBSource)->m_MatteColor; |
| 143 return FALSE; | 143 return false; |
| 144 } | 144 } |
| 145 FX_BOOL CPDF_Image::Continue(IFX_Pause* pPause) | 145 bool CPDF_Image::Continue(IFX_Pause* pPause) |
| 146 { | 146 { |
| 147 int ret = ((CPDF_DIBSource*)m_pDIBSource)->ContinueLoadDIBSource(pPause); | 147 int ret = ((CPDF_DIBSource*)m_pDIBSource)->ContinueLoadDIBSource(pPause); |
| 148 if (ret == 2) { | 148 if (ret == 2) { |
| 149 return TRUE; | 149 return true; |
| 150 } | 150 } |
| 151 if (!ret) { | 151 if (!ret) { |
| 152 delete m_pDIBSource; | 152 delete m_pDIBSource; |
| 153 m_pDIBSource = NULL; | 153 m_pDIBSource = NULL; |
| 154 return FALSE; | 154 return false; |
| 155 } | 155 } |
| 156 m_pMask = ((CPDF_DIBSource*)m_pDIBSource)->DetachMask(); | 156 m_pMask = ((CPDF_DIBSource*)m_pDIBSource)->DetachMask(); |
| 157 m_MatteColor = ((CPDF_DIBSource*)m_pDIBSource)->m_MatteColor; | 157 m_MatteColor = ((CPDF_DIBSource*)m_pDIBSource)->m_MatteColor; |
| 158 return FALSE; | 158 return false; |
| 159 } | 159 } |
| 160 CPDF_DIBSource::CPDF_DIBSource() | 160 CPDF_DIBSource::CPDF_DIBSource() |
| 161 { | 161 { |
| 162 m_pDocument = NULL; | 162 m_pDocument = NULL; |
| 163 m_pStreamAcc = NULL; | 163 m_pStreamAcc = NULL; |
| 164 m_pDict = NULL; | 164 m_pDict = NULL; |
| 165 m_bpp = 0; | 165 m_bpp = 0; |
| 166 m_Width = m_Height = 0; | 166 m_Width = m_Height = 0; |
| 167 m_pColorSpace = NULL; | 167 m_pColorSpace = NULL; |
| 168 m_bDefaultDecode = TRUE; | 168 m_bDefaultDecode = true; |
| 169 m_bImageMask = FALSE; | 169 m_bImageMask = false; |
| 170 m_bDoBpcCheck = TRUE; | 170 m_bDoBpcCheck = true; |
| 171 m_pPalette = NULL; | 171 m_pPalette = NULL; |
| 172 m_pCompData = NULL; | 172 m_pCompData = NULL; |
| 173 m_bColorKey = FALSE; | 173 m_bColorKey = false; |
| 174 m_pMaskedLine = m_pLineBuf = NULL; | 174 m_pMaskedLine = m_pLineBuf = NULL; |
| 175 m_pDecoder = NULL; | 175 m_pDecoder = NULL; |
| 176 m_nComponents = 0; | 176 m_nComponents = 0; |
| 177 m_bpc = 0; | 177 m_bpc = 0; |
| 178 m_bLoadMask = FALSE; | 178 m_bLoadMask = false; |
| 179 m_Family = 0; | 179 m_Family = 0; |
| 180 m_pMask = NULL; | 180 m_pMask = NULL; |
| 181 m_MatteColor = 0; | 181 m_MatteColor = 0; |
| 182 m_pJbig2Context = NULL; | 182 m_pJbig2Context = NULL; |
| 183 m_pGlobalStream = NULL; | 183 m_pGlobalStream = NULL; |
| 184 m_bStdCS = FALSE; | 184 m_bStdCS = false; |
| 185 m_pMaskStream = NULL; | 185 m_pMaskStream = NULL; |
| 186 m_Status = 0; | 186 m_Status = 0; |
| 187 m_bHasMask = FALSE; | 187 m_bHasMask = false; |
| 188 } | 188 } |
| 189 CPDF_DIBSource::~CPDF_DIBSource() | 189 CPDF_DIBSource::~CPDF_DIBSource() |
| 190 { | 190 { |
| 191 delete m_pStreamAcc; | 191 delete m_pStreamAcc; |
| 192 if (m_pMaskedLine) { | 192 if (m_pMaskedLine) { |
| 193 FX_Free(m_pMaskedLine); | 193 FX_Free(m_pMaskedLine); |
| 194 } | 194 } |
| 195 if (m_pLineBuf) { | 195 if (m_pLineBuf) { |
| 196 FX_Free(m_pLineBuf); | 196 FX_Free(m_pLineBuf); |
| 197 } | 197 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 213 CFX_DIBitmap* CPDF_DIBSource::GetBitmap() const | 213 CFX_DIBitmap* CPDF_DIBSource::GetBitmap() const |
| 214 { | 214 { |
| 215 return m_pCachedBitmap ? m_pCachedBitmap.get() : Clone(); | 215 return m_pCachedBitmap ? m_pCachedBitmap.get() : Clone(); |
| 216 } | 216 } |
| 217 void CPDF_DIBSource::ReleaseBitmap(CFX_DIBitmap* pBitmap) const | 217 void CPDF_DIBSource::ReleaseBitmap(CFX_DIBitmap* pBitmap) const |
| 218 { | 218 { |
| 219 if (pBitmap && pBitmap != m_pCachedBitmap) { | 219 if (pBitmap && pBitmap != m_pCachedBitmap) { |
| 220 delete pBitmap; | 220 delete pBitmap; |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, CP
DF_DIBSource** ppMask, | 223 bool CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, CPDF_
DIBSource** ppMask, |
| 224 FX_DWORD* pMatteColor, CPDF_Dictionary* pFormResour
ces, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_B
OOL bLoadMask) | 224 FX_DWORD* pMatteColor, CPDF_Dictionary* pFormResour
ces, CPDF_Dictionary* pPageResources, bool bStdCS, FX_DWORD GroupFamily, bool bL
oadMask) |
| 225 { | 225 { |
| 226 if (pStream == NULL) { | 226 if (pStream == NULL) { |
| 227 return FALSE; | 227 return false; |
| 228 } | 228 } |
| 229 m_pDocument = pDoc; | 229 m_pDocument = pDoc; |
| 230 m_pDict = pStream->GetDict(); | 230 m_pDict = pStream->GetDict(); |
| 231 if (m_pDict == NULL) { | 231 if (m_pDict == NULL) { |
| 232 return FALSE; | 232 return false; |
| 233 } | 233 } |
| 234 m_pStream = pStream; | 234 m_pStream = pStream; |
| 235 m_Width = m_pDict->GetInteger(FX_BSTRC("Width")); | 235 m_Width = m_pDict->GetInteger(FX_BSTRC("Width")); |
| 236 m_Height = m_pDict->GetInteger(FX_BSTRC("Height")); | 236 m_Height = m_pDict->GetInteger(FX_BSTRC("Height")); |
| 237 if (m_Width <= 0 || m_Height <= 0 || m_Width > 0x01ffff || m_Height > 0x01ff
ff) { | 237 if (m_Width <= 0 || m_Height <= 0 || m_Width > 0x01ffff || m_Height > 0x01ff
ff) { |
| 238 return FALSE; | 238 return false; |
| 239 } | 239 } |
| 240 m_GroupFamily = GroupFamily; | 240 m_GroupFamily = GroupFamily; |
| 241 m_bLoadMask = bLoadMask; | 241 m_bLoadMask = bLoadMask; |
| 242 if (!LoadColorInfo(m_pStream->GetObjNum() != 0 ? NULL : pFormResources, pPag
eResources)) { | 242 if (!LoadColorInfo(m_pStream->GetObjNum() != 0 ? NULL : pFormResources, pPag
eResources)) { |
| 243 return FALSE; | 243 return false; |
| 244 } | 244 } |
| 245 if (m_bDoBpcCheck && (m_bpc == 0 || m_nComponents == 0)) { | 245 if (m_bDoBpcCheck && (m_bpc == 0 || m_nComponents == 0)) { |
| 246 return FALSE; | 246 return false; |
| 247 } | 247 } |
| 248 FX_SAFE_DWORD src_pitch = | 248 FX_SAFE_DWORD src_pitch = |
| 249 CalculatePitch8(m_bpc, m_nComponents, m_Width, m_Height); | 249 CalculatePitch8(m_bpc, m_nComponents, m_Width, m_Height); |
| 250 if (!src_pitch.IsValid()) { | 250 if (!src_pitch.IsValid()) { |
| 251 return FALSE; | 251 return false; |
| 252 } | 252 } |
| 253 m_pStreamAcc = new CPDF_StreamAcc; | 253 m_pStreamAcc = new CPDF_StreamAcc; |
| 254 m_pStreamAcc->LoadAllData(pStream, FALSE, src_pitch.ValueOrDie(), TRUE); | 254 m_pStreamAcc->LoadAllData(pStream, false, src_pitch.ValueOrDie(), true); |
| 255 if (m_pStreamAcc->GetSize() == 0 || m_pStreamAcc->GetData() == NULL) { | 255 if (m_pStreamAcc->GetSize() == 0 || m_pStreamAcc->GetData() == NULL) { |
| 256 return FALSE; | 256 return false; |
| 257 } | 257 } |
| 258 if (!CreateDecoder()) { | 258 if (!CreateDecoder()) { |
| 259 return FALSE; | 259 return false; |
| 260 } | 260 } |
| 261 if (m_bImageMask) { | 261 if (m_bImageMask) { |
| 262 m_bpp = 1; | 262 m_bpp = 1; |
| 263 m_bpc = 1; | 263 m_bpc = 1; |
| 264 m_nComponents = 1; | 264 m_nComponents = 1; |
| 265 m_AlphaFlag = 1; | 265 m_AlphaFlag = 1; |
| 266 } else if (m_bpc * m_nComponents == 1) { | 266 } else if (m_bpc * m_nComponents == 1) { |
| 267 m_bpp = 1; | 267 m_bpp = 1; |
| 268 } else if (m_bpc * m_nComponents <= 8) { | 268 } else if (m_bpc * m_nComponents <= 8) { |
| 269 m_bpp = 8; | 269 m_bpp = 8; |
| 270 } else { | 270 } else { |
| 271 m_bpp = 24; | 271 m_bpp = 24; |
| 272 } | 272 } |
| 273 FX_SAFE_DWORD pitch = CalculatePitch32(m_bpp, m_Width); | 273 FX_SAFE_DWORD pitch = CalculatePitch32(m_bpp, m_Width); |
| 274 if (!pitch.IsValid()) { | 274 if (!pitch.IsValid()) { |
| 275 return FALSE; | 275 return false; |
| 276 } | 276 } |
| 277 m_pLineBuf = FX_Alloc(uint8_t, pitch.ValueOrDie()); | 277 m_pLineBuf = FX_Alloc(uint8_t, pitch.ValueOrDie()); |
| 278 if (m_pColorSpace && bStdCS) { | 278 if (m_pColorSpace && bStdCS) { |
| 279 m_pColorSpace->EnableStdConversion(TRUE); | 279 m_pColorSpace->EnableStdConversion(true); |
| 280 } | 280 } |
| 281 LoadPalette(); | 281 LoadPalette(); |
| 282 if (m_bColorKey) { | 282 if (m_bColorKey) { |
| 283 m_bpp = 32; | 283 m_bpp = 32; |
| 284 m_AlphaFlag = 2; | 284 m_AlphaFlag = 2; |
| 285 pitch = CalculatePitch32(m_bpp, m_Width); | 285 pitch = CalculatePitch32(m_bpp, m_Width); |
| 286 if (!pitch.IsValid()) { | 286 if (!pitch.IsValid()) { |
| 287 return FALSE; | 287 return false; |
| 288 } | 288 } |
| 289 m_pMaskedLine = FX_Alloc(uint8_t, pitch.ValueOrDie()); | 289 m_pMaskedLine = FX_Alloc(uint8_t, pitch.ValueOrDie()); |
| 290 } | 290 } |
| 291 m_Pitch = pitch.ValueOrDie(); | 291 m_Pitch = pitch.ValueOrDie(); |
| 292 if (ppMask) { | 292 if (ppMask) { |
| 293 *ppMask = LoadMask(*pMatteColor); | 293 *ppMask = LoadMask(*pMatteColor); |
| 294 } | 294 } |
| 295 if (m_pColorSpace && bStdCS) { | 295 if (m_pColorSpace && bStdCS) { |
| 296 m_pColorSpace->EnableStdConversion(FALSE); | 296 m_pColorSpace->EnableStdConversion(false); |
| 297 } | 297 } |
| 298 return TRUE; | 298 return true; |
| 299 } | 299 } |
| 300 int CPDF_DIBSource::ContinueToLoadMask() | 300 int CPDF_DIBSource::ContinueToLoadMask() |
| 301 { | 301 { |
| 302 if (m_bImageMask) { | 302 if (m_bImageMask) { |
| 303 m_bpp = 1; | 303 m_bpp = 1; |
| 304 m_bpc = 1; | 304 m_bpc = 1; |
| 305 m_nComponents = 1; | 305 m_nComponents = 1; |
| 306 m_AlphaFlag = 1; | 306 m_AlphaFlag = 1; |
| 307 } else if (m_bpc * m_nComponents == 1) { | 307 } else if (m_bpc * m_nComponents == 1) { |
| 308 m_bpp = 1; | 308 m_bpp = 1; |
| 309 } else if (m_bpc * m_nComponents <= 8) { | 309 } else if (m_bpc * m_nComponents <= 8) { |
| 310 m_bpp = 8; | 310 m_bpp = 8; |
| 311 } else { | 311 } else { |
| 312 m_bpp = 24; | 312 m_bpp = 24; |
| 313 } | 313 } |
| 314 if (!m_bpc || !m_nComponents) { | 314 if (!m_bpc || !m_nComponents) { |
| 315 return 0; | 315 return 0; |
| 316 } | 316 } |
| 317 FX_SAFE_DWORD pitch = CalculatePitch32(m_bpp, m_Width); | 317 FX_SAFE_DWORD pitch = CalculatePitch32(m_bpp, m_Width); |
| 318 if (!pitch.IsValid()) { | 318 if (!pitch.IsValid()) { |
| 319 return 0; | 319 return 0; |
| 320 } | 320 } |
| 321 m_pLineBuf = FX_Alloc(uint8_t, pitch.ValueOrDie()); | 321 m_pLineBuf = FX_Alloc(uint8_t, pitch.ValueOrDie()); |
| 322 if (m_pColorSpace && m_bStdCS) { | 322 if (m_pColorSpace && m_bStdCS) { |
| 323 m_pColorSpace->EnableStdConversion(TRUE); | 323 m_pColorSpace->EnableStdConversion(true); |
| 324 } | 324 } |
| 325 LoadPalette(); | 325 LoadPalette(); |
| 326 if (m_bColorKey) { | 326 if (m_bColorKey) { |
| 327 m_bpp = 32; | 327 m_bpp = 32; |
| 328 m_AlphaFlag = 2; | 328 m_AlphaFlag = 2; |
| 329 pitch = CalculatePitch32(m_bpp, m_Width); | 329 pitch = CalculatePitch32(m_bpp, m_Width); |
| 330 if (!pitch.IsValid()) { | 330 if (!pitch.IsValid()) { |
| 331 return 0; | 331 return 0; |
| 332 } | 332 } |
| 333 m_pMaskedLine = FX_Alloc(uint8_t, pitch.ValueOrDie()); | 333 m_pMaskedLine = FX_Alloc(uint8_t, pitch.ValueOrDie()); |
| 334 } | 334 } |
| 335 m_Pitch = pitch.ValueOrDie(); | 335 m_Pitch = pitch.ValueOrDie(); |
| 336 return 1; | 336 return 1; |
| 337 } | 337 } |
| 338 int» CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, const CPDF_Strea
m* pStream, FX_BOOL bHasMask, | 338 int» CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, const CPDF_Strea
m* pStream, bool bHasMask, |
| 339 CPDF_Dictionary* pFormResources, CPDF_Dic
tionary* pPageResources, | 339 CPDF_Dictionary* pFormResources, CPDF_Dic
tionary* pPageResources, |
| 340 FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_
BOOL bLoadMask) | 340 bool bStdCS, FX_DWORD GroupFamily, bool b
LoadMask) |
| 341 { | 341 { |
| 342 if (pStream == NULL) { | 342 if (pStream == NULL) { |
| 343 return 0; | 343 return 0; |
| 344 } | 344 } |
| 345 m_pDocument = pDoc; | 345 m_pDocument = pDoc; |
| 346 m_pDict = pStream->GetDict(); | 346 m_pDict = pStream->GetDict(); |
| 347 m_pStream = pStream; | 347 m_pStream = pStream; |
| 348 m_bStdCS = bStdCS; | 348 m_bStdCS = bStdCS; |
| 349 m_bHasMask = bHasMask; | 349 m_bHasMask = bHasMask; |
| 350 m_Width = m_pDict->GetInteger(FX_BSTRC("Width")); | 350 m_Width = m_pDict->GetInteger(FX_BSTRC("Width")); |
| 351 m_Height = m_pDict->GetInteger(FX_BSTRC("Height")); | 351 m_Height = m_pDict->GetInteger(FX_BSTRC("Height")); |
| 352 if (m_Width <= 0 || m_Height <= 0 || m_Width > 0x01ffff || m_Height > 0x01ff
ff) { | 352 if (m_Width <= 0 || m_Height <= 0 || m_Width > 0x01ffff || m_Height > 0x01ff
ff) { |
| 353 return 0; | 353 return 0; |
| 354 } | 354 } |
| 355 m_GroupFamily = GroupFamily; | 355 m_GroupFamily = GroupFamily; |
| 356 m_bLoadMask = bLoadMask; | 356 m_bLoadMask = bLoadMask; |
| 357 if (!LoadColorInfo(m_pStream->GetObjNum() != 0 ? NULL : pFormResources, pPag
eResources)) { | 357 if (!LoadColorInfo(m_pStream->GetObjNum() != 0 ? NULL : pFormResources, pPag
eResources)) { |
| 358 return 0; | 358 return 0; |
| 359 } | 359 } |
| 360 if (m_bDoBpcCheck && (m_bpc == 0 || m_nComponents == 0)) { | 360 if (m_bDoBpcCheck && (m_bpc == 0 || m_nComponents == 0)) { |
| 361 return 0; | 361 return 0; |
| 362 } | 362 } |
| 363 FX_SAFE_DWORD src_pitch = | 363 FX_SAFE_DWORD src_pitch = |
| 364 CalculatePitch8(m_bpc, m_nComponents, m_Width, m_Height); | 364 CalculatePitch8(m_bpc, m_nComponents, m_Width, m_Height); |
| 365 if (!src_pitch.IsValid()) { | 365 if (!src_pitch.IsValid()) { |
| 366 return 0; | 366 return 0; |
| 367 } | 367 } |
| 368 m_pStreamAcc = new CPDF_StreamAcc; | 368 m_pStreamAcc = new CPDF_StreamAcc; |
| 369 m_pStreamAcc->LoadAllData(pStream, FALSE, src_pitch.ValueOrDie(), TRUE); | 369 m_pStreamAcc->LoadAllData(pStream, false, src_pitch.ValueOrDie(), true); |
| 370 if (m_pStreamAcc->GetSize() == 0 || m_pStreamAcc->GetData() == NULL) { | 370 if (m_pStreamAcc->GetSize() == 0 || m_pStreamAcc->GetData() == NULL) { |
| 371 return 0; | 371 return 0; |
| 372 } | 372 } |
| 373 int ret = CreateDecoder(); | 373 int ret = CreateDecoder(); |
| 374 if (ret != 1) { | 374 if (ret != 1) { |
| 375 if (!ret) { | 375 if (!ret) { |
| 376 return ret; | 376 return ret; |
| 377 } | 377 } |
| 378 if (!ContinueToLoadMask()) { | 378 if (!ContinueToLoadMask()) { |
| 379 return 0; | 379 return 0; |
| 380 } | 380 } |
| 381 if (m_bHasMask) { | 381 if (m_bHasMask) { |
| 382 StratLoadMask(); | 382 StratLoadMask(); |
| 383 } | 383 } |
| 384 return ret; | 384 return ret; |
| 385 } | 385 } |
| 386 if (!ContinueToLoadMask()) { | 386 if (!ContinueToLoadMask()) { |
| 387 return 0; | 387 return 0; |
| 388 } | 388 } |
| 389 if (m_bHasMask) { | 389 if (m_bHasMask) { |
| 390 ret = StratLoadMask(); | 390 ret = StratLoadMask(); |
| 391 } | 391 } |
| 392 if (ret == 2) { | 392 if (ret == 2) { |
| 393 return ret; | 393 return ret; |
| 394 } | 394 } |
| 395 if (m_pColorSpace && m_bStdCS) { | 395 if (m_pColorSpace && m_bStdCS) { |
| 396 m_pColorSpace->EnableStdConversion(FALSE); | 396 m_pColorSpace->EnableStdConversion(false); |
| 397 } | 397 } |
| 398 return ret; | 398 return ret; |
| 399 } | 399 } |
| 400 int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) | 400 int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) |
| 401 { | 401 { |
| 402 FXCODEC_STATUS ret; | 402 FXCODEC_STATUS ret; |
| 403 if (m_Status == 1) { | 403 if (m_Status == 1) { |
| 404 const CFX_ByteString& decoder = m_pStreamAcc->GetImageDecoder(); | 404 const CFX_ByteString& decoder = m_pStreamAcc->GetImageDecoder(); |
| 405 if (decoder == FX_BSTRC("JPXDecode")) { | 405 if (decoder == FX_BSTRC("JPXDecode")) { |
| 406 return 0; | 406 return 0; |
| 407 } | 407 } |
| 408 ICodec_Jbig2Module* pJbig2Module = CPDF_ModuleMgr::Get()->GetJbig2Module
(); | 408 ICodec_Jbig2Module* pJbig2Module = CPDF_ModuleMgr::Get()->GetJbig2Module
(); |
| 409 if (m_pJbig2Context == NULL) { | 409 if (m_pJbig2Context == NULL) { |
| 410 m_pJbig2Context = pJbig2Module->CreateJbig2Context(); | 410 m_pJbig2Context = pJbig2Module->CreateJbig2Context(); |
| 411 if (m_pStreamAcc->GetImageParam()) { | 411 if (m_pStreamAcc->GetImageParam()) { |
| 412 CPDF_Stream* pGlobals = m_pStreamAcc->GetImageParam()->GetStream
(FX_BSTRC("JBIG2Globals")); | 412 CPDF_Stream* pGlobals = m_pStreamAcc->GetImageParam()->GetStream
(FX_BSTRC("JBIG2Globals")); |
| 413 if (pGlobals) { | 413 if (pGlobals) { |
| 414 m_pGlobalStream = new CPDF_StreamAcc; | 414 m_pGlobalStream = new CPDF_StreamAcc; |
| 415 m_pGlobalStream->LoadAllData(pGlobals, FALSE); | 415 m_pGlobalStream->LoadAllData(pGlobals, false); |
| 416 } | 416 } |
| 417 } | 417 } |
| 418 ret = pJbig2Module->StartDecode(m_pJbig2Context, m_Width, m_Height,
m_pStreamAcc->GetData(), m_pStreamAcc->GetSize(), | 418 ret = pJbig2Module->StartDecode(m_pJbig2Context, m_Width, m_Height,
m_pStreamAcc->GetData(), m_pStreamAcc->GetSize(), |
| 419 m_pGlobalStream ? m_pGlobalStream->G
etData() : NULL, m_pGlobalStream ? m_pGlobalStream->GetSize() : 0, m_pCachedBitm
ap->GetBuffer(), | 419 m_pGlobalStream ? m_pGlobalStream->G
etData() : NULL, m_pGlobalStream ? m_pGlobalStream->GetSize() : 0, m_pCachedBitm
ap->GetBuffer(), |
| 420 m_pCachedBitmap->GetPitch(), pPause)
; | 420 m_pCachedBitmap->GetPitch(), pPause)
; |
| 421 if (ret < 0) { | 421 if (ret < 0) { |
| 422 m_pCachedBitmap.reset(); | 422 m_pCachedBitmap.reset(); |
| 423 delete m_pGlobalStream; | 423 delete m_pGlobalStream; |
| 424 m_pGlobalStream = NULL; | 424 m_pGlobalStream = NULL; |
| 425 pJbig2Module->DestroyJbig2Context(m_pJbig2Context); | 425 pJbig2Module->DestroyJbig2Context(m_pJbig2Context); |
| 426 m_pJbig2Context = NULL; | 426 m_pJbig2Context = NULL; |
| 427 return 0; | 427 return 0; |
| 428 } | 428 } |
| 429 if (ret == FXCODEC_STATUS_DECODE_TOBECONTINUE) { | 429 if (ret == FXCODEC_STATUS_DECODE_TOBECONTINUE) { |
| 430 return 2; | 430 return 2; |
| 431 } | 431 } |
| 432 int ret1 = 1; | 432 int ret1 = 1; |
| 433 if (m_bHasMask) { | 433 if (m_bHasMask) { |
| 434 ret1 = ContinueLoadMaskDIB(pPause); | 434 ret1 = ContinueLoadMaskDIB(pPause); |
| 435 m_Status = 2; | 435 m_Status = 2; |
| 436 } | 436 } |
| 437 if (ret1 == 2) { | 437 if (ret1 == 2) { |
| 438 return ret1; | 438 return ret1; |
| 439 } | 439 } |
| 440 if (m_pColorSpace && m_bStdCS) { | 440 if (m_pColorSpace && m_bStdCS) { |
| 441 m_pColorSpace->EnableStdConversion(FALSE); | 441 m_pColorSpace->EnableStdConversion(false); |
| 442 } | 442 } |
| 443 return ret1; | 443 return ret1; |
| 444 } | 444 } |
| 445 FXCODEC_STATUS ret = pJbig2Module->ContinueDecode(m_pJbig2Context, pPaus
e); | 445 FXCODEC_STATUS ret = pJbig2Module->ContinueDecode(m_pJbig2Context, pPaus
e); |
| 446 if (ret < 0) { | 446 if (ret < 0) { |
| 447 m_pCachedBitmap.reset(); | 447 m_pCachedBitmap.reset(); |
| 448 delete m_pGlobalStream; | 448 delete m_pGlobalStream; |
| 449 m_pGlobalStream = NULL; | 449 m_pGlobalStream = NULL; |
| 450 pJbig2Module->DestroyJbig2Context(m_pJbig2Context); | 450 pJbig2Module->DestroyJbig2Context(m_pJbig2Context); |
| 451 m_pJbig2Context = NULL; | 451 m_pJbig2Context = NULL; |
| 452 return 0; | 452 return 0; |
| 453 } | 453 } |
| 454 if (ret == FXCODEC_STATUS_DECODE_TOBECONTINUE) { | 454 if (ret == FXCODEC_STATUS_DECODE_TOBECONTINUE) { |
| 455 return 2; | 455 return 2; |
| 456 } | 456 } |
| 457 int ret1 = 1; | 457 int ret1 = 1; |
| 458 if (m_bHasMask) { | 458 if (m_bHasMask) { |
| 459 ret1 = ContinueLoadMaskDIB(pPause); | 459 ret1 = ContinueLoadMaskDIB(pPause); |
| 460 m_Status = 2; | 460 m_Status = 2; |
| 461 } | 461 } |
| 462 if (ret1 == 2) { | 462 if (ret1 == 2) { |
| 463 return ret1; | 463 return ret1; |
| 464 } | 464 } |
| 465 if (m_pColorSpace && m_bStdCS) { | 465 if (m_pColorSpace && m_bStdCS) { |
| 466 m_pColorSpace->EnableStdConversion(FALSE); | 466 m_pColorSpace->EnableStdConversion(false); |
| 467 } | 467 } |
| 468 return ret1; | 468 return ret1; |
| 469 } | 469 } |
| 470 if (m_Status == 2) { | 470 if (m_Status == 2) { |
| 471 return ContinueLoadMaskDIB(pPause); | 471 return ContinueLoadMaskDIB(pPause); |
| 472 } | 472 } |
| 473 return 0; | 473 return 0; |
| 474 } | 474 } |
| 475 FX_BOOL CPDF_DIBSource::LoadColorInfo(CPDF_Dictionary* pFormResources, CPDF_Dict
ionary* pPageResources) | 475 bool CPDF_DIBSource::LoadColorInfo(CPDF_Dictionary* pFormResources, CPDF_Diction
ary* pPageResources) |
| 476 { | 476 { |
| 477 m_bpc_orig = m_pDict->GetInteger(FX_BSTRC("BitsPerComponent")); | 477 m_bpc_orig = m_pDict->GetInteger(FX_BSTRC("BitsPerComponent")); |
| 478 if (m_pDict->GetInteger("ImageMask")) { | 478 if (m_pDict->GetInteger("ImageMask")) { |
| 479 m_bImageMask = TRUE; | 479 m_bImageMask = true; |
| 480 } | 480 } |
| 481 if (m_bImageMask || !m_pDict->KeyExist(FX_BSTRC("ColorSpace"))) { | 481 if (m_bImageMask || !m_pDict->KeyExist(FX_BSTRC("ColorSpace"))) { |
| 482 if (!m_bImageMask) { | 482 if (!m_bImageMask) { |
| 483 CPDF_Object* pFilter = m_pDict->GetElementValue(FX_BSTRC("Filter")); | 483 CPDF_Object* pFilter = m_pDict->GetElementValue(FX_BSTRC("Filter")); |
| 484 if (pFilter) { | 484 if (pFilter) { |
| 485 CFX_ByteString filter; | 485 CFX_ByteString filter; |
| 486 if (pFilter->GetType() == PDFOBJ_NAME) { | 486 if (pFilter->GetType() == PDFOBJ_NAME) { |
| 487 filter = pFilter->GetString(); | 487 filter = pFilter->GetString(); |
| 488 if (filter == FX_BSTRC("JPXDecode")) { | 488 if (filter == FX_BSTRC("JPXDecode")) { |
| 489 m_bDoBpcCheck = FALSE; | 489 m_bDoBpcCheck = false; |
| 490 return TRUE; | 490 return true; |
| 491 } | 491 } |
| 492 } else if (pFilter->GetType() == PDFOBJ_ARRAY) { | 492 } else if (pFilter->GetType() == PDFOBJ_ARRAY) { |
| 493 CPDF_Array* pArray = (CPDF_Array*)pFilter; | 493 CPDF_Array* pArray = (CPDF_Array*)pFilter; |
| 494 if (pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("J
PXDecode")) { | 494 if (pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("J
PXDecode")) { |
| 495 m_bDoBpcCheck = FALSE; | 495 m_bDoBpcCheck = false; |
| 496 return TRUE; | 496 return true; |
| 497 } | 497 } |
| 498 } | 498 } |
| 499 } | 499 } |
| 500 } | 500 } |
| 501 m_bImageMask = TRUE; | 501 m_bImageMask = true; |
| 502 m_bpc = m_nComponents = 1; | 502 m_bpc = m_nComponents = 1; |
| 503 CPDF_Array* pDecode = m_pDict->GetArray(FX_BSTRC("Decode")); | 503 CPDF_Array* pDecode = m_pDict->GetArray(FX_BSTRC("Decode")); |
| 504 m_bDefaultDecode = pDecode == NULL || pDecode->GetInteger(0) == 0; | 504 m_bDefaultDecode = pDecode == NULL || pDecode->GetInteger(0) == 0; |
| 505 return TRUE; | 505 return true; |
| 506 } | 506 } |
| 507 CPDF_Object* pCSObj = m_pDict->GetElementValue(FX_BSTRC("ColorSpace")); | 507 CPDF_Object* pCSObj = m_pDict->GetElementValue(FX_BSTRC("ColorSpace")); |
| 508 if (pCSObj == NULL) { | 508 if (pCSObj == NULL) { |
| 509 return FALSE; | 509 return false; |
| 510 } | 510 } |
| 511 CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData(); | 511 CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData(); |
| 512 if (pFormResources) { | 512 if (pFormResources) { |
| 513 m_pColorSpace = pDocPageData->GetColorSpace(pCSObj, pFormResources); | 513 m_pColorSpace = pDocPageData->GetColorSpace(pCSObj, pFormResources); |
| 514 } | 514 } |
| 515 if (m_pColorSpace == NULL) { | 515 if (m_pColorSpace == NULL) { |
| 516 m_pColorSpace = pDocPageData->GetColorSpace(pCSObj, pPageResources); | 516 m_pColorSpace = pDocPageData->GetColorSpace(pCSObj, pPageResources); |
| 517 } | 517 } |
| 518 if (m_pColorSpace == NULL) { | 518 if (m_pColorSpace == NULL) { |
| 519 return FALSE; | 519 return false; |
| 520 } | 520 } |
| 521 m_Family = m_pColorSpace->GetFamily(); | 521 m_Family = m_pColorSpace->GetFamily(); |
| 522 m_nComponents = m_pColorSpace->CountComponents(); | 522 m_nComponents = m_pColorSpace->CountComponents(); |
| 523 if (m_Family == PDFCS_ICCBASED && pCSObj->GetType() == PDFOBJ_NAME) { | 523 if (m_Family == PDFCS_ICCBASED && pCSObj->GetType() == PDFOBJ_NAME) { |
| 524 CFX_ByteString cs = pCSObj->GetString(); | 524 CFX_ByteString cs = pCSObj->GetString(); |
| 525 if (cs == FX_BSTRC("DeviceGray")) { | 525 if (cs == FX_BSTRC("DeviceGray")) { |
| 526 m_nComponents = 1; | 526 m_nComponents = 1; |
| 527 } else if (cs == FX_BSTRC("DeviceRGB")) { | 527 } else if (cs == FX_BSTRC("DeviceRGB")) { |
| 528 m_nComponents = 3; | 528 m_nComponents = 3; |
| 529 } else if (cs == FX_BSTRC("DeviceCMYK")) { | 529 } else if (cs == FX_BSTRC("DeviceCMYK")) { |
| 530 m_nComponents = 4; | 530 m_nComponents = 4; |
| 531 } | 531 } |
| 532 } | 532 } |
| 533 ValidateDictParam(); | 533 ValidateDictParam(); |
| 534 m_pCompData = GetDecodeAndMaskArray(m_bDefaultDecode, m_bColorKey); | 534 m_pCompData = GetDecodeAndMaskArray(m_bDefaultDecode, m_bColorKey); |
| 535 if (m_pCompData == NULL) { | 535 if (m_pCompData == NULL) { |
| 536 return FALSE; | 536 return false; |
| 537 } | 537 } |
| 538 return TRUE; | 538 return true; |
| 539 } | 539 } |
| 540 DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, FX
_BOOL& bColorKey) | 540 DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(bool& bDefaultDecode, bool&
bColorKey) |
| 541 { | 541 { |
| 542 if (m_pColorSpace == NULL) { | 542 if (m_pColorSpace == NULL) { |
| 543 return NULL; | 543 return NULL; |
| 544 } | 544 } |
| 545 DIB_COMP_DATA* pCompData = FX_Alloc(DIB_COMP_DATA, m_nComponents); | 545 DIB_COMP_DATA* pCompData = FX_Alloc(DIB_COMP_DATA, m_nComponents); |
| 546 int max_data = (1 << m_bpc) - 1; | 546 int max_data = (1 << m_bpc) - 1; |
| 547 CPDF_Array* pDecode = m_pDict->GetArray(FX_BSTRC("Decode")); | 547 CPDF_Array* pDecode = m_pDict->GetArray(FX_BSTRC("Decode")); |
| 548 if (pDecode) { | 548 if (pDecode) { |
| 549 for (FX_DWORD i = 0; i < m_nComponents; i ++) { | 549 for (FX_DWORD i = 0; i < m_nComponents; i ++) { |
| 550 pCompData[i].m_DecodeMin = pDecode->GetNumber(i * 2); | 550 pCompData[i].m_DecodeMin = pDecode->GetNumber(i * 2); |
| 551 FX_FLOAT max = pDecode->GetNumber(i * 2 + 1); | 551 FX_FLOAT max = pDecode->GetNumber(i * 2 + 1); |
| 552 pCompData[i].m_DecodeStep = (max - pCompData[i].m_DecodeMin) / max_d
ata; | 552 pCompData[i].m_DecodeStep = (max - pCompData[i].m_DecodeMin) / max_d
ata; |
| 553 FX_FLOAT def_value, def_min, def_max; | 553 FX_FLOAT def_value, def_min, def_max; |
| 554 m_pColorSpace->GetDefaultValue(i, def_value, def_min, def_max); | 554 m_pColorSpace->GetDefaultValue(i, def_value, def_min, def_max); |
| 555 if (m_Family == PDFCS_INDEXED) { | 555 if (m_Family == PDFCS_INDEXED) { |
| 556 def_max = (FX_FLOAT)max_data; | 556 def_max = (FX_FLOAT)max_data; |
| 557 } | 557 } |
| 558 if (def_min != pCompData[i].m_DecodeMin || def_max != max) { | 558 if (def_min != pCompData[i].m_DecodeMin || def_max != max) { |
| 559 bDefaultDecode = FALSE; | 559 bDefaultDecode = false; |
| 560 } | 560 } |
| 561 } | 561 } |
| 562 } else { | 562 } else { |
| 563 for (FX_DWORD i = 0; i < m_nComponents; i ++) { | 563 for (FX_DWORD i = 0; i < m_nComponents; i ++) { |
| 564 FX_FLOAT def_value; | 564 FX_FLOAT def_value; |
| 565 m_pColorSpace->GetDefaultValue(i, def_value, pCompData[i].m_DecodeMi
n, pCompData[i].m_DecodeStep); | 565 m_pColorSpace->GetDefaultValue(i, def_value, pCompData[i].m_DecodeMi
n, pCompData[i].m_DecodeStep); |
| 566 if (m_Family == PDFCS_INDEXED) { | 566 if (m_Family == PDFCS_INDEXED) { |
| 567 pCompData[i].m_DecodeStep = (FX_FLOAT)max_data; | 567 pCompData[i].m_DecodeStep = (FX_FLOAT)max_data; |
| 568 } | 568 } |
| 569 pCompData[i].m_DecodeStep = (pCompData[i].m_DecodeStep - pCompData[i
].m_DecodeMin) / max_data; | 569 pCompData[i].m_DecodeStep = (pCompData[i].m_DecodeStep - pCompData[i
].m_DecodeMin) / max_data; |
| 570 } | 570 } |
| 571 } | 571 } |
| 572 if (!m_pDict->KeyExist(FX_BSTRC("SMask"))) { | 572 if (!m_pDict->KeyExist(FX_BSTRC("SMask"))) { |
| 573 CPDF_Object* pMask = m_pDict->GetElementValue(FX_BSTRC("Mask")); | 573 CPDF_Object* pMask = m_pDict->GetElementValue(FX_BSTRC("Mask")); |
| 574 if (pMask == NULL) { | 574 if (pMask == NULL) { |
| 575 return pCompData; | 575 return pCompData; |
| 576 } | 576 } |
| 577 if (pMask->GetType() == PDFOBJ_ARRAY) { | 577 if (pMask->GetType() == PDFOBJ_ARRAY) { |
| 578 CPDF_Array* pArray = (CPDF_Array*)pMask; | 578 CPDF_Array* pArray = (CPDF_Array*)pMask; |
| 579 if (pArray->GetCount() >= m_nComponents * 2) { | 579 if (pArray->GetCount() >= m_nComponents * 2) { |
| 580 for (FX_DWORD i = 0; i < m_nComponents; i++) { | 580 for (FX_DWORD i = 0; i < m_nComponents; i++) { |
| 581 int min_num = pArray->GetInteger(i * 2); | 581 int min_num = pArray->GetInteger(i * 2); |
| 582 int max_num = pArray->GetInteger(i * 2 + 1); | 582 int max_num = pArray->GetInteger(i * 2 + 1); |
| 583 pCompData[i].m_ColorKeyMin = FX_MAX(min_num, 0); | 583 pCompData[i].m_ColorKeyMin = FX_MAX(min_num, 0); |
| 584 pCompData[i].m_ColorKeyMax = FX_MIN(max_num, max_data); | 584 pCompData[i].m_ColorKeyMax = FX_MIN(max_num, max_data); |
| 585 } | 585 } |
| 586 } | 586 } |
| 587 bColorKey = TRUE; | 587 bColorKey = true; |
| 588 } | 588 } |
| 589 } | 589 } |
| 590 return pCompData; | 590 return pCompData; |
| 591 } | 591 } |
| 592 ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(const uint8_t* src_buf, FX_DWOR
D src_size, int width, int height, | 592 ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(const uint8_t* src_buf, FX_DWOR
D src_size, int width, int height, |
| 593 const CPDF_Dictionary* pParams); | 593 const CPDF_Dictionary* pParams); |
| 594 ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(const uint8_t* src_buf, FX_DW
ORD src_size, int width, int height, | 594 ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(const uint8_t* src_buf, FX_DW
ORD src_size, int width, int height, |
| 595 int nComps, int bpc, const CPDF_Dictionary* pParams); | 595 int nComps, int bpc, const CPDF_Dictionary* pParams); |
| 596 int CPDF_DIBSource::CreateDecoder() | 596 int CPDF_DIBSource::CreateDecoder() |
| 597 { | 597 { |
| 598 const CFX_ByteString& decoder = m_pStreamAcc->GetImageDecoder(); | 598 const CFX_ByteString& decoder = m_pStreamAcc->GetImageDecoder(); |
| 599 if (decoder.IsEmpty()) { | 599 if (decoder.IsEmpty()) { |
| 600 return 1; | 600 return 1; |
| 601 } | 601 } |
| 602 if (m_bDoBpcCheck && m_bpc == 0) { | 602 if (m_bDoBpcCheck && m_bpc == 0) { |
| 603 return 0; | 603 return 0; |
| 604 } | 604 } |
| 605 const uint8_t* src_data = m_pStreamAcc->GetData(); | 605 const uint8_t* src_data = m_pStreamAcc->GetData(); |
| 606 FX_DWORD src_size = m_pStreamAcc->GetSize(); | 606 FX_DWORD src_size = m_pStreamAcc->GetSize(); |
| 607 const CPDF_Dictionary* pParams = m_pStreamAcc->GetImageParam(); | 607 const CPDF_Dictionary* pParams = m_pStreamAcc->GetImageParam(); |
| 608 if (decoder == FX_BSTRC("CCITTFaxDecode")) { | 608 if (decoder == FX_BSTRC("CCITTFaxDecode")) { |
| 609 m_pDecoder = FPDFAPI_CreateFaxDecoder(src_data, src_size, m_Width, m_Hei
ght, pParams); | 609 m_pDecoder = FPDFAPI_CreateFaxDecoder(src_data, src_size, m_Width, m_Hei
ght, pParams); |
| 610 } else if (decoder == FX_BSTRC("DCTDecode")) { | 610 } else if (decoder == FX_BSTRC("DCTDecode")) { |
| 611 m_pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder( | 611 m_pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder( |
| 612 src_data, src_size, m_Width, m_Height, m_nComponents, | 612 src_data, src_size, m_Width, m_Height, m_nComponents, |
| 613 pParams ? pParams->GetInteger("ColorTransform", 1) : 1); | 613 pParams ? pParams->GetInteger("ColorTransform", 1) : 1); |
| 614 if (!m_pDecoder) { | 614 if (!m_pDecoder) { |
| 615 FX_BOOL bTransform = FALSE; | 615 bool bTransform = false; |
| 616 int comps, bpc; | 616 int comps, bpc; |
| 617 ICodec_JpegModule* pJpegModule = CPDF_ModuleMgr::Get()->GetJpegModul
e(); | 617 ICodec_JpegModule* pJpegModule = CPDF_ModuleMgr::Get()->GetJpegModul
e(); |
| 618 if (pJpegModule->LoadInfo(src_data, src_size, m_Width, m_Height, com
ps, bpc, bTransform)) { | 618 if (pJpegModule->LoadInfo(src_data, src_size, m_Width, m_Height, com
ps, bpc, bTransform)) { |
| 619 if (m_nComponents != comps) { | 619 if (m_nComponents != comps) { |
| 620 FX_Free(m_pCompData); | 620 FX_Free(m_pCompData); |
| 621 m_nComponents = comps; | 621 m_nComponents = comps; |
| 622 if (m_Family == PDFCS_LAB && m_nComponents != 3) { | 622 if (m_Family == PDFCS_LAB && m_nComponents != 3) { |
| 623 m_pCompData = NULL; | 623 m_pCompData = NULL; |
| 624 return 0; | 624 return 0; |
| 625 } | 625 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 FX_DWORD width = 0; | 686 FX_DWORD width = 0; |
| 687 FX_DWORD height = 0; | 687 FX_DWORD height = 0; |
| 688 FX_DWORD codestream_nComps = 0; | 688 FX_DWORD codestream_nComps = 0; |
| 689 FX_DWORD image_nComps = 0; | 689 FX_DWORD image_nComps = 0; |
| 690 pJpxModule->GetImageInfo(context->context(), width, height, | 690 pJpxModule->GetImageInfo(context->context(), width, height, |
| 691 codestream_nComps, image_nComps); | 691 codestream_nComps, image_nComps); |
| 692 if ((int)width < m_Width || (int)height < m_Height) | 692 if ((int)width < m_Width || (int)height < m_Height) |
| 693 return; | 693 return; |
| 694 | 694 |
| 695 int output_nComps; | 695 int output_nComps; |
| 696 FX_BOOL bTranslateColor; | 696 bool bTranslateColor; |
| 697 FX_BOOL bSwapRGB = FALSE; | 697 bool bSwapRGB = false; |
| 698 if (m_pColorSpace) { | 698 if (m_pColorSpace) { |
| 699 if (codestream_nComps != (FX_DWORD)m_pColorSpace->CountComponents()) | 699 if (codestream_nComps != (FX_DWORD)m_pColorSpace->CountComponents()) |
| 700 return; | 700 return; |
| 701 output_nComps = codestream_nComps; | 701 output_nComps = codestream_nComps; |
| 702 bTranslateColor = FALSE; | 702 bTranslateColor = false; |
| 703 if (m_pColorSpace == CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB)) { | 703 if (m_pColorSpace == CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB)) { |
| 704 bSwapRGB = TRUE; | 704 bSwapRGB = true; |
| 705 m_pColorSpace = nullptr; | 705 m_pColorSpace = nullptr; |
| 706 } | 706 } |
| 707 } else { | 707 } else { |
| 708 bTranslateColor = TRUE; | 708 bTranslateColor = true; |
| 709 if (image_nComps) { | 709 if (image_nComps) { |
| 710 output_nComps = image_nComps; | 710 output_nComps = image_nComps; |
| 711 } else { | 711 } else { |
| 712 output_nComps = codestream_nComps; | 712 output_nComps = codestream_nComps; |
| 713 } | 713 } |
| 714 if (output_nComps == 3) { | 714 if (output_nComps == 3) { |
| 715 bSwapRGB = TRUE; | 715 bSwapRGB = true; |
| 716 } else if (output_nComps == 4) { | 716 } else if (output_nComps == 4) { |
| 717 m_pColorSpace = CPDF_ColorSpace::GetStockCS(PDFCS_DEVICECMYK); | 717 m_pColorSpace = CPDF_ColorSpace::GetStockCS(PDFCS_DEVICECMYK); |
| 718 bTranslateColor = FALSE; | 718 bTranslateColor = false; |
| 719 } | 719 } |
| 720 m_nComponents = output_nComps; | 720 m_nComponents = output_nComps; |
| 721 } | 721 } |
| 722 FXDIB_Format format; | 722 FXDIB_Format format; |
| 723 if (output_nComps == 1) { | 723 if (output_nComps == 1) { |
| 724 format = FXDIB_8bppRgb; | 724 format = FXDIB_8bppRgb; |
| 725 } else if (output_nComps <= 3) { | 725 } else if (output_nComps <= 3) { |
| 726 format = FXDIB_Rgb; | 726 format = FXDIB_Rgb; |
| 727 } else if (output_nComps == 4) { | 727 } else if (output_nComps == 4) { |
| 728 format = FXDIB_Rgb32; | 728 format = FXDIB_Rgb32; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 int CPDF_DIBSource::ContinueLoadMaskDIB(IFX_Pause* pPause) | 822 int CPDF_DIBSource::ContinueLoadMaskDIB(IFX_Pause* pPause) |
| 823 { | 823 { |
| 824 if (m_pMask == NULL) { | 824 if (m_pMask == NULL) { |
| 825 return 1; | 825 return 1; |
| 826 } | 826 } |
| 827 int ret = m_pMask->ContinueLoadDIBSource(pPause); | 827 int ret = m_pMask->ContinueLoadDIBSource(pPause); |
| 828 if (ret == 2) { | 828 if (ret == 2) { |
| 829 return ret; | 829 return ret; |
| 830 } | 830 } |
| 831 if (m_pColorSpace && m_bStdCS) { | 831 if (m_pColorSpace && m_bStdCS) { |
| 832 m_pColorSpace->EnableStdConversion(FALSE); | 832 m_pColorSpace->EnableStdConversion(false); |
| 833 } | 833 } |
| 834 if (!ret) { | 834 if (!ret) { |
| 835 delete m_pMask; | 835 delete m_pMask; |
| 836 m_pMask = NULL; | 836 m_pMask = NULL; |
| 837 return ret; | 837 return ret; |
| 838 } | 838 } |
| 839 return 1; | 839 return 1; |
| 840 } | 840 } |
| 841 CPDF_DIBSource* CPDF_DIBSource::DetachMask() | 841 CPDF_DIBSource* CPDF_DIBSource::DetachMask() |
| 842 { | 842 { |
| 843 CPDF_DIBSource* pDIBSource = m_pMask; | 843 CPDF_DIBSource* pDIBSource = m_pMask; |
| 844 m_pMask = NULL; | 844 m_pMask = NULL; |
| 845 return pDIBSource; | 845 return pDIBSource; |
| 846 } | 846 } |
| 847 CPDF_DIBSource* CPDF_DIBSource::LoadMaskDIB(CPDF_Stream* pMask) | 847 CPDF_DIBSource* CPDF_DIBSource::LoadMaskDIB(CPDF_Stream* pMask) |
| 848 { | 848 { |
| 849 CPDF_DIBSource* pMaskSource = new CPDF_DIBSource; | 849 CPDF_DIBSource* pMaskSource = new CPDF_DIBSource; |
| 850 if (!pMaskSource->Load(m_pDocument, pMask, NULL, NULL, NULL, NULL, TRUE)) { | 850 if (!pMaskSource->Load(m_pDocument, pMask, NULL, NULL, NULL, NULL, true)) { |
| 851 delete pMaskSource; | 851 delete pMaskSource; |
| 852 return NULL; | 852 return NULL; |
| 853 } | 853 } |
| 854 return pMaskSource; | 854 return pMaskSource; |
| 855 } | 855 } |
| 856 int CPDF_DIBSource::StartLoadMaskDIB() | 856 int CPDF_DIBSource::StartLoadMaskDIB() |
| 857 { | 857 { |
| 858 m_pMask = new CPDF_DIBSource; | 858 m_pMask = new CPDF_DIBSource; |
| 859 int ret = m_pMask->StartLoadDIBSource(m_pDocument, (CPDF_Stream*)m_pMaskStre
am, FALSE, NULL, NULL, TRUE); | 859 int ret = m_pMask->StartLoadDIBSource(m_pDocument, (CPDF_Stream*)m_pMaskStre
am, false, NULL, NULL, true); |
| 860 if (ret == 2) { | 860 if (ret == 2) { |
| 861 if (m_Status == 0) { | 861 if (m_Status == 0) { |
| 862 m_Status = 2; | 862 m_Status = 2; |
| 863 } | 863 } |
| 864 return 2; | 864 return 2; |
| 865 } | 865 } |
| 866 if (!ret) { | 866 if (!ret) { |
| 867 delete m_pMask; | 867 delete m_pMask; |
| 868 m_pMask = NULL; | 868 m_pMask = NULL; |
| 869 return 1; | 869 return 1; |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 for (int col = 0; col < m_Width; col ++) { | 1202 for (int col = 0; col < m_Width; col ++) { |
| 1203 *pDestPixel++ = *pSrcPixel++; | 1203 *pDestPixel++ = *pSrcPixel++; |
| 1204 *pDestPixel++ = *pSrcPixel++; | 1204 *pDestPixel++ = *pSrcPixel++; |
| 1205 *pDestPixel++ = *pSrcPixel++; | 1205 *pDestPixel++ = *pSrcPixel++; |
| 1206 pDestPixel ++; | 1206 pDestPixel ++; |
| 1207 } | 1207 } |
| 1208 return m_pMaskedLine; | 1208 return m_pMaskedLine; |
| 1209 } | 1209 } |
| 1210 return pSrcLine; | 1210 return pSrcLine; |
| 1211 } | 1211 } |
| 1212 FX_BOOL CPDF_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const | 1212 bool CPDF_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const |
| 1213 { | 1213 { |
| 1214 if (m_pDecoder) { | 1214 if (m_pDecoder) { |
| 1215 return m_pDecoder->SkipToScanline(line, pPause); | 1215 return m_pDecoder->SkipToScanline(line, pPause); |
| 1216 } | 1216 } |
| 1217 return FALSE; | 1217 return false; |
| 1218 } | 1218 } |
| 1219 void CPDF_DIBSource::DownSampleScanline(int line, uint8_t* dest_scan, int dest_b
pp, | 1219 void CPDF_DIBSource::DownSampleScanline(int line, uint8_t* dest_scan, int dest_b
pp, |
| 1220 int dest_width, FX_BOOL bFlipX, int clip
_left, int clip_width) const | 1220 int dest_width, bool bFlipX, int clip_le
ft, int clip_width) const |
| 1221 { | 1221 { |
| 1222 if (line < 0 || dest_scan == NULL || dest_bpp <= 0 || | 1222 if (line < 0 || dest_scan == NULL || dest_bpp <= 0 || |
| 1223 dest_width <= 0 || clip_left < 0 || clip_width <= 0) { | 1223 dest_width <= 0 || clip_left < 0 || clip_width <= 0) { |
| 1224 return; | 1224 return; |
| 1225 } | 1225 } |
| 1226 | 1226 |
| 1227 FX_DWORD src_width = m_Width; | 1227 FX_DWORD src_width = m_Width; |
| 1228 FX_SAFE_DWORD pitch = CalculatePitch8(m_bpc, m_nComponents, m_Width, 1); | 1228 FX_SAFE_DWORD pitch = CalculatePitch8(m_bpc, m_nComponents, m_Width, 1); |
| 1229 if (!pitch.IsValid()) { | 1229 if (!pitch.IsValid()) { |
| 1230 return; | 1230 return; |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1473 } | 1473 } |
| 1474 CPDF_ProgressiveImageLoaderHandle::CPDF_ProgressiveImageLoaderHandle() | 1474 CPDF_ProgressiveImageLoaderHandle::CPDF_ProgressiveImageLoaderHandle() |
| 1475 { | 1475 { |
| 1476 m_pImageLoader = NULL; | 1476 m_pImageLoader = NULL; |
| 1477 m_pCache = NULL; | 1477 m_pCache = NULL; |
| 1478 m_pImage = NULL; | 1478 m_pImage = NULL; |
| 1479 } | 1479 } |
| 1480 CPDF_ProgressiveImageLoaderHandle::~CPDF_ProgressiveImageLoaderHandle() | 1480 CPDF_ProgressiveImageLoaderHandle::~CPDF_ProgressiveImageLoaderHandle() |
| 1481 { | 1481 { |
| 1482 } | 1482 } |
| 1483 FX_BOOL CPDF_ProgressiveImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader,
const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS, F
X_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_
t nDownsampleWidth, int32_t nDownsampleHeight) | 1483 bool CPDF_ProgressiveImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader, co
nst CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, bool bStdCS, FX_DWOR
D GroupFamily, bool bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsa
mpleWidth, int32_t nDownsampleHeight) |
| 1484 { | 1484 { |
| 1485 m_pImageLoader = pImageLoader; | 1485 m_pImageLoader = pImageLoader; |
| 1486 m_pCache = pCache; | 1486 m_pCache = pCache; |
| 1487 m_pImage = (CPDF_ImageObject*)pImage; | 1487 m_pImage = (CPDF_ImageObject*)pImage; |
| 1488 m_nDownsampleWidth = nDownsampleWidth; | 1488 m_nDownsampleWidth = nDownsampleWidth; |
| 1489 m_nDownsampleHeight = nDownsampleHeight; | 1489 m_nDownsampleHeight = nDownsampleHeight; |
| 1490 FX_BOOL ret; | 1490 bool ret; |
| 1491 if (pCache) { | 1491 if (pCache) { |
| 1492 ret = pCache->StartGetCachedBitmap(pImage->m_pImage->GetStream(), bStdCS
, GroupFamily, bLoadMask, pRenderStatus, m_nDownsampleWidth, m_nDownsampleHeight
); | 1492 ret = pCache->StartGetCachedBitmap(pImage->m_pImage->GetStream(), bStdCS
, GroupFamily, bLoadMask, pRenderStatus, m_nDownsampleWidth, m_nDownsampleHeight
); |
| 1493 if (ret == FALSE) { | 1493 if (ret == false) { |
| 1494 m_pImageLoader->m_bCached = TRUE; | 1494 m_pImageLoader->m_bCached = true; |
| 1495 m_pImageLoader->m_pBitmap = pCache->m_pCurImageCache->DetachBitmap()
; | 1495 m_pImageLoader->m_pBitmap = pCache->m_pCurImageCache->DetachBitmap()
; |
| 1496 m_pImageLoader->m_pMask = pCache->m_pCurImageCache->DetachMask(); | 1496 m_pImageLoader->m_pMask = pCache->m_pCurImageCache->DetachMask(); |
| 1497 m_pImageLoader->m_MatteColor = pCache->m_pCurImageCache->m_MatteColo
r; | 1497 m_pImageLoader->m_MatteColor = pCache->m_pCurImageCache->m_MatteColo
r; |
| 1498 } | 1498 } |
| 1499 } else { | 1499 } else { |
| 1500 ret = pImage->m_pImage->StartLoadDIBSource(pRenderStatus->m_pFormResourc
e, pRenderStatus->m_pPageResource, bStdCS, GroupFamily, bLoadMask); | 1500 ret = pImage->m_pImage->StartLoadDIBSource(pRenderStatus->m_pFormResourc
e, pRenderStatus->m_pPageResource, bStdCS, GroupFamily, bLoadMask); |
| 1501 if (ret == FALSE) { | 1501 if (ret == false) { |
| 1502 m_pImageLoader->m_bCached = FALSE; | 1502 m_pImageLoader->m_bCached = false; |
| 1503 m_pImageLoader->m_pBitmap = m_pImage->m_pImage->DetachBitmap(); | 1503 m_pImageLoader->m_pBitmap = m_pImage->m_pImage->DetachBitmap(); |
| 1504 m_pImageLoader->m_pMask = m_pImage->m_pImage->DetachMask(); | 1504 m_pImageLoader->m_pMask = m_pImage->m_pImage->DetachMask(); |
| 1505 m_pImageLoader->m_MatteColor = m_pImage->m_pImage->m_MatteColor; | 1505 m_pImageLoader->m_MatteColor = m_pImage->m_pImage->m_MatteColor; |
| 1506 } | 1506 } |
| 1507 } | 1507 } |
| 1508 return ret; | 1508 return ret; |
| 1509 } | 1509 } |
| 1510 FX_BOOL CPDF_ProgressiveImageLoaderHandle::Continue(IFX_Pause* pPause) | 1510 bool CPDF_ProgressiveImageLoaderHandle::Continue(IFX_Pause* pPause) |
| 1511 { | 1511 { |
| 1512 FX_BOOL ret; | 1512 bool ret; |
| 1513 if (m_pCache) { | 1513 if (m_pCache) { |
| 1514 ret = m_pCache->Continue(pPause); | 1514 ret = m_pCache->Continue(pPause); |
| 1515 if (ret == FALSE) { | 1515 if (ret == false) { |
| 1516 m_pImageLoader->m_bCached = TRUE; | 1516 m_pImageLoader->m_bCached = true; |
| 1517 m_pImageLoader->m_pBitmap = m_pCache->m_pCurImageCache->DetachBitmap
(); | 1517 m_pImageLoader->m_pBitmap = m_pCache->m_pCurImageCache->DetachBitmap
(); |
| 1518 m_pImageLoader->m_pMask = m_pCache->m_pCurImageCache->DetachMask(); | 1518 m_pImageLoader->m_pMask = m_pCache->m_pCurImageCache->DetachMask(); |
| 1519 m_pImageLoader->m_MatteColor = m_pCache->m_pCurImageCache->m_MatteCo
lor; | 1519 m_pImageLoader->m_MatteColor = m_pCache->m_pCurImageCache->m_MatteCo
lor; |
| 1520 } | 1520 } |
| 1521 } else { | 1521 } else { |
| 1522 ret = m_pImage->m_pImage->Continue(pPause); | 1522 ret = m_pImage->m_pImage->Continue(pPause); |
| 1523 if (ret == FALSE) { | 1523 if (ret == false) { |
| 1524 m_pImageLoader->m_bCached = FALSE; | 1524 m_pImageLoader->m_bCached = false; |
| 1525 m_pImageLoader->m_pBitmap = m_pImage->m_pImage->DetachBitmap(); | 1525 m_pImageLoader->m_pBitmap = m_pImage->m_pImage->DetachBitmap(); |
| 1526 m_pImageLoader->m_pMask = m_pImage->m_pImage->DetachMask(); | 1526 m_pImageLoader->m_pMask = m_pImage->m_pImage->DetachMask(); |
| 1527 m_pImageLoader->m_MatteColor = m_pImage->m_pImage->m_MatteColor; | 1527 m_pImageLoader->m_MatteColor = m_pImage->m_pImage->m_MatteColor; |
| 1528 } | 1528 } |
| 1529 } | 1529 } |
| 1530 return ret; | 1530 return ret; |
| 1531 } | 1531 } |
| 1532 FX_BOOL CPDF_ImageLoader::Load(const CPDF_ImageObject* pImage, CPDF_PageRenderCa
che* pCache, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_Rende
rStatus* pRenderStatus) | 1532 bool CPDF_ImageLoader::Load(const CPDF_ImageObject* pImage, CPDF_PageRenderCache
* pCache, bool bStdCS, FX_DWORD GroupFamily, bool bLoadMask, CPDF_RenderStatus*
pRenderStatus) |
| 1533 { | 1533 { |
| 1534 if (pImage == NULL) { | 1534 if (pImage == NULL) { |
| 1535 return FALSE; | 1535 return false; |
| 1536 } | 1536 } |
| 1537 if (pCache) { | 1537 if (pCache) { |
| 1538 pCache->GetCachedBitmap(pImage->m_pImage->GetStream(), m_pBitmap, m_pMas
k, m_MatteColor, bStdCS, GroupFamily, bLoadMask, pRenderStatus, m_nDownsampleWid
th, m_nDownsampleHeight); | 1538 pCache->GetCachedBitmap(pImage->m_pImage->GetStream(), m_pBitmap, m_pMas
k, m_MatteColor, bStdCS, GroupFamily, bLoadMask, pRenderStatus, m_nDownsampleWid
th, m_nDownsampleHeight); |
| 1539 m_bCached = TRUE; | 1539 m_bCached = true; |
| 1540 } else { | 1540 } else { |
| 1541 m_pBitmap = pImage->m_pImage->LoadDIBSource(&m_pMask, &m_MatteColor, bSt
dCS, GroupFamily, bLoadMask); | 1541 m_pBitmap = pImage->m_pImage->LoadDIBSource(&m_pMask, &m_MatteColor, bSt
dCS, GroupFamily, bLoadMask); |
| 1542 m_bCached = FALSE; | 1542 m_bCached = false; |
| 1543 } | 1543 } |
| 1544 return FALSE; | 1544 return false; |
| 1545 } | 1545 } |
| 1546 FX_BOOL CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_Pa
geRenderCache* pCache, void*& LoadHandle, FX_BOOL bStdCS, FX_DWORD GroupFamily,
FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, i
nt32_t nDownsampleHeight) | 1546 bool CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageR
enderCache* pCache, void*& LoadHandle, bool bStdCS, FX_DWORD GroupFamily, bool b
LoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, int32_t nD
ownsampleHeight) |
| 1547 { | 1547 { |
| 1548 m_nDownsampleWidth = nDownsampleWidth; | 1548 m_nDownsampleWidth = nDownsampleWidth; |
| 1549 m_nDownsampleHeight = nDownsampleHeight; | 1549 m_nDownsampleHeight = nDownsampleHeight; |
| 1550 CPDF_ProgressiveImageLoaderHandle* pLoaderHandle = new CPDF_ProgressiveImage
LoaderHandle; | 1550 CPDF_ProgressiveImageLoaderHandle* pLoaderHandle = new CPDF_ProgressiveImage
LoaderHandle; |
| 1551 FX_BOOL ret = pLoaderHandle->Start(this, pImage, pCache, bStdCS, GroupFamily
, bLoadMask, pRenderStatus, m_nDownsampleWidth, m_nDownsampleHeight); | 1551 bool ret = pLoaderHandle->Start(this, pImage, pCache, bStdCS, GroupFamily, b
LoadMask, pRenderStatus, m_nDownsampleWidth, m_nDownsampleHeight); |
| 1552 LoadHandle = pLoaderHandle; | 1552 LoadHandle = pLoaderHandle; |
| 1553 return ret; | 1553 return ret; |
| 1554 } | 1554 } |
| 1555 FX_BOOL»CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause) | 1555 bool» CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause) |
| 1556 { | 1556 { |
| 1557 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); | 1557 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); |
| 1558 } | 1558 } |
| 1559 CPDF_ImageLoader::~CPDF_ImageLoader() | 1559 CPDF_ImageLoader::~CPDF_ImageLoader() |
| 1560 { | 1560 { |
| 1561 if (!m_bCached) { | 1561 if (!m_bCached) { |
| 1562 delete m_pBitmap; | 1562 delete m_pBitmap; |
| 1563 delete m_pMask; | 1563 delete m_pMask; |
| 1564 } | 1564 } |
| 1565 } | 1565 } |
| OLD | NEW |