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