| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "core/src/fpdfapi/fpdf_render/render_int.h" | 7 #include "core/src/fpdfapi/fpdf_render/render_int.h" |
| 8 | 8 |
| 9 #include "core/include/fpdfapi/fpdf_module.h" | 9 #include "core/include/fpdfapi/fpdf_module.h" |
| 10 #include "core/include/fpdfapi/fpdf_render.h" | 10 #include "core/include/fpdfapi/fpdf_render.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 m_pCurObj = pObj; | 299 m_pCurObj = pObj; |
| 300 if (m_Options.m_pOCContext && pObj->m_ContentMark.NotNull() && | 300 if (m_Options.m_pOCContext && pObj->m_ContentMark.NotNull() && |
| 301 !m_Options.m_pOCContext->CheckObjectVisible(pObj)) { | 301 !m_Options.m_pOCContext->CheckObjectVisible(pObj)) { |
| 302 return FALSE; | 302 return FALSE; |
| 303 } | 303 } |
| 304 | 304 |
| 305 ProcessClipPath(pObj->m_ClipPath, pObj2Device); | 305 ProcessClipPath(pObj->m_ClipPath, pObj2Device); |
| 306 if (ProcessTransparency(pObj, pObj2Device)) | 306 if (ProcessTransparency(pObj, pObj2Device)) |
| 307 return FALSE; | 307 return FALSE; |
| 308 | 308 |
| 309 if (pObj->m_Type == CPDF_PageObject::IMAGE) { | 309 if (pObj->IsImage()) { |
| 310 m_pObjectRenderer.reset(IPDF_ObjectRenderer::Create(pObj->m_Type)); | 310 m_pObjectRenderer.reset(IPDF_ObjectRenderer::Create()); |
| 311 if (!m_pObjectRenderer->Start(this, pObj, pObj2Device, FALSE)) { | 311 if (!m_pObjectRenderer->Start(this, pObj, pObj2Device, FALSE)) { |
| 312 if (!m_pObjectRenderer->m_Result) | 312 if (!m_pObjectRenderer->m_Result) |
| 313 DrawObjWithBackground(pObj, pObj2Device); | 313 DrawObjWithBackground(pObj, pObj2Device); |
| 314 m_pObjectRenderer.reset(); | 314 m_pObjectRenderer.reset(); |
| 315 return FALSE; | 315 return FALSE; |
| 316 } | 316 } |
| 317 return ContinueSingleObject(pObj, pObj2Device, pPause); | 317 return ContinueSingleObject(pObj, pObj2Device, pPause); |
| 318 } | 318 } |
| 319 | 319 |
| 320 ProcessObjectNoClip(pObj, pObj2Device); | 320 ProcessObjectNoClip(pObj, pObj2Device); |
| 321 return FALSE; | 321 return FALSE; |
| 322 } | 322 } |
| 323 | 323 |
| 324 IPDF_ObjectRenderer* IPDF_ObjectRenderer::Create(int type) { | 324 IPDF_ObjectRenderer* IPDF_ObjectRenderer::Create() { |
| 325 if (type != CPDF_PageObject::IMAGE) { | |
| 326 return NULL; | |
| 327 } | |
| 328 return new CPDF_ImageRenderer; | 325 return new CPDF_ImageRenderer; |
| 329 } | 326 } |
| 327 |
| 330 FX_BOOL CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj, | 328 FX_BOOL CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj, |
| 331 const CFX_Matrix* pObj2Device, | 329 const CFX_Matrix* pObj2Device, |
| 332 FX_BOOL bLogical, | 330 FX_BOOL bLogical, |
| 333 FX_RECT& rect) const { | 331 FX_RECT& rect) const { |
| 334 rect = pObj->GetBBox(pObj2Device); | 332 rect = pObj->GetBBox(pObj2Device); |
| 335 FX_RECT rtClip = m_pDevice->GetClipBox(); | 333 FX_RECT rtClip = m_pDevice->GetClipBox(); |
| 336 if (!bLogical) { | 334 if (!bLogical) { |
| 337 CFX_Matrix dCTM = m_pDevice->GetCTM(); | 335 CFX_Matrix dCTM = m_pDevice->GetCTM(); |
| 338 FX_FLOAT a = FXSYS_fabs(dCTM.a); | 336 FX_FLOAT a = FXSYS_fabs(dCTM.a); |
| 339 FX_FLOAT d = FXSYS_fabs(dCTM.d); | 337 FX_FLOAT d = FXSYS_fabs(dCTM.d); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 367 pBitmap->DitherFS(pal, 8, &rect); | 365 pBitmap->DitherFS(pal, 8, &rect); |
| 368 } else if (m_DitherBits == 4) { | 366 } else if (m_DitherBits == 4) { |
| 369 static FX_ARGB pal[16] = {0, 17, 34, 51, 68, 85, 102, 119, | 367 static FX_ARGB pal[16] = {0, 17, 34, 51, 68, 85, 102, 119, |
| 370 136, 153, 170, 187, 204, 221, 238, 255}; | 368 136, 153, 170, 187, 204, 221, 238, 255}; |
| 371 pBitmap->DitherFS(pal, 16, &rect); | 369 pBitmap->DitherFS(pal, 16, &rect); |
| 372 } | 370 } |
| 373 } | 371 } |
| 374 void CPDF_RenderStatus::ProcessObjectNoClip(const CPDF_PageObject* pObj, | 372 void CPDF_RenderStatus::ProcessObjectNoClip(const CPDF_PageObject* pObj, |
| 375 const CFX_Matrix* pObj2Device) { | 373 const CFX_Matrix* pObj2Device) { |
| 376 FX_BOOL bRet = FALSE; | 374 FX_BOOL bRet = FALSE; |
| 377 switch (pObj->m_Type) { | 375 switch (pObj->GetType()) { |
| 378 case CPDF_PageObject::TEXT: | 376 case CPDF_PageObject::TEXT: |
| 379 bRet = ProcessText((CPDF_TextObject*)pObj, pObj2Device, NULL); | 377 bRet = ProcessText(pObj->AsText(), pObj2Device, NULL); |
| 380 break; | 378 break; |
| 381 case CPDF_PageObject::PATH: | 379 case CPDF_PageObject::PATH: |
| 382 bRet = ProcessPath((CPDF_PathObject*)pObj, pObj2Device); | 380 bRet = ProcessPath(pObj->AsPath(), pObj2Device); |
| 383 break; | 381 break; |
| 384 case CPDF_PageObject::IMAGE: | 382 case CPDF_PageObject::IMAGE: |
| 385 bRet = ProcessImage((CPDF_ImageObject*)pObj, pObj2Device); | 383 bRet = ProcessImage(pObj->AsImage(), pObj2Device); |
| 386 break; | 384 break; |
| 387 case CPDF_PageObject::SHADING: | 385 case CPDF_PageObject::SHADING: |
| 388 bRet = ProcessShading((CPDF_ShadingObject*)pObj, pObj2Device); | 386 bRet = ProcessShading(pObj->AsShading(), pObj2Device); |
| 389 break; | 387 break; |
| 390 case CPDF_PageObject::FORM: | 388 case CPDF_PageObject::FORM: |
| 391 bRet = ProcessForm((CPDF_FormObject*)pObj, pObj2Device); | 389 bRet = ProcessForm(pObj->AsForm(), pObj2Device); |
| 392 break; | 390 break; |
| 393 } | 391 } |
| 394 if (!bRet) { | 392 if (!bRet) { |
| 395 DrawObjWithBackground(pObj, pObj2Device); | 393 DrawObjWithBackground(pObj, pObj2Device); |
| 396 } | 394 } |
| 397 } | 395 } |
| 398 FX_BOOL CPDF_RenderStatus::DrawObjWithBlend(const CPDF_PageObject* pObj, | 396 FX_BOOL CPDF_RenderStatus::DrawObjWithBlend(const CPDF_PageObject* pObj, |
| 399 const CFX_Matrix* pObj2Device) { | 397 const CFX_Matrix* pObj2Device) { |
| 400 FX_BOOL bRet = FALSE; | 398 FX_BOOL bRet = FALSE; |
| 401 switch (pObj->m_Type) { | 399 switch (pObj->GetType()) { |
| 402 case CPDF_PageObject::PATH: | 400 case CPDF_PageObject::PATH: |
| 403 bRet = ProcessPath((CPDF_PathObject*)pObj, pObj2Device); | 401 bRet = ProcessPath(pObj->AsPath(), pObj2Device); |
| 404 break; | 402 break; |
| 405 case CPDF_PageObject::IMAGE: | 403 case CPDF_PageObject::IMAGE: |
| 406 bRet = ProcessImage((CPDF_ImageObject*)pObj, pObj2Device); | 404 bRet = ProcessImage(pObj->AsImage(), pObj2Device); |
| 407 break; | 405 break; |
| 408 case CPDF_PageObject::FORM: | 406 case CPDF_PageObject::FORM: |
| 409 bRet = ProcessForm((CPDF_FormObject*)pObj, pObj2Device); | 407 bRet = ProcessForm(pObj->AsForm(), pObj2Device); |
| 410 break; | 408 break; |
| 411 default: | 409 default: |
| 412 break; | 410 break; |
| 413 } | 411 } |
| 414 return bRet; | 412 return bRet; |
| 415 } | 413 } |
| 416 void CPDF_RenderStatus::GetScaledMatrix(CFX_Matrix& matrix) const { | 414 void CPDF_RenderStatus::GetScaledMatrix(CFX_Matrix& matrix) const { |
| 417 CFX_Matrix dCTM = m_pDevice->GetCTM(); | 415 CFX_Matrix dCTM = m_pDevice->GetCTM(); |
| 418 matrix.a *= FXSYS_fabs(dCTM.a); | 416 matrix.a *= FXSYS_fabs(dCTM.a); |
| 419 matrix.d *= FXSYS_fabs(dCTM.d); | 417 matrix.d *= FXSYS_fabs(dCTM.d); |
| 420 } | 418 } |
| 421 void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, | 419 void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, |
| 422 const CFX_Matrix* pObj2Device) { | 420 const CFX_Matrix* pObj2Device) { |
| 423 FX_RECT rect; | 421 FX_RECT rect; |
| 424 if (GetObjectClippedRect(pObj, pObj2Device, FALSE, rect)) { | 422 if (GetObjectClippedRect(pObj, pObj2Device, FALSE, rect)) { |
| 425 return; | 423 return; |
| 426 } | 424 } |
| 427 int res = 300; | 425 int res = 300; |
| 428 if (pObj->m_Type == CPDF_PageObject::IMAGE && | 426 if (pObj->IsImage() && |
| 429 m_pDevice->GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER) { | 427 m_pDevice->GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER) { |
| 430 res = 0; | 428 res = 0; |
| 431 } | 429 } |
| 432 CPDF_ScaledRenderBuffer buffer; | 430 CPDF_ScaledRenderBuffer buffer; |
| 433 if (!buffer.Initialize(m_pContext, m_pDevice, rect, pObj, &m_Options, res)) { | 431 if (!buffer.Initialize(m_pContext, m_pDevice, rect, pObj, &m_Options, res)) { |
| 434 return; | 432 return; |
| 435 } | 433 } |
| 436 CFX_Matrix matrix = *pObj2Device; | 434 CFX_Matrix matrix = *pObj2Device; |
| 437 matrix.Concat(*buffer.GetMatrix()); | 435 matrix.Concat(*buffer.GetMatrix()); |
| 438 GetScaledMatrix(matrix); | 436 GetScaledMatrix(matrix); |
| 439 CPDF_Dictionary* pFormResource = NULL; | 437 CPDF_Dictionary* pFormResource = NULL; |
| 440 if (pObj->m_Type == CPDF_PageObject::FORM) { | 438 if (pObj->IsForm()) { |
| 441 CPDF_FormObject* pFormObj = (CPDF_FormObject*)pObj; | 439 const CPDF_FormObject* pFormObj = pObj->AsForm(); |
| 442 if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { | 440 if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { |
| 443 pFormResource = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); | 441 pFormResource = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); |
| 444 } | 442 } |
| 445 } | 443 } |
| 446 CPDF_RenderStatus status; | 444 CPDF_RenderStatus status; |
| 447 status.Initialize(m_pContext, buffer.GetDevice(), buffer.GetMatrix(), NULL, | 445 status.Initialize(m_pContext, buffer.GetDevice(), buffer.GetMatrix(), NULL, |
| 448 NULL, NULL, &m_Options, m_Transparency, m_bDropObjects, | 446 NULL, NULL, &m_Options, m_Transparency, m_bDropObjects, |
| 449 pFormResource); | 447 pFormResource); |
| 450 status.RenderSingleObject(pObj, &matrix); | 448 status.RenderSingleObject(pObj, &matrix); |
| 451 buffer.OutputToDevice(); | 449 buffer.OutputToDevice(); |
| 452 } | 450 } |
| 453 FX_BOOL CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj, | 451 FX_BOOL CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj, |
| 454 const CFX_Matrix* pObj2Device) { | 452 const CFX_Matrix* pObj2Device) { |
| 455 CPDF_Dictionary* pOC = pFormObj->m_pForm->m_pFormDict->GetDictBy("OC"); | 453 CPDF_Dictionary* pOC = pFormObj->m_pForm->m_pFormDict->GetDictBy("OC"); |
| 456 if (pOC && m_Options.m_pOCContext && | 454 if (pOC && m_Options.m_pOCContext && |
| 457 !m_Options.m_pOCContext->CheckOCGVisible(pOC)) { | 455 !m_Options.m_pOCContext->CheckOCGVisible(pOC)) { |
| 458 return TRUE; | 456 return TRUE; |
| 459 } | 457 } |
| 460 CFX_Matrix matrix = pFormObj->m_FormMatrix; | 458 CFX_Matrix matrix = pFormObj->m_FormMatrix; |
| 461 matrix.Concat(*pObj2Device); | 459 matrix.Concat(*pObj2Device); |
| 462 CPDF_Dictionary* pResources = NULL; | 460 CPDF_Dictionary* pResources = NULL; |
| 463 if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { | 461 if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 476 } | 474 } |
| 477 FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix) { | 475 FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix) { |
| 478 if (matrix.a == 0 || matrix.d == 0) { | 476 if (matrix.a == 0 || matrix.d == 0) { |
| 479 return matrix.b != 0 && matrix.c != 0; | 477 return matrix.b != 0 && matrix.c != 0; |
| 480 } | 478 } |
| 481 if (matrix.b == 0 || matrix.c == 0) { | 479 if (matrix.b == 0 || matrix.c == 0) { |
| 482 return matrix.a != 0 && matrix.d != 0; | 480 return matrix.a != 0 && matrix.d != 0; |
| 483 } | 481 } |
| 484 return TRUE; | 482 return TRUE; |
| 485 } | 483 } |
| 486 FX_BOOL CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj, | 484 FX_BOOL CPDF_RenderStatus::ProcessPath(const CPDF_PathObject* pPathObj, |
| 487 const CFX_Matrix* pObj2Device) { | 485 const CFX_Matrix* pObj2Device) { |
| 488 int FillType = pPathObj->m_FillType; | 486 int FillType = pPathObj->m_FillType; |
| 489 FX_BOOL bStroke = pPathObj->m_bStroke; | 487 FX_BOOL bStroke = pPathObj->m_bStroke; |
| 490 ProcessPathPattern(pPathObj, pObj2Device, FillType, bStroke); | 488 ProcessPathPattern(pPathObj, pObj2Device, FillType, bStroke); |
| 491 if (FillType == 0 && !bStroke) { | 489 if (FillType == 0 && !bStroke) { |
| 492 return TRUE; | 490 return TRUE; |
| 493 } | 491 } |
| 494 FX_DWORD fill_argb = 0; | 492 FX_DWORD fill_argb = 0; |
| 495 if (FillType) { | 493 if (FillType) { |
| 496 fill_argb = GetFillArgb(pPathObj); | 494 fill_argb = GetFillArgb(pPathObj); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 continue; | 682 continue; |
| 685 } | 683 } |
| 686 CFX_GraphStateData stroke_state; | 684 CFX_GraphStateData stroke_state; |
| 687 if (m_Options.m_Flags & RENDER_THINLINE) { | 685 if (m_Options.m_Flags & RENDER_THINLINE) { |
| 688 stroke_state.m_LineWidth = 0; | 686 stroke_state.m_LineWidth = 0; |
| 689 } | 687 } |
| 690 m_pDevice->DrawPath(pPathData, pObj2Device, &stroke_state, 0, 0xffff0000, | 688 m_pDevice->DrawPath(pPathData, pObj2Device, &stroke_state, 0, 0xffff0000, |
| 691 fill_mode); | 689 fill_mode); |
| 692 } | 690 } |
| 693 } | 691 } |
| 694 FX_BOOL CPDF_RenderStatus::SelectClipPath(CPDF_PathObject* pPathObj, | 692 FX_BOOL CPDF_RenderStatus::SelectClipPath(const CPDF_PathObject* pPathObj, |
| 695 const CFX_Matrix* pObj2Device, | 693 const CFX_Matrix* pObj2Device, |
| 696 FX_BOOL bStroke) { | 694 FX_BOOL bStroke) { |
| 697 CFX_Matrix path_matrix = pPathObj->m_Matrix; | 695 CFX_Matrix path_matrix = pPathObj->m_Matrix; |
| 698 path_matrix.Concat(*pObj2Device); | 696 path_matrix.Concat(*pObj2Device); |
| 699 if (bStroke) { | 697 if (bStroke) { |
| 700 CFX_GraphStateData graphState(*pPathObj->m_GraphState); | 698 CFX_GraphStateData graphState(*pPathObj->m_GraphState); |
| 701 if (m_Options.m_Flags & RENDER_THINLINE) { | 699 if (m_Options.m_Flags & RENDER_THINLINE) { |
| 702 graphState.m_LineWidth = 0; | 700 graphState.m_LineWidth = 0; |
| 703 } | 701 } |
| 704 return m_pDevice->SetClip_PathStroke(pPathObj->m_Path, &path_matrix, | 702 return m_pDevice->SetClip_PathStroke(pPathObj->m_Path, &path_matrix, |
| 705 &graphState); | 703 &graphState); |
| 706 } | 704 } |
| 707 int fill_mode = pPathObj->m_FillType; | 705 int fill_mode = pPathObj->m_FillType; |
| 708 if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) { | 706 if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) { |
| 709 fill_mode |= FXFILL_NOPATHSMOOTH; | 707 fill_mode |= FXFILL_NOPATHSMOOTH; |
| 710 } | 708 } |
| 711 return m_pDevice->SetClip_PathFill(pPathObj->m_Path, &path_matrix, fill_mode); | 709 return m_pDevice->SetClip_PathFill(pPathObj->m_Path, &path_matrix, fill_mode); |
| 712 } | 710 } |
| 713 FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, | 711 FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, |
| 714 const CFX_Matrix* pObj2Device) { | 712 const CFX_Matrix* pObj2Device) { |
| 715 const CPDF_GeneralStateData* pGeneralState = pPageObj->m_GeneralState; | 713 const CPDF_GeneralStateData* pGeneralState = pPageObj->m_GeneralState; |
| 716 int blend_type = | 714 int blend_type = |
| 717 pGeneralState ? pGeneralState->m_BlendType : FXDIB_BLEND_NORMAL; | 715 pGeneralState ? pGeneralState->m_BlendType : FXDIB_BLEND_NORMAL; |
| 718 if (blend_type == FXDIB_BLEND_UNSUPPORTED) { | 716 if (blend_type == FXDIB_BLEND_UNSUPPORTED) { |
| 719 return TRUE; | 717 return TRUE; |
| 720 } | 718 } |
| 721 CPDF_Dictionary* pSMaskDict = | 719 CPDF_Dictionary* pSMaskDict = |
| 722 pGeneralState ? ToDictionary(pGeneralState->m_pSoftMask) : NULL; | 720 pGeneralState ? ToDictionary(pGeneralState->m_pSoftMask) : NULL; |
| 723 if (pSMaskDict) { | 721 if (pSMaskDict) { |
| 724 if (pPageObj->m_Type == CPDF_PageObject::IMAGE && | 722 if (pPageObj->IsImage() && |
| 725 ((CPDF_ImageObject*)pPageObj)->m_pImage->GetDict()->KeyExist("SMask")) { | 723 pPageObj->AsImage()->m_pImage->GetDict()->KeyExist("SMask")) { |
| 726 pSMaskDict = NULL; | 724 pSMaskDict = NULL; |
| 727 } | 725 } |
| 728 } | 726 } |
| 729 CPDF_Dictionary* pFormResource = NULL; | 727 CPDF_Dictionary* pFormResource = NULL; |
| 730 FX_FLOAT group_alpha = 1.0f; | 728 FX_FLOAT group_alpha = 1.0f; |
| 731 int Transparency = m_Transparency; | 729 int Transparency = m_Transparency; |
| 732 FX_BOOL bGroupTransparent = FALSE; | 730 FX_BOOL bGroupTransparent = FALSE; |
| 733 if (pPageObj->m_Type == CPDF_PageObject::FORM) { | 731 if (pPageObj->IsForm()) { |
| 734 CPDF_FormObject* pFormObj = (CPDF_FormObject*)pPageObj; | 732 const CPDF_FormObject* pFormObj = pPageObj->AsForm(); |
| 735 const CPDF_GeneralStateData* pStateData = | 733 const CPDF_GeneralStateData* pStateData = |
| 736 pFormObj->m_GeneralState.GetObject(); | 734 pFormObj->m_GeneralState.GetObject(); |
| 737 if (pStateData) { | 735 if (pStateData) { |
| 738 group_alpha = pStateData->m_FillAlpha; | 736 group_alpha = pStateData->m_FillAlpha; |
| 739 } | 737 } |
| 740 Transparency = pFormObj->m_pForm->m_Transparency; | 738 Transparency = pFormObj->m_pForm->m_Transparency; |
| 741 bGroupTransparent = !!(Transparency & PDFTRANS_ISOLATED); | 739 bGroupTransparent = !!(Transparency & PDFTRANS_ISOLATED); |
| 742 if (pFormObj->m_pForm->m_pFormDict) { | 740 if (pFormObj->m_pForm->m_pFormDict) { |
| 743 pFormResource = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); | 741 pFormResource = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); |
| 744 } | 742 } |
| 745 } | 743 } |
| 746 FX_BOOL bTextClip = FALSE; | 744 FX_BOOL bTextClip = FALSE; |
| 747 if (pPageObj->m_ClipPath.NotNull() && pPageObj->m_ClipPath.GetTextCount() && | 745 if (pPageObj->m_ClipPath.NotNull() && pPageObj->m_ClipPath.GetTextCount() && |
| 748 m_pDevice->GetDeviceClass() == FXDC_DISPLAY && | 746 m_pDevice->GetDeviceClass() == FXDC_DISPLAY && |
| 749 !(m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_SOFT_CLIP)) { | 747 !(m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_SOFT_CLIP)) { |
| 750 bTextClip = TRUE; | 748 bTextClip = TRUE; |
| 751 } | 749 } |
| 752 if ((m_Options.m_Flags & RENDER_OVERPRINT) && | 750 if ((m_Options.m_Flags & RENDER_OVERPRINT) && pPageObj->IsImage() && |
| 753 pPageObj->m_Type == CPDF_PageObject::IMAGE && pGeneralState && | 751 pGeneralState && pGeneralState->m_FillOP && pGeneralState->m_StrokeOP) { |
| 754 pGeneralState->m_FillOP && pGeneralState->m_StrokeOP) { | |
| 755 CPDF_Document* pDocument = NULL; | 752 CPDF_Document* pDocument = NULL; |
| 756 CPDF_Page* pPage = NULL; | 753 CPDF_Page* pPage = NULL; |
| 757 if (m_pContext->GetPageCache()) { | 754 if (m_pContext->GetPageCache()) { |
| 758 pPage = m_pContext->GetPageCache()->GetPage(); | 755 pPage = m_pContext->GetPageCache()->GetPage(); |
| 759 pDocument = pPage->m_pDocument; | 756 pDocument = pPage->m_pDocument; |
| 760 } else { | 757 } else { |
| 761 pDocument = ((CPDF_ImageObject*)pPageObj)->m_pImage->GetDocument(); | 758 pDocument = pPageObj->AsImage()->m_pImage->GetDocument(); |
| 762 } | 759 } |
| 763 CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : NULL; | 760 CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : NULL; |
| 764 CPDF_Object* pCSObj = ((CPDF_ImageObject*)pPageObj) | 761 CPDF_Object* pCSObj = |
| 765 ->m_pImage->GetStream() | 762 pPageObj->AsImage()->m_pImage->GetStream()->GetDict()->GetElementValue( |
| 766 ->GetDict() | 763 "ColorSpace"); |
| 767 ->GetElementValue("ColorSpace"); | |
| 768 CPDF_ColorSpace* pColorSpace = | 764 CPDF_ColorSpace* pColorSpace = |
| 769 pDocument->LoadColorSpace(pCSObj, pPageResources); | 765 pDocument->LoadColorSpace(pCSObj, pPageResources); |
| 770 if (pColorSpace) { | 766 if (pColorSpace) { |
| 771 int format = pColorSpace->GetFamily(); | 767 int format = pColorSpace->GetFamily(); |
| 772 if (format == PDFCS_DEVICECMYK || format == PDFCS_SEPARATION || | 768 if (format == PDFCS_DEVICECMYK || format == PDFCS_SEPARATION || |
| 773 format == PDFCS_DEVICEN) { | 769 format == PDFCS_DEVICEN) { |
| 774 blend_type = FXDIB_BLEND_DARKEN; | 770 blend_type = FXDIB_BLEND_DARKEN; |
| 775 } | 771 } |
| 776 pDocument->GetPageData()->ReleaseColorSpace(pCSObj); | 772 pDocument->GetPageData()->ReleaseColorSpace(pCSObj); |
| 777 } | 773 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 bitmap->MultiplyAlpha(pSMaskSource.get()); | 859 bitmap->MultiplyAlpha(pSMaskSource.get()); |
| 864 } | 860 } |
| 865 if (pTextMask) { | 861 if (pTextMask) { |
| 866 bitmap->MultiplyAlpha(pTextMask.get()); | 862 bitmap->MultiplyAlpha(pTextMask.get()); |
| 867 pTextMask.reset(); | 863 pTextMask.reset(); |
| 868 } | 864 } |
| 869 if (Transparency & PDFTRANS_GROUP && group_alpha != 1.0f) { | 865 if (Transparency & PDFTRANS_GROUP && group_alpha != 1.0f) { |
| 870 bitmap->MultiplyAlpha((int32_t)(group_alpha * 255)); | 866 bitmap->MultiplyAlpha((int32_t)(group_alpha * 255)); |
| 871 } | 867 } |
| 872 Transparency = m_Transparency; | 868 Transparency = m_Transparency; |
| 873 if (pPageObj->m_Type == CPDF_PageObject::FORM) { | 869 if (pPageObj->IsForm()) { |
| 874 Transparency |= PDFTRANS_GROUP; | 870 Transparency |= PDFTRANS_GROUP; |
| 875 } | 871 } |
| 876 CompositeDIBitmap(bitmap, rect.left, rect.top, 0, 255, blend_type, | 872 CompositeDIBitmap(bitmap, rect.left, rect.top, 0, 255, blend_type, |
| 877 Transparency); | 873 Transparency); |
| 878 return TRUE; | 874 return TRUE; |
| 879 } | 875 } |
| 880 | 876 |
| 881 CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj, | 877 CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj, |
| 882 const FX_RECT& rect, | 878 const FX_RECT& rect, |
| 883 int& left, | 879 int& left, |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 while (iter != iterEnd) { | 1077 while (iter != iterEnd) { |
| 1082 CPDF_PageObject* pCurObj = iter->get(); | 1078 CPDF_PageObject* pCurObj = iter->get(); |
| 1083 if (pCurObj && pCurObj->m_Left <= m_ClipRect.right && | 1079 if (pCurObj && pCurObj->m_Left <= m_ClipRect.right && |
| 1084 pCurObj->m_Right >= m_ClipRect.left && | 1080 pCurObj->m_Right >= m_ClipRect.left && |
| 1085 pCurObj->m_Bottom <= m_ClipRect.top && | 1081 pCurObj->m_Bottom <= m_ClipRect.top && |
| 1086 pCurObj->m_Top >= m_ClipRect.bottom) { | 1082 pCurObj->m_Top >= m_ClipRect.bottom) { |
| 1087 if (m_pRenderStatus->ContinueSingleObject( | 1083 if (m_pRenderStatus->ContinueSingleObject( |
| 1088 pCurObj, &m_pCurrentLayer->m_Matrix, pPause)) { | 1084 pCurObj, &m_pCurrentLayer->m_Matrix, pPause)) { |
| 1089 return; | 1085 return; |
| 1090 } | 1086 } |
| 1091 if (pCurObj->m_Type == CPDF_PageObject::IMAGE && | 1087 if (pCurObj->IsImage() && |
| 1092 m_pRenderStatus->m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { | 1088 m_pRenderStatus->m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { |
| 1093 m_pContext->GetPageCache()->CacheOptimization( | 1089 m_pContext->GetPageCache()->CacheOptimization( |
| 1094 m_pRenderStatus->m_Options.m_dwLimitCacheSize); | 1090 m_pRenderStatus->m_Options.m_dwLimitCacheSize); |
| 1095 } | 1091 } |
| 1096 if (pCurObj->m_Type == CPDF_PageObject::FORM || | 1092 if (pCurObj->IsForm() || pCurObj->IsShading()) { |
| 1097 pCurObj->m_Type == CPDF_PageObject::SHADING) { | |
| 1098 nObjsToGo = 0; | 1093 nObjsToGo = 0; |
| 1099 } else { | 1094 } else { |
| 1100 --nObjsToGo; | 1095 --nObjsToGo; |
| 1101 } | 1096 } |
| 1102 } | 1097 } |
| 1103 m_LastObjectRendered = iter; | 1098 m_LastObjectRendered = iter; |
| 1104 if (nObjsToGo == 0) { | 1099 if (nObjsToGo == 0) { |
| 1105 if (pPause && pPause->NeedToPauseNow()) | 1100 if (pPause && pPause->NeedToPauseNow()) |
| 1106 return; | 1101 return; |
| 1107 nObjsToGo = kStepLimit; | 1102 nObjsToGo = kStepLimit; |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1334 for (int i = 0; i < nItems; i++) { | 1329 for (int i = 0; i < nItems; i++) { |
| 1335 const CPDF_ContentMarkItem& item = pData->GetItem(i); | 1330 const CPDF_ContentMarkItem& item = pData->GetItem(i); |
| 1336 if (item.GetName() == "OC" && | 1331 if (item.GetName() == "OC" && |
| 1337 item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict && | 1332 item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict && |
| 1338 !CheckOCGVisible(item.GetParam())) { | 1333 !CheckOCGVisible(item.GetParam())) { |
| 1339 return FALSE; | 1334 return FALSE; |
| 1340 } | 1335 } |
| 1341 } | 1336 } |
| 1342 return TRUE; | 1337 return TRUE; |
| 1343 } | 1338 } |
| OLD | NEW |