| 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_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
| 9 #include "../fpdf_page/pageint.h" | 9 #include "../fpdf_page/pageint.h" |
| 10 #include "../../../include/fxge/fx_ge.h" | 10 #include "../../../include/fxge/fx_ge.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 CPDF_Font* pFont; | 28 CPDF_Font* pFont; |
| 29 CPDF_CountedObject<CPDF_Type3Cache*>* cache; | 29 CPDF_CountedObject<CPDF_Type3Cache*>* cache; |
| 30 m_Type3FaceMap.GetNextAssoc(pos, pFont, cache); | 30 m_Type3FaceMap.GetNextAssoc(pos, pFont, cache); |
| 31 if (bRelease || cache->m_nCount < 2) { | 31 if (bRelease || cache->m_nCount < 2) { |
| 32 delete cache->m_Obj; | 32 delete cache->m_Obj; |
| 33 delete cache; | 33 delete cache; |
| 34 m_Type3FaceMap.RemoveKey(pFont); | 34 m_Type3FaceMap.RemoveKey(pFont); |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 #ifndef _FPDFAPI_MINI_ | |
| 39 { | 38 { |
| 40 pos = m_TransferFuncMap.GetStartPosition(); | 39 pos = m_TransferFuncMap.GetStartPosition(); |
| 41 while (pos) { | 40 while (pos) { |
| 42 CPDF_Object* key; | 41 CPDF_Object* key; |
| 43 CPDF_CountedObject<CPDF_TransferFunc*>* value; | 42 CPDF_CountedObject<CPDF_TransferFunc*>* value; |
| 44 m_TransferFuncMap.GetNextAssoc(pos, key, value); | 43 m_TransferFuncMap.GetNextAssoc(pos, key, value); |
| 45 if (bRelease || value->m_nCount < 2) { | 44 if (bRelease || value->m_nCount < 2) { |
| 46 delete value->m_Obj; | 45 delete value->m_Obj; |
| 47 delete value; | 46 delete value; |
| 48 m_TransferFuncMap.RemoveKey(key); | 47 m_TransferFuncMap.RemoveKey(key); |
| 49 } | 48 } |
| 50 } | 49 } |
| 51 } | 50 } |
| 52 #endif | |
| 53 if (m_pFontCache) { | 51 if (m_pFontCache) { |
| 54 if (bRelease) { | 52 if (bRelease) { |
| 55 delete m_pFontCache; | 53 delete m_pFontCache; |
| 56 m_pFontCache = NULL; | 54 m_pFontCache = NULL; |
| 57 } else { | 55 } else { |
| 58 m_pFontCache->FreeCache(FALSE); | 56 m_pFontCache->FreeCache(FALSE); |
| 59 } | 57 } |
| 60 } | 58 } |
| 61 } | 59 } |
| 62 FX_BOOL CPDF_DocRenderData::Initialize() | 60 FX_BOOL CPDF_DocRenderData::Initialize() |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 140 } |
| 143 CPDF_RenderOptions::CPDF_RenderOptions() | 141 CPDF_RenderOptions::CPDF_RenderOptions() |
| 144 : m_ColorMode(RENDER_COLOR_NORMAL) | 142 : m_ColorMode(RENDER_COLOR_NORMAL) |
| 145 , m_Flags(RENDER_CLEARTYPE) | 143 , m_Flags(RENDER_CLEARTYPE) |
| 146 , m_Interpolation(0) | 144 , m_Interpolation(0) |
| 147 , m_AddFlags(0) | 145 , m_AddFlags(0) |
| 148 , m_pOCContext(NULL) | 146 , m_pOCContext(NULL) |
| 149 , m_dwLimitCacheSize(1024 * 1024 * 100) | 147 , m_dwLimitCacheSize(1024 * 1024 * 100) |
| 150 , m_HalftoneLimit(-1) | 148 , m_HalftoneLimit(-1) |
| 151 { | 149 { |
| 152 #if defined(_FPDFAPI_MINI_) | |
| 153 m_Flags |= RENDER_LIMITEDIMAGECACHE; | |
| 154 #endif | |
| 155 } | 150 } |
| 156 FX_ARGB CPDF_RenderOptions::TranslateColor(FX_ARGB argb) const | 151 FX_ARGB CPDF_RenderOptions::TranslateColor(FX_ARGB argb) const |
| 157 { | 152 { |
| 158 if (m_ColorMode == RENDER_COLOR_NORMAL) { | 153 if (m_ColorMode == RENDER_COLOR_NORMAL) { |
| 159 return argb; | 154 return argb; |
| 160 } | 155 } |
| 161 if (m_ColorMode == RENDER_COLOR_ALPHA) { | 156 if (m_ColorMode == RENDER_COLOR_ALPHA) { |
| 162 return argb; | 157 return argb; |
| 163 } | 158 } |
| 164 int a, r, g, b; | 159 int a, r, g, b; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 } | 249 } |
| 255 if (!pColorData || pColorData->m_StrokeColor.IsNull()) { | 250 if (!pColorData || pColorData->m_StrokeColor.IsNull()) { |
| 256 CPDF_ColorStateData* pData = m_InitialStates.m_ColorState.GetMod
ify(); | 251 CPDF_ColorStateData* pData = m_InitialStates.m_ColorState.GetMod
ify(); |
| 257 pData->m_StrokeRGB = pParentData->m_FillRGB; | 252 pData->m_StrokeRGB = pParentData->m_FillRGB; |
| 258 pData->m_StrokeColor.Copy(&pParentData->m_StrokeColor); | 253 pData->m_StrokeColor.Copy(&pParentData->m_StrokeColor); |
| 259 } | 254 } |
| 260 } | 255 } |
| 261 } else { | 256 } else { |
| 262 m_InitialStates.DefaultStates(); | 257 m_InitialStates.DefaultStates(); |
| 263 } | 258 } |
| 264 #if defined(_FPDFAPI_MINI_)||defined(_FXCORE_LIMITED_CPU_) | |
| 265 m_HalftoneLimit = CPDF_ModuleMgr::Get()->GetRenderModule()->GetConfig()->m_H
alftoneLimit; | |
| 266 if (pOptions && pOptions->m_HalftoneLimit >= 0) { | |
| 267 m_HalftoneLimit = pOptions->m_HalftoneLimit; | |
| 268 } | |
| 269 #endif | |
| 270 m_pObjectRenderer = NULL; | 259 m_pObjectRenderer = NULL; |
| 271 m_Transparency = transparency; | 260 m_Transparency = transparency; |
| 272 return TRUE; | 261 return TRUE; |
| 273 } | 262 } |
| 274 void CPDF_RenderStatus::RenderObjectList(const CPDF_PageObjects* pObjs, const CF
X_AffineMatrix* pObj2Device) | 263 void CPDF_RenderStatus::RenderObjectList(const CPDF_PageObjects* pObjs, const CF
X_AffineMatrix* pObj2Device) |
| 275 { | 264 { |
| 276 if (m_Level > 32) { | 265 if (m_Level > 32) { |
| 277 return; | 266 return; |
| 278 } | 267 } |
| 279 CFX_FloatRect clip_rect = m_pDevice->GetClipBox(); | 268 CFX_FloatRect clip_rect = m_pDevice->GetClipBox(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 } | 309 } |
| 321 FX_BOOL CPDF_RenderStatus::ContinueSingleObject(const CPDF_PageObject* pObj, con
st CFX_AffineMatrix* pObj2Device, IFX_Pause* pPause) | 310 FX_BOOL CPDF_RenderStatus::ContinueSingleObject(const CPDF_PageObject* pObj, con
st CFX_AffineMatrix* pObj2Device, IFX_Pause* pPause) |
| 322 { | 311 { |
| 323 if (m_pObjectRenderer) { | 312 if (m_pObjectRenderer) { |
| 324 if (m_pObjectRenderer->Continue(pPause)) { | 313 if (m_pObjectRenderer->Continue(pPause)) { |
| 325 return TRUE; | 314 return TRUE; |
| 326 } | 315 } |
| 327 if (!m_pObjectRenderer->m_Result) { | 316 if (!m_pObjectRenderer->m_Result) { |
| 328 DrawObjWithBackground(pObj, pObj2Device); | 317 DrawObjWithBackground(pObj, pObj2Device); |
| 329 } | 318 } |
| 330 #ifdef _FPDFAPI_MINI_ | |
| 331 if (m_DitherBits) { | |
| 332 DitherObjectArea(pObj, pObj2Device); | |
| 333 } | |
| 334 #endif | |
| 335 delete m_pObjectRenderer; | 319 delete m_pObjectRenderer; |
| 336 m_pObjectRenderer = NULL; | 320 m_pObjectRenderer = NULL; |
| 337 return FALSE; | 321 return FALSE; |
| 338 } | 322 } |
| 339 m_pCurObj = pObj; | 323 m_pCurObj = pObj; |
| 340 if (m_Options.m_pOCContext && pObj->m_ContentMark.NotNull()) | 324 if (m_Options.m_pOCContext && pObj->m_ContentMark.NotNull()) |
| 341 if (!m_Options.m_pOCContext->CheckObjectVisible(pObj)) { | 325 if (!m_Options.m_pOCContext->CheckObjectVisible(pObj)) { |
| 342 return FALSE; | 326 return FALSE; |
| 343 } | 327 } |
| 344 ProcessClipPath(pObj->m_ClipPath, pObj2Device); | 328 ProcessClipPath(pObj->m_ClipPath, pObj2Device); |
| 345 if (ProcessTransparency(pObj, pObj2Device)) { | 329 if (ProcessTransparency(pObj, pObj2Device)) { |
| 346 return FALSE; | 330 return FALSE; |
| 347 } | 331 } |
| 348 if (pObj->m_Type == PDFPAGE_IMAGE) { | 332 if (pObj->m_Type == PDFPAGE_IMAGE) { |
| 349 m_pObjectRenderer = IPDF_ObjectRenderer::Create(pObj->m_Type); | 333 m_pObjectRenderer = IPDF_ObjectRenderer::Create(pObj->m_Type); |
| 350 if (!m_pObjectRenderer->Start(this, pObj, pObj2Device, FALSE)) { | 334 if (!m_pObjectRenderer->Start(this, pObj, pObj2Device, FALSE)) { |
| 351 if (!m_pObjectRenderer->m_Result) { | 335 if (!m_pObjectRenderer->m_Result) { |
| 352 DrawObjWithBackground(pObj, pObj2Device); | 336 DrawObjWithBackground(pObj, pObj2Device); |
| 353 } | 337 } |
| 354 #ifdef _FPDFAPI_MINI_ | |
| 355 if (m_DitherBits) { | |
| 356 DitherObjectArea(pObj, pObj2Device); | |
| 357 } | |
| 358 #endif | |
| 359 delete m_pObjectRenderer; | 338 delete m_pObjectRenderer; |
| 360 m_pObjectRenderer = NULL; | 339 m_pObjectRenderer = NULL; |
| 361 return FALSE; | 340 return FALSE; |
| 362 } | 341 } |
| 363 return ContinueSingleObject(pObj, pObj2Device, pPause); | 342 return ContinueSingleObject(pObj, pObj2Device, pPause); |
| 364 } | 343 } |
| 365 ProcessObjectNoClip(pObj, pObj2Device); | 344 ProcessObjectNoClip(pObj, pObj2Device); |
| 366 return FALSE; | 345 return FALSE; |
| 367 } | 346 } |
| 368 IPDF_ObjectRenderer* IPDF_ObjectRenderer::Create(int type) | 347 IPDF_ObjectRenderer* IPDF_ObjectRenderer::Create(int type) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 break; | 403 break; |
| 425 case PDFPAGE_IMAGE: | 404 case PDFPAGE_IMAGE: |
| 426 bRet = ProcessImage((CPDF_ImageObject*)pObj, pObj2Device); | 405 bRet = ProcessImage((CPDF_ImageObject*)pObj, pObj2Device); |
| 427 break; | 406 break; |
| 428 case PDFPAGE_SHADING: | 407 case PDFPAGE_SHADING: |
| 429 bRet = ProcessShading((CPDF_ShadingObject*)pObj, pObj2Device); | 408 bRet = ProcessShading((CPDF_ShadingObject*)pObj, pObj2Device); |
| 430 break; | 409 break; |
| 431 case PDFPAGE_FORM: | 410 case PDFPAGE_FORM: |
| 432 bRet = ProcessForm((CPDF_FormObject*)pObj, pObj2Device); | 411 bRet = ProcessForm((CPDF_FormObject*)pObj, pObj2Device); |
| 433 break; | 412 break; |
| 434 #if defined(_FPDFAPI_MINI_) | |
| 435 case PDFPAGE_INLINES: | |
| 436 bRet = ProcessInlines((CPDF_InlineImages*)pObj, pObj2Device); | |
| 437 break; | |
| 438 #endif | |
| 439 } | 413 } |
| 440 if (!bRet) { | 414 if (!bRet) { |
| 441 DrawObjWithBackground(pObj, pObj2Device); | 415 DrawObjWithBackground(pObj, pObj2Device); |
| 442 } | 416 } |
| 443 } | 417 } |
| 444 FX_BOOL CPDF_RenderStatus::DrawObjWithBlend(const CPDF_PageObject* pObj, const C
FX_AffineMatrix* pObj2Device) | 418 FX_BOOL CPDF_RenderStatus::DrawObjWithBlend(const CPDF_PageObject* pObj, const C
FX_AffineMatrix* pObj2Device) |
| 445 { | 419 { |
| 446 FX_BOOL bRet = FALSE; | 420 FX_BOOL bRet = FALSE; |
| 447 switch (pObj->m_Type) { | 421 switch (pObj->m_Type) { |
| 448 case PDFPAGE_PATH: | 422 case PDFPAGE_PATH: |
| 449 bRet = ProcessPath((CPDF_PathObject*)pObj, pObj2Device); | 423 bRet = ProcessPath((CPDF_PathObject*)pObj, pObj2Device); |
| 450 break; | 424 break; |
| 451 case PDFPAGE_IMAGE: | 425 case PDFPAGE_IMAGE: |
| 452 bRet = ProcessImage((CPDF_ImageObject *)pObj, pObj2Device); | 426 bRet = ProcessImage((CPDF_ImageObject *)pObj, pObj2Device); |
| 453 break; | 427 break; |
| 454 case PDFPAGE_FORM: | 428 case PDFPAGE_FORM: |
| 455 bRet = ProcessForm((CPDF_FormObject*)pObj, pObj2Device); | 429 bRet = ProcessForm((CPDF_FormObject*)pObj, pObj2Device); |
| 456 break; | 430 break; |
| 457 } | 431 } |
| 458 return bRet; | 432 return bRet; |
| 459 } | 433 } |
| 460 void CPDF_RenderStatus::GetScaledMatrix(CFX_Matrix &matrix) const | 434 void CPDF_RenderStatus::GetScaledMatrix(CFX_Matrix &matrix) const |
| 461 { | 435 { |
| 462 CFX_Matrix dCTM = m_pDevice->GetCTM(); | 436 CFX_Matrix dCTM = m_pDevice->GetCTM(); |
| 463 matrix.a *= FXSYS_fabs(dCTM.a); | 437 matrix.a *= FXSYS_fabs(dCTM.a); |
| 464 matrix.d *= FXSYS_fabs(dCTM.d); | 438 matrix.d *= FXSYS_fabs(dCTM.d); |
| 465 } | 439 } |
| 466 void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, const
CFX_AffineMatrix* pObj2Device) | 440 void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, const
CFX_AffineMatrix* pObj2Device) |
| 467 { | 441 { |
| 468 #if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) | |
| 469 FX_RECT rect; | 442 FX_RECT rect; |
| 470 if (GetObjectClippedRect(pObj, pObj2Device, FALSE, rect)) { | 443 if (GetObjectClippedRect(pObj, pObj2Device, FALSE, rect)) { |
| 471 return; | 444 return; |
| 472 } | 445 } |
| 473 int res = 300; | 446 int res = 300; |
| 474 if (pObj->m_Type == PDFPAGE_IMAGE && m_pDevice->GetDeviceCaps(FXDC_DEVICE_CL
ASS) == FXDC_PRINTER) { | 447 if (pObj->m_Type == PDFPAGE_IMAGE && m_pDevice->GetDeviceCaps(FXDC_DEVICE_CL
ASS) == FXDC_PRINTER) { |
| 475 res = 0; | 448 res = 0; |
| 476 } | 449 } |
| 477 CPDF_ScaledRenderBuffer buffer; | 450 CPDF_ScaledRenderBuffer buffer; |
| 478 if (!buffer.Initialize(m_pContext, m_pDevice, &rect, pObj, &m_Options, res))
{ | 451 if (!buffer.Initialize(m_pContext, m_pDevice, &rect, pObj, &m_Options, res))
{ |
| 479 return; | 452 return; |
| 480 } | 453 } |
| 481 CFX_AffineMatrix matrix = *pObj2Device; | 454 CFX_AffineMatrix matrix = *pObj2Device; |
| 482 matrix.Concat(*buffer.GetMatrix()); | 455 matrix.Concat(*buffer.GetMatrix()); |
| 483 GetScaledMatrix(matrix); | 456 GetScaledMatrix(matrix); |
| 484 CPDF_Dictionary* pFormResource = NULL; | 457 CPDF_Dictionary* pFormResource = NULL; |
| 485 if (pObj->m_Type == PDFPAGE_FORM) { | 458 if (pObj->m_Type == PDFPAGE_FORM) { |
| 486 CPDF_FormObject* pFormObj = (CPDF_FormObject*)pObj; | 459 CPDF_FormObject* pFormObj = (CPDF_FormObject*)pObj; |
| 487 if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { | 460 if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { |
| 488 pFormResource = pFormObj->m_pForm->m_pFormDict->GetDict(FX_BSTRC("Re
sources")); | 461 pFormResource = pFormObj->m_pForm->m_pFormDict->GetDict(FX_BSTRC("Re
sources")); |
| 489 } | 462 } |
| 490 } | 463 } |
| 491 CPDF_RenderStatus status; | 464 CPDF_RenderStatus status; |
| 492 status.Initialize(m_Level + 1, m_pContext, buffer.GetDevice(), buffer.GetMat
rix(), NULL, NULL, NULL, &m_Options, m_Transparency, m_bDropObjects, pFormResour
ce); | 465 status.Initialize(m_Level + 1, m_pContext, buffer.GetDevice(), buffer.GetMat
rix(), NULL, NULL, NULL, &m_Options, m_Transparency, m_bDropObjects, pFormResour
ce); |
| 493 status.RenderSingleObject(pObj, &matrix); | 466 status.RenderSingleObject(pObj, &matrix); |
| 494 buffer.OutputToDevice(); | 467 buffer.OutputToDevice(); |
| 495 #endif | |
| 496 } | 468 } |
| 497 FX_BOOL CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj, const CFX_Affi
neMatrix* pObj2Device) | 469 FX_BOOL CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj, const CFX_Affi
neMatrix* pObj2Device) |
| 498 { | 470 { |
| 499 CPDF_Dictionary* pOC = pFormObj->m_pForm->m_pFormDict->GetDict(FX_BSTRC("OC"
)); | 471 CPDF_Dictionary* pOC = pFormObj->m_pForm->m_pFormDict->GetDict(FX_BSTRC("OC"
)); |
| 500 if (pOC && m_Options.m_pOCContext && !m_Options.m_pOCContext->CheckOCGVisibl
e(pOC)) { | 472 if (pOC && m_Options.m_pOCContext && !m_Options.m_pOCContext->CheckOCGVisibl
e(pOC)) { |
| 501 return TRUE; | 473 return TRUE; |
| 502 } | 474 } |
| 503 CFX_AffineMatrix matrix = pFormObj->m_FormMatrix; | 475 CFX_AffineMatrix matrix = pFormObj->m_FormMatrix; |
| 504 matrix.Concat(*pObj2Device); | 476 matrix.Concat(*pObj2Device); |
| 505 CPDF_Dictionary* pResources = NULL; | 477 CPDF_Dictionary* pResources = NULL; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 } | 524 } |
| 553 if (m_Options.m_Flags & RENDER_FILL_FULLCOVER) { | 525 if (m_Options.m_Flags & RENDER_FILL_FULLCOVER) { |
| 554 FillType |= FXFILL_FULLCOVER; | 526 FillType |= FXFILL_FULLCOVER; |
| 555 } | 527 } |
| 556 if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) { | 528 if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) { |
| 557 FillType |= FXFILL_NOPATHSMOOTH; | 529 FillType |= FXFILL_NOPATHSMOOTH; |
| 558 } | 530 } |
| 559 if (bStroke) { | 531 if (bStroke) { |
| 560 FillType |= FX_FILL_STROKE; | 532 FillType |= FX_FILL_STROKE; |
| 561 } | 533 } |
| 562 #if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) | |
| 563 const CPDF_GeneralStateData* pGeneralData = ((CPDF_PageObject*)pPathObj)->m_
GeneralState; | 534 const CPDF_GeneralStateData* pGeneralData = ((CPDF_PageObject*)pPathObj)->m_
GeneralState; |
| 564 if (pGeneralData && pGeneralData->m_StrokeAdjust) { | 535 if (pGeneralData && pGeneralData->m_StrokeAdjust) { |
| 565 FillType |= FX_STROKE_ADJUST; | 536 FillType |= FX_STROKE_ADJUST; |
| 566 } | 537 } |
| 567 #endif | |
| 568 if (m_pType3Char) { | 538 if (m_pType3Char) { |
| 569 FillType |= FX_FILL_TEXT_MODE; | 539 FillType |= FX_FILL_TEXT_MODE; |
| 570 } | 540 } |
| 571 CFX_GraphStateData graphState(*pPathObj->m_GraphState); | 541 CFX_GraphStateData graphState(*pPathObj->m_GraphState); |
| 572 if (m_Options.m_Flags & RENDER_THINLINE) { | 542 if (m_Options.m_Flags & RENDER_THINLINE) { |
| 573 graphState.m_LineWidth = 0; | 543 graphState.m_LineWidth = 0; |
| 574 } | 544 } |
| 575 return m_pDevice->DrawPath(pPathObj->m_Path, &path_matrix, &graphState, fill
_argb, stroke_argb, FillType, 0, NULL, m_curBlend); | 545 return m_pDevice->DrawPath(pPathObj->m_Path, &path_matrix, &graphState, fill
_argb, stroke_argb, FillType, 0, NULL, m_curBlend); |
| 576 } | 546 } |
| 577 CPDF_TransferFunc* CPDF_RenderStatus::GetTransferFunc(CPDF_Object* pObj) const | 547 CPDF_TransferFunc* CPDF_RenderStatus::GetTransferFunc(CPDF_Object* pObj) const |
| (...skipping 14 matching lines...) Expand all Loading... |
| 592 pColorData = (CPDF_ColorStateData*)(const CPDF_ColorStateData*)m_Initial
States.m_ColorState; | 562 pColorData = (CPDF_ColorStateData*)(const CPDF_ColorStateData*)m_Initial
States.m_ColorState; |
| 593 } | 563 } |
| 594 FX_COLORREF rgb = pColorData->m_FillRGB; | 564 FX_COLORREF rgb = pColorData->m_FillRGB; |
| 595 if (rgb == (FX_DWORD) - 1) { | 565 if (rgb == (FX_DWORD) - 1) { |
| 596 return 0; | 566 return 0; |
| 597 } | 567 } |
| 598 const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState; | 568 const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState; |
| 599 int alpha; | 569 int alpha; |
| 600 if (pGeneralData) { | 570 if (pGeneralData) { |
| 601 alpha = (FX_INT32)(pGeneralData->m_FillAlpha * 255); | 571 alpha = (FX_INT32)(pGeneralData->m_FillAlpha * 255); |
| 602 #ifndef _FPDFAPI_MINI_ | |
| 603 if (pGeneralData->m_pTR) { | 572 if (pGeneralData->m_pTR) { |
| 604 if (!pGeneralData->m_pTransferFunc) { | 573 if (!pGeneralData->m_pTransferFunc) { |
| 605 ((CPDF_GeneralStateData*)pGeneralData)->m_pTransferFunc = GetTra
nsferFunc(pGeneralData->m_pTR); | 574 ((CPDF_GeneralStateData*)pGeneralData)->m_pTransferFunc = GetTra
nsferFunc(pGeneralData->m_pTR); |
| 606 } | 575 } |
| 607 if (pGeneralData->m_pTransferFunc) { | 576 if (pGeneralData->m_pTransferFunc) { |
| 608 rgb = pGeneralData->m_pTransferFunc->TranslateColor(rgb); | 577 rgb = pGeneralData->m_pTransferFunc->TranslateColor(rgb); |
| 609 } | 578 } |
| 610 } | 579 } |
| 611 #endif | |
| 612 } else { | 580 } else { |
| 613 alpha = 255; | 581 alpha = 255; |
| 614 } | 582 } |
| 615 return m_Options.TranslateColor(ArgbEncode(alpha, rgb)); | 583 return m_Options.TranslateColor(ArgbEncode(alpha, rgb)); |
| 616 } | 584 } |
| 617 FX_ARGB CPDF_RenderStatus::GetStrokeArgb(const CPDF_PageObject* pObj) const | 585 FX_ARGB CPDF_RenderStatus::GetStrokeArgb(const CPDF_PageObject* pObj) const |
| 618 { | 586 { |
| 619 CPDF_ColorStateData* pColorData = (CPDF_ColorStateData*)(const CPDF_ColorSta
teData*)pObj->m_ColorState; | 587 CPDF_ColorStateData* pColorData = (CPDF_ColorStateData*)(const CPDF_ColorSta
teData*)pObj->m_ColorState; |
| 620 if (m_pType3Char && (!m_pType3Char->m_bColored || (m_pType3Char->m_bColored
&& (!pColorData || pColorData->m_StrokeColor.IsNull())))) { | 588 if (m_pType3Char && (!m_pType3Char->m_bColored || (m_pType3Char->m_bColored
&& (!pColorData || pColorData->m_StrokeColor.IsNull())))) { |
| 621 return m_T3FillColor; | 589 return m_T3FillColor; |
| 622 } else if (!pColorData || pColorData->m_StrokeColor.IsNull()) { | 590 } else if (!pColorData || pColorData->m_StrokeColor.IsNull()) { |
| 623 pColorData = (CPDF_ColorStateData*)(const CPDF_ColorStateData*)m_Initial
States.m_ColorState; | 591 pColorData = (CPDF_ColorStateData*)(const CPDF_ColorStateData*)m_Initial
States.m_ColorState; |
| 624 } | 592 } |
| 625 FX_COLORREF rgb = pColorData->m_StrokeRGB; | 593 FX_COLORREF rgb = pColorData->m_StrokeRGB; |
| 626 if (rgb == (FX_DWORD) - 1) { | 594 if (rgb == (FX_DWORD) - 1) { |
| 627 return 0; | 595 return 0; |
| 628 } | 596 } |
| 629 const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState; | 597 const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState; |
| 630 int alpha; | 598 int alpha; |
| 631 if (pGeneralData) { | 599 if (pGeneralData) { |
| 632 alpha = (FX_INT32)(pGeneralData->m_StrokeAlpha * 255); | 600 alpha = (FX_INT32)(pGeneralData->m_StrokeAlpha * 255); |
| 633 #ifndef _FPDFAPI_MINI_ | |
| 634 if (pGeneralData->m_pTR) { | 601 if (pGeneralData->m_pTR) { |
| 635 if (!pGeneralData->m_pTransferFunc) { | 602 if (!pGeneralData->m_pTransferFunc) { |
| 636 ((CPDF_GeneralStateData*)pGeneralData)->m_pTransferFunc = GetTra
nsferFunc(pGeneralData->m_pTR); | 603 ((CPDF_GeneralStateData*)pGeneralData)->m_pTransferFunc = GetTra
nsferFunc(pGeneralData->m_pTR); |
| 637 } | 604 } |
| 638 if (pGeneralData->m_pTransferFunc) { | 605 if (pGeneralData->m_pTransferFunc) { |
| 639 rgb = pGeneralData->m_pTransferFunc->TranslateColor(rgb); | 606 rgb = pGeneralData->m_pTransferFunc->TranslateColor(rgb); |
| 640 } | 607 } |
| 641 } | 608 } |
| 642 #endif | |
| 643 } else { | 609 } else { |
| 644 alpha = 255; | 610 alpha = 255; |
| 645 } | 611 } |
| 646 return m_Options.TranslateColor(ArgbEncode(alpha, rgb)); | 612 return m_Options.TranslateColor(ArgbEncode(alpha, rgb)); |
| 647 } | 613 } |
| 648 void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath, const CFX_Affine
Matrix* pObj2Device) | 614 void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath, const CFX_Affine
Matrix* pObj2Device) |
| 649 { | 615 { |
| 650 if (ClipPath.IsNull()) { | 616 if (ClipPath.IsNull()) { |
| 651 if (m_LastClipPath.IsNull()) { | 617 if (m_LastClipPath.IsNull()) { |
| 652 return; | 618 return; |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 for (int j = 0; j < count; j ++) { | 997 for (int j = 0; j < count; j ++) { |
| 1032 pDevice->SaveState(); | 998 pDevice->SaveState(); |
| 1033 _PDF_RenderItem* pItem = m_ContentList.GetDataPtr(j); | 999 _PDF_RenderItem* pItem = m_ContentList.GetDataPtr(j); |
| 1034 if (pLastMatrix) { | 1000 if (pLastMatrix) { |
| 1035 CFX_AffineMatrix FinalMatrix = pItem->m_Matrix; | 1001 CFX_AffineMatrix FinalMatrix = pItem->m_Matrix; |
| 1036 FinalMatrix.Concat(*pLastMatrix); | 1002 FinalMatrix.Concat(*pLastMatrix); |
| 1037 CPDF_RenderStatus status; | 1003 CPDF_RenderStatus status; |
| 1038 status.Initialize(0, this, pDevice, pLastMatrix, pStopObj, NULL, NUL
L, pOptions, | 1004 status.Initialize(0, this, pDevice, pLastMatrix, pStopObj, NULL, NUL
L, pOptions, |
| 1039 pItem->m_pObjectList->m_Transparency, FALSE, NULL)
; | 1005 pItem->m_pObjectList->m_Transparency, FALSE, NULL)
; |
| 1040 status.RenderObjectList(pItem->m_pObjectList, &FinalMatrix); | 1006 status.RenderObjectList(pItem->m_pObjectList, &FinalMatrix); |
| 1041 #if !defined(_FPDFAPI_MINI_) | |
| 1042 if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { | 1007 if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { |
| 1043 m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheS
ize); | 1008 m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheS
ize); |
| 1044 } | 1009 } |
| 1045 #endif | |
| 1046 if (status.m_bStopped) { | 1010 if (status.m_bStopped) { |
| 1047 pDevice->RestoreState(); | 1011 pDevice->RestoreState(); |
| 1048 break; | 1012 break; |
| 1049 } | 1013 } |
| 1050 } else { | 1014 } else { |
| 1051 CPDF_RenderStatus status; | 1015 CPDF_RenderStatus status; |
| 1052 status.Initialize(0, this, pDevice, NULL, pStopObj, NULL, NULL, pOpt
ions, | 1016 status.Initialize(0, this, pDevice, NULL, pStopObj, NULL, NULL, pOpt
ions, |
| 1053 pItem->m_pObjectList->m_Transparency, FALSE, NULL)
; | 1017 pItem->m_pObjectList->m_Transparency, FALSE, NULL)
; |
| 1054 status.RenderObjectList(pItem->m_pObjectList, &pItem->m_Matrix); | 1018 status.RenderObjectList(pItem->m_pObjectList, &pItem->m_Matrix); |
| 1055 #if !defined(_FPDFAPI_MINI_) | |
| 1056 if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { | 1019 if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { |
| 1057 m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheS
ize); | 1020 m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheS
ize); |
| 1058 } | 1021 } |
| 1059 #endif | |
| 1060 if (status.m_bStopped) { | 1022 if (status.m_bStopped) { |
| 1061 pDevice->RestoreState(); | 1023 pDevice->RestoreState(); |
| 1062 break; | 1024 break; |
| 1063 } | 1025 } |
| 1064 } | 1026 } |
| 1065 pDevice->RestoreState(); | 1027 pDevice->RestoreState(); |
| 1066 } | 1028 } |
| 1067 } | 1029 } |
| 1068 void CPDF_RenderContext::DrawObjectList(CFX_RenderDevice* pDevice, CPDF_PageObje
cts* pObjs, | 1030 void CPDF_RenderContext::DrawObjectList(CFX_RenderDevice* pDevice, CPDF_PageObje
cts* pObjs, |
| 1069 const CFX_AffineMatrix* pObject2Device,
const CPDF_RenderOptions* pOptions) | 1031 const CFX_AffineMatrix* pObject2Device,
const CPDF_RenderOptions* pOptions) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 m_Status = Failed; | 1068 m_Status = Failed; |
| 1107 return; | 1069 return; |
| 1108 } | 1070 } |
| 1109 m_Status = ToBeContinued; | 1071 m_Status = ToBeContinued; |
| 1110 m_ObjectPos = NULL; | 1072 m_ObjectPos = NULL; |
| 1111 m_LayerIndex = 0; | 1073 m_LayerIndex = 0; |
| 1112 m_ObjectIndex = 0; | 1074 m_ObjectIndex = 0; |
| 1113 m_PrevLastPos = NULL; | 1075 m_PrevLastPos = NULL; |
| 1114 Continue(pPause); | 1076 Continue(pPause); |
| 1115 } | 1077 } |
| 1116 #ifdef _FPDFAPI_MINI_ | |
| 1117 #define RENDER_STEP_LIMIT 20 | |
| 1118 #else | |
| 1119 #define RENDER_STEP_LIMIT 100 | 1078 #define RENDER_STEP_LIMIT 100 |
| 1120 #endif | |
| 1121 void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) | 1079 void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) |
| 1122 { | 1080 { |
| 1123 if (m_Status != ToBeContinued) { | 1081 if (m_Status != ToBeContinued) { |
| 1124 return; | 1082 return; |
| 1125 } | 1083 } |
| 1126 FX_DWORD nLayers = m_pContext->m_ContentList.GetSize(); | 1084 FX_DWORD nLayers = m_pContext->m_ContentList.GetSize(); |
| 1127 for (; m_LayerIndex < nLayers; m_LayerIndex ++) { | 1085 for (; m_LayerIndex < nLayers; m_LayerIndex ++) { |
| 1128 _PDF_RenderItem* pItem = m_pContext->m_ContentList.GetDataPtr(m_LayerInd
ex); | 1086 _PDF_RenderItem* pItem = m_pContext->m_ContentList.GetDataPtr(m_LayerInd
ex); |
| 1129 FX_POSITION LastPos = pItem->m_pObjectList->GetLastObjectPosition(); | 1087 FX_POSITION LastPos = pItem->m_pObjectList->GetLastObjectPosition(); |
| 1130 if (m_ObjectPos == NULL) { | 1088 if (m_ObjectPos == NULL) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 device2object.TransformRect(m_ClipRect); | 1126 device2object.TransformRect(m_ClipRect); |
| 1169 } | 1127 } |
| 1170 int objs_to_go = CPDF_ModuleMgr::Get()->GetRenderModule()->GetConfig()->
m_RenderStepLimit; | 1128 int objs_to_go = CPDF_ModuleMgr::Get()->GetRenderModule()->GetConfig()->
m_RenderStepLimit; |
| 1171 while (m_ObjectPos) { | 1129 while (m_ObjectPos) { |
| 1172 CPDF_PageObject* pCurObj = pItem->m_pObjectList->GetObjectAt(m_Objec
tPos); | 1130 CPDF_PageObject* pCurObj = pItem->m_pObjectList->GetObjectAt(m_Objec
tPos); |
| 1173 if (pCurObj && pCurObj->m_Left <= m_ClipRect.right && pCurObj->m_Rig
ht >= m_ClipRect.left && | 1131 if (pCurObj && pCurObj->m_Left <= m_ClipRect.right && pCurObj->m_Rig
ht >= m_ClipRect.left && |
| 1174 pCurObj->m_Bottom <= m_ClipRect.top && pCurObj->m_Top >= m_C
lipRect.bottom) { | 1132 pCurObj->m_Bottom <= m_ClipRect.top && pCurObj->m_Top >= m_C
lipRect.bottom) { |
| 1175 if (m_pRenderer->ContinueSingleObject(pCurObj, &pItem->m_Matrix,
pPause)) { | 1133 if (m_pRenderer->ContinueSingleObject(pCurObj, &pItem->m_Matrix,
pPause)) { |
| 1176 return; | 1134 return; |
| 1177 } | 1135 } |
| 1178 #if !defined(_FPDFAPI_MINI_) | |
| 1179 if (pCurObj->m_Type == PDFPAGE_IMAGE && m_pRenderer->m_Options.m
_Flags & RENDER_LIMITEDIMAGECACHE) { | 1136 if (pCurObj->m_Type == PDFPAGE_IMAGE && m_pRenderer->m_Options.m
_Flags & RENDER_LIMITEDIMAGECACHE) { |
| 1180 m_pContext->GetPageCache()->CacheOptimization(m_pRenderer->m
_Options.m_dwLimitCacheSize); | 1137 m_pContext->GetPageCache()->CacheOptimization(m_pRenderer->m
_Options.m_dwLimitCacheSize); |
| 1181 } | 1138 } |
| 1182 #endif | |
| 1183 if (pCurObj->m_Type == PDFPAGE_FORM || pCurObj->m_Type == PDFPAG
E_SHADING) { | 1139 if (pCurObj->m_Type == PDFPAGE_FORM || pCurObj->m_Type == PDFPAG
E_SHADING) { |
| 1184 objs_to_go = 0; | 1140 objs_to_go = 0; |
| 1185 } else { | 1141 } else { |
| 1186 objs_to_go --; | 1142 objs_to_go --; |
| 1187 } | 1143 } |
| 1188 } | 1144 } |
| 1189 m_ObjectIndex ++; | 1145 m_ObjectIndex ++; |
| 1190 pItem->m_pObjectList->GetNextObject(m_ObjectPos); | 1146 pItem->m_pObjectList->GetNextObject(m_ObjectPos); |
| 1191 if (objs_to_go == 0) { | 1147 if (objs_to_go == 0) { |
| 1192 if (pPause && pPause->NeedToPauseNow()) { | 1148 if (pPause && pPause->NeedToPauseNow()) { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 { | 1269 { |
| 1314 CPDF_CountedObject<CPDF_TransferFunc*>* pTransferCounter; | 1270 CPDF_CountedObject<CPDF_TransferFunc*>* pTransferCounter; |
| 1315 if (!m_TransferFuncMap.Lookup(pObj, pTransferCounter)) { | 1271 if (!m_TransferFuncMap.Lookup(pObj, pTransferCounter)) { |
| 1316 return; | 1272 return; |
| 1317 } | 1273 } |
| 1318 pTransferCounter->m_nCount--; | 1274 pTransferCounter->m_nCount--; |
| 1319 } | 1275 } |
| 1320 CPDF_RenderConfig::CPDF_RenderConfig() | 1276 CPDF_RenderConfig::CPDF_RenderConfig() |
| 1321 { | 1277 { |
| 1322 m_HalftoneLimit = 0; | 1278 m_HalftoneLimit = 0; |
| 1323 #ifdef _FPDFAPI_MINI_ | |
| 1324 m_RenderStepLimit = 20; | |
| 1325 #else | |
| 1326 m_RenderStepLimit = 100; | 1279 m_RenderStepLimit = 100; |
| 1327 #endif | |
| 1328 } | 1280 } |
| 1329 CPDF_RenderConfig::~CPDF_RenderConfig() | 1281 CPDF_RenderConfig::~CPDF_RenderConfig() |
| 1330 { | 1282 { |
| 1331 } | 1283 } |
| 1332 CPDF_DeviceBuffer::CPDF_DeviceBuffer() | 1284 CPDF_DeviceBuffer::CPDF_DeviceBuffer() |
| 1333 { | 1285 { |
| 1334 m_pBitmap = NULL; | 1286 m_pBitmap = NULL; |
| 1335 m_pDevice = NULL; | 1287 m_pDevice = NULL; |
| 1336 m_pContext = NULL; | 1288 m_pContext = NULL; |
| 1337 m_pObject = NULL; | 1289 m_pObject = NULL; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1356 if (horz_size && vert_size && max_dpi) { | 1308 if (horz_size && vert_size && max_dpi) { |
| 1357 int dpih = pDevice->GetDeviceCaps(FXDC_PIXEL_WIDTH) * 254 / (horz_size *
10); | 1309 int dpih = pDevice->GetDeviceCaps(FXDC_PIXEL_WIDTH) * 254 / (horz_size *
10); |
| 1358 int dpiv = pDevice->GetDeviceCaps(FXDC_PIXEL_HEIGHT) * 254 / (vert_size
* 10); | 1310 int dpiv = pDevice->GetDeviceCaps(FXDC_PIXEL_HEIGHT) * 254 / (vert_size
* 10); |
| 1359 if (dpih > max_dpi) { | 1311 if (dpih > max_dpi) { |
| 1360 m_Matrix.Scale((FX_FLOAT)(max_dpi) / dpih, 1.0f); | 1312 m_Matrix.Scale((FX_FLOAT)(max_dpi) / dpih, 1.0f); |
| 1361 } | 1313 } |
| 1362 if (dpiv > max_dpi) { | 1314 if (dpiv > max_dpi) { |
| 1363 m_Matrix.Scale(1.0f, (FX_FLOAT)(max_dpi) / (FX_FLOAT)dpiv); | 1315 m_Matrix.Scale(1.0f, (FX_FLOAT)(max_dpi) / (FX_FLOAT)dpiv); |
| 1364 } | 1316 } |
| 1365 } | 1317 } |
| 1366 #ifdef _FPDFAPI_MINI_ | |
| 1367 m_Matrix.Scale(0.5f, 0.5f); | |
| 1368 #endif | |
| 1369 #endif | 1318 #endif |
| 1370 CFX_Matrix ctm = m_pDevice->GetCTM(); | 1319 CFX_Matrix ctm = m_pDevice->GetCTM(); |
| 1371 FX_FLOAT fScaleX = FXSYS_fabs(ctm.a); | 1320 FX_FLOAT fScaleX = FXSYS_fabs(ctm.a); |
| 1372 FX_FLOAT fScaleY = FXSYS_fabs(ctm.d); | 1321 FX_FLOAT fScaleY = FXSYS_fabs(ctm.d); |
| 1373 m_Matrix.Concat(fScaleX, 0, 0, fScaleY, 0, 0); | 1322 m_Matrix.Concat(fScaleX, 0, 0, fScaleY, 0, 0); |
| 1374 CFX_FloatRect rect(*pRect); | 1323 CFX_FloatRect rect(*pRect); |
| 1375 m_Matrix.TransformRect(rect); | 1324 m_Matrix.TransformRect(rect); |
| 1376 FX_RECT bitmap_rect = rect.GetOutterRect(); | 1325 FX_RECT bitmap_rect = rect.GetOutterRect(); |
| 1377 m_pBitmap = FX_NEW CFX_DIBitmap; | 1326 m_pBitmap = FX_NEW CFX_DIBitmap; |
| 1378 m_pBitmap->Create(bitmap_rect.Width(), bitmap_rect.Height(), FXDIB_Argb); | 1327 m_pBitmap->Create(bitmap_rect.Width(), bitmap_rect.Height(), FXDIB_Argb); |
| 1379 return TRUE; | 1328 return TRUE; |
| 1380 } | 1329 } |
| 1381 void CPDF_DeviceBuffer::OutputToDevice() | 1330 void CPDF_DeviceBuffer::OutputToDevice() |
| 1382 { | 1331 { |
| 1383 if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) { | 1332 if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) { |
| 1384 if (m_Matrix.a == 1.0f && m_Matrix.d == 1.0f) { | 1333 if (m_Matrix.a == 1.0f && m_Matrix.d == 1.0f) { |
| 1385 m_pDevice->SetDIBits(m_pBitmap, m_Rect.left, m_Rect.top); | 1334 m_pDevice->SetDIBits(m_pBitmap, m_Rect.left, m_Rect.top); |
| 1386 } else { | 1335 } else { |
| 1387 m_pDevice->StretchDIBits(m_pBitmap, m_Rect.left, m_Rect.top, m_Rect.
Width(), m_Rect.Height()); | 1336 m_pDevice->StretchDIBits(m_pBitmap, m_Rect.left, m_Rect.top, m_Rect.
Width(), m_Rect.Height()); |
| 1388 } | 1337 } |
| 1389 } else { | 1338 } else { |
| 1390 #if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) | |
| 1391 CFX_DIBitmap buffer; | 1339 CFX_DIBitmap buffer; |
| 1392 m_pDevice->CreateCompatibleBitmap(&buffer, m_pBitmap->GetWidth(), m_pBit
map->GetHeight()); | 1340 m_pDevice->CreateCompatibleBitmap(&buffer, m_pBitmap->GetWidth(), m_pBit
map->GetHeight()); |
| 1393 m_pContext->GetBackground(&buffer, m_pObject, NULL, &m_Matrix); | 1341 m_pContext->GetBackground(&buffer, m_pObject, NULL, &m_Matrix); |
| 1394 buffer.CompositeBitmap(0, 0, buffer.GetWidth(), buffer.GetHeight(), m_pB
itmap, 0, 0); | 1342 buffer.CompositeBitmap(0, 0, buffer.GetWidth(), buffer.GetHeight(), m_pB
itmap, 0, 0); |
| 1395 m_pDevice->StretchDIBits(&buffer, m_Rect.left, m_Rect.top, m_Rect.Width(
), m_Rect.Height()); | 1343 m_pDevice->StretchDIBits(&buffer, m_Rect.left, m_Rect.top, m_Rect.Width(
), m_Rect.Height()); |
| 1396 #endif | |
| 1397 } | 1344 } |
| 1398 } | 1345 } |
| 1399 CPDF_ScaledRenderBuffer::CPDF_ScaledRenderBuffer() | 1346 CPDF_ScaledRenderBuffer::CPDF_ScaledRenderBuffer() |
| 1400 { | 1347 { |
| 1401 m_pBitmapDevice = NULL; | 1348 m_pBitmapDevice = NULL; |
| 1402 } | 1349 } |
| 1403 CPDF_ScaledRenderBuffer::~CPDF_ScaledRenderBuffer() | 1350 CPDF_ScaledRenderBuffer::~CPDF_ScaledRenderBuffer() |
| 1404 { | 1351 { |
| 1405 if (m_pBitmapDevice) { | 1352 if (m_pBitmapDevice) { |
| 1406 delete m_pBitmapDevice; | 1353 delete m_pBitmapDevice; |
| 1407 } | 1354 } |
| 1408 } | 1355 } |
| 1409 #ifndef _FPDFAPI_MINI_ | |
| 1410 #define _FPDFAPI_IMAGESIZE_LIMIT_ (30 * 1024 * 1024) | 1356 #define _FPDFAPI_IMAGESIZE_LIMIT_ (30 * 1024 * 1024) |
| 1411 #else | |
| 1412 #define _FPDFAPI_IMAGESIZE_LIMIT_ (10 * 1024 * 1024) | |
| 1413 #endif | |
| 1414 FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, CFX_Re
nderDevice* pDevice, FX_RECT* pRect, | 1357 FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, CFX_Re
nderDevice* pDevice, FX_RECT* pRect, |
| 1415 const CPDF_PageObject* pObj, const CPDF_RenderOptions *pOptions, int max
_dpi) | 1358 const CPDF_PageObject* pObj, const CPDF_RenderOptions *pOptions, int max
_dpi) |
| 1416 { | 1359 { |
| 1417 FXSYS_assert(pRect != NULL); | 1360 FXSYS_assert(pRect != NULL); |
| 1418 m_pDevice = pDevice; | 1361 m_pDevice = pDevice; |
| 1419 if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) { | 1362 if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) { |
| 1420 return TRUE; | 1363 return TRUE; |
| 1421 } | 1364 } |
| 1422 m_pContext = pContext; | 1365 m_pContext = pContext; |
| 1423 m_Rect = *pRect; | 1366 m_Rect = *pRect; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1453 iPitch = (iWidth * bpp + 31) / 32 * 4; | 1396 iPitch = (iWidth * bpp + 31) / 32 * 4; |
| 1454 if (iWidth * iHeight < 1) { | 1397 if (iWidth * iHeight < 1) { |
| 1455 return FALSE; | 1398 return FALSE; |
| 1456 } | 1399 } |
| 1457 if (iPitch * iHeight <= _FPDFAPI_IMAGESIZE_LIMIT_ && | 1400 if (iPitch * iHeight <= _FPDFAPI_IMAGESIZE_LIMIT_ && |
| 1458 m_pBitmapDevice->Create(iWidth, iHeight, dibFormat)) { | 1401 m_pBitmapDevice->Create(iWidth, iHeight, dibFormat)) { |
| 1459 break; | 1402 break; |
| 1460 } | 1403 } |
| 1461 m_Matrix.Scale(0.5f, 0.5f); | 1404 m_Matrix.Scale(0.5f, 0.5f); |
| 1462 } | 1405 } |
| 1463 #if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) | |
| 1464 m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject, pOptions,
&m_Matrix); | 1406 m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject, pOptions,
&m_Matrix); |
| 1465 #endif | |
| 1466 return TRUE; | 1407 return TRUE; |
| 1467 } | 1408 } |
| 1468 void CPDF_ScaledRenderBuffer::OutputToDevice() | 1409 void CPDF_ScaledRenderBuffer::OutputToDevice() |
| 1469 { | 1410 { |
| 1470 if (m_pBitmapDevice) { | 1411 if (m_pBitmapDevice) { |
| 1471 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, m_Re
ct.top, m_Rect.Width(), m_Rect.Height()); | 1412 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, m_Re
ct.top, m_Rect.Width(), m_Rect.Height()); |
| 1472 } | 1413 } |
| 1473 } | 1414 } |
| 1474 FX_BOOL IPDF_OCContext::CheckObjectVisible(const CPDF_PageObject* pObj) | 1415 FX_BOOL IPDF_OCContext::CheckObjectVisible(const CPDF_PageObject* pObj) |
| 1475 { | 1416 { |
| 1476 const CPDF_ContentMarkData* pData = pObj->m_ContentMark; | 1417 const CPDF_ContentMarkData* pData = pObj->m_ContentMark; |
| 1477 int nItems = pData->CountItems(); | 1418 int nItems = pData->CountItems(); |
| 1478 for (int i = 0; i < nItems; i ++) { | 1419 for (int i = 0; i < nItems; i ++) { |
| 1479 CPDF_ContentMarkItem& item = pData->GetItem(i); | 1420 CPDF_ContentMarkItem& item = pData->GetItem(i); |
| 1480 if (item.GetName() == FX_BSTRC("OC") && item.GetParamType() == CPDF_Cont
entMarkItem::PropertiesDict) { | 1421 if (item.GetName() == FX_BSTRC("OC") && item.GetParamType() == CPDF_Cont
entMarkItem::PropertiesDict) { |
| 1481 CPDF_Dictionary* pOCG = (CPDF_Dictionary*)item.GetParam(); | 1422 CPDF_Dictionary* pOCG = (CPDF_Dictionary*)item.GetParam(); |
| 1482 if (!CheckOCGVisible(pOCG)) { | 1423 if (!CheckOCGVisible(pOCG)) { |
| 1483 return FALSE; | 1424 return FALSE; |
| 1484 } | 1425 } |
| 1485 } | 1426 } |
| 1486 } | 1427 } |
| 1487 return TRUE; | 1428 return TRUE; |
| 1488 } | 1429 } |
| OLD | NEW |