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 "../../../include/fpdfapi/fpdf_render.h" | 7 #include "../../../include/fpdfapi/fpdf_render.h" |
8 #include "../../../include/fpdfapi/fpdf_pageobj.h" | 8 #include "../../../include/fpdfapi/fpdf_pageobj.h" |
9 #include "../../../include/fxge/fx_ge.h" | 9 #include "../../../include/fxge/fx_ge.h" |
10 #include "../fpdf_page/pageint.h" | 10 #include "../fpdf_page/pageint.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 CPDF_PageRenderCache* pPageRenderCache = pContext->m_pPageCache; | 241 CPDF_PageRenderCache* pPageRenderCache = pContext->m_pPageCache; |
242 m_dwTimeCount = pPageRenderCache->GetTimeCount(); | 242 m_dwTimeCount = pPageRenderCache->GetTimeCount(); |
243 CPDF_DIBSource* pSrc = FX_NEW CPDF_DIBSource; | 243 CPDF_DIBSource* pSrc = FX_NEW CPDF_DIBSource; |
244 CPDF_DIBSource* pMaskSrc = NULL; | 244 CPDF_DIBSource* pMaskSrc = NULL; |
245 if (!pSrc->Load(m_pDocument, m_pStream, &pMaskSrc, &MatteColor, pRenderStatu
s->m_pFormResource, pPageResources, bStdCS, GroupFamily, bLoadMask)) { | 245 if (!pSrc->Load(m_pDocument, m_pStream, &pMaskSrc, &MatteColor, pRenderStatu
s->m_pFormResource, pPageResources, bStdCS, GroupFamily, bLoadMask)) { |
246 delete pSrc; | 246 delete pSrc; |
247 pBitmap = NULL; | 247 pBitmap = NULL; |
248 return FALSE; | 248 return FALSE; |
249 } | 249 } |
250 m_MatteColor = MatteColor; | 250 m_MatteColor = MatteColor; |
251 #if !defined(_FPDFAPI_MINI_) | |
252 if (pSrc->GetPitch() * pSrc->GetHeight() < FPDF_HUGE_IMAGE_SIZE) { | 251 if (pSrc->GetPitch() * pSrc->GetHeight() < FPDF_HUGE_IMAGE_SIZE) { |
253 m_pCachedBitmap = pSrc->Clone(); | 252 m_pCachedBitmap = pSrc->Clone(); |
254 delete pSrc; | 253 delete pSrc; |
255 } else { | 254 } else { |
256 m_pCachedBitmap = pSrc; | 255 m_pCachedBitmap = pSrc; |
257 } | 256 } |
258 if (pMaskSrc) { | 257 if (pMaskSrc) { |
259 m_pCachedMask = pMaskSrc->Clone(); | 258 m_pCachedMask = pMaskSrc->Clone(); |
260 delete pMaskSrc; | 259 delete pMaskSrc; |
261 } | 260 } |
262 #else | 261 |
263 if (pSrc->GetFormat() == FXDIB_8bppRgb && pSrc->GetPalette() && | |
264 pSrc->GetHeight() * pSrc->GetWidth() * 3 < 1024) { | |
265 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | |
266 m_pCachedBitmap = pSrc->CloneConvert(FXDIB_Rgb32); | |
267 #else | |
268 m_pCachedBitmap = pSrc->CloneConvert(FXDIB_Rgb); | |
269 #endif | |
270 delete pSrc; | |
271 } else if (pSrc->GetPitch() * pSrc->GetHeight() < 102400) { | |
272 m_pCachedBitmap = pSrc->Clone(); | |
273 delete pSrc; | |
274 } else { | |
275 m_pCachedBitmap = pSrc; | |
276 } | |
277 m_pCachedMask = pMaskSrc; | |
278 #endif | |
279 pBitmap = m_pCachedBitmap; | 262 pBitmap = m_pCachedBitmap; |
280 pMask = m_pCachedMask; | 263 pMask = m_pCachedMask; |
281 CalcSize(); | 264 CalcSize(); |
282 return FALSE; | 265 return FALSE; |
283 } | 266 } |
284 CFX_DIBSource* CPDF_ImageCache::DetachBitmap() | 267 CFX_DIBSource* CPDF_ImageCache::DetachBitmap() |
285 { | 268 { |
286 CFX_DIBSource* pDIBSource = m_pCurBitmap; | 269 CFX_DIBSource* pDIBSource = m_pCurBitmap; |
287 m_pCurBitmap = NULL; | 270 m_pCurBitmap = NULL; |
288 return pDIBSource; | 271 return pDIBSource; |
(...skipping 30 matching lines...) Expand all Loading... |
319 ContinueGetCachedBitmap(); | 302 ContinueGetCachedBitmap(); |
320 return 0; | 303 return 0; |
321 } | 304 } |
322 int CPDF_ImageCache::ContinueGetCachedBitmap() | 305 int CPDF_ImageCache::ContinueGetCachedBitmap() |
323 { | 306 { |
324 m_MatteColor = ((CPDF_DIBSource*)m_pCurBitmap)->m_MatteColor; | 307 m_MatteColor = ((CPDF_DIBSource*)m_pCurBitmap)->m_MatteColor; |
325 m_pCurMask = ((CPDF_DIBSource*)m_pCurBitmap)->DetachMask(); | 308 m_pCurMask = ((CPDF_DIBSource*)m_pCurBitmap)->DetachMask(); |
326 CPDF_RenderContext*pContext = m_pRenderStatus->GetContext(); | 309 CPDF_RenderContext*pContext = m_pRenderStatus->GetContext(); |
327 CPDF_PageRenderCache* pPageRenderCache = pContext->m_pPageCache; | 310 CPDF_PageRenderCache* pPageRenderCache = pContext->m_pPageCache; |
328 m_dwTimeCount = pPageRenderCache->GetTimeCount(); | 311 m_dwTimeCount = pPageRenderCache->GetTimeCount(); |
329 #if !defined(_FPDFAPI_MINI_) | |
330 if (m_pCurBitmap->GetPitch() * m_pCurBitmap->GetHeight() < FPDF_HUGE_IMAGE_S
IZE) { | 312 if (m_pCurBitmap->GetPitch() * m_pCurBitmap->GetHeight() < FPDF_HUGE_IMAGE_S
IZE) { |
331 m_pCachedBitmap = m_pCurBitmap->Clone(); | 313 m_pCachedBitmap = m_pCurBitmap->Clone(); |
332 delete m_pCurBitmap; | 314 delete m_pCurBitmap; |
333 m_pCurBitmap = NULL; | 315 m_pCurBitmap = NULL; |
334 } else { | 316 } else { |
335 m_pCachedBitmap = m_pCurBitmap; | 317 m_pCachedBitmap = m_pCurBitmap; |
336 } | 318 } |
337 if (m_pCurMask) { | 319 if (m_pCurMask) { |
338 m_pCachedMask = m_pCurMask->Clone(); | 320 m_pCachedMask = m_pCurMask->Clone(); |
339 delete m_pCurMask; | 321 delete m_pCurMask; |
340 m_pCurMask = NULL; | 322 m_pCurMask = NULL; |
341 } | 323 } |
342 #else | |
343 if (m_pCurBitmap->GetFormat() == FXDIB_8bppRgb && m_pCurBitmap->GetPalette()
&& | |
344 m_pCurBitmap->GetHeight() * m_pCurBitmap->GetWidth() * 3 < 1024) { | |
345 m_pCachedBitmap = m_pCurBitmap->CloneConvert(FXDIB_Rgb32); | |
346 m_pCachedBitmap = m_pCurBitmap->CloneConvert(FXDIB_Rgb); | |
347 delete m_pCurBitmap; | |
348 m_pCurBitmap = NULL; | |
349 } else if (m_pCurBitmap->GetPitch() * m_pCurBitmap->GetHeight() < 102400) { | |
350 m_pCachedBitmap = m_pCurBitmap->Clone(); | |
351 delete m_pCurBitmap; | |
352 m_pCurBitmap = NULL; | |
353 } else { | |
354 m_pCachedBitmap = m_pCurBitmap; | |
355 } | |
356 m_pCachedMask = m_pCurMask; | |
357 #endif | |
358 m_pCurBitmap = m_pCachedBitmap; | 324 m_pCurBitmap = m_pCachedBitmap; |
359 m_pCurMask = m_pCachedMask; | 325 m_pCurMask = m_pCachedMask; |
360 CalcSize(); | 326 CalcSize(); |
361 return 0; | 327 return 0; |
362 } | 328 } |
363 int CPDF_ImageCache::Continue(IFX_Pause* pPause) | 329 int CPDF_ImageCache::Continue(IFX_Pause* pPause) |
364 { | 330 { |
365 int ret = ((CPDF_DIBSource*)m_pCurBitmap)->ContinueLoadDIBSource(pPause); | 331 int ret = ((CPDF_DIBSource*)m_pCurBitmap)->ContinueLoadDIBSource(pPause); |
366 if (ret == 2) { | 332 if (ret == 2) { |
367 return ret; | 333 return ret; |
(...skipping 12 matching lines...) Expand all Loading... |
380 } | 346 } |
381 void CPDF_Document::ClearRenderFont() | 347 void CPDF_Document::ClearRenderFont() |
382 { | 348 { |
383 if (m_pDocRender) { | 349 if (m_pDocRender) { |
384 CFX_FontCache* pCache = m_pDocRender->GetFontCache(); | 350 CFX_FontCache* pCache = m_pDocRender->GetFontCache(); |
385 if (pCache) { | 351 if (pCache) { |
386 pCache->FreeCache(FALSE); | 352 pCache->FreeCache(FALSE); |
387 } | 353 } |
388 } | 354 } |
389 } | 355 } |
OLD | NEW |