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/fpdfapi/fpdf_render/render_int.h" | 7 #include "core/fpdfapi/fpdf_render/render_int.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 void CPDF_RenderStatus::RenderSingleObject(const CPDF_PageObject* pObj, | 253 void CPDF_RenderStatus::RenderSingleObject(const CPDF_PageObject* pObj, |
254 const CFX_Matrix* pObj2Device) { | 254 const CFX_Matrix* pObj2Device) { |
255 #if defined _SKIA_SUPPORT_ | 255 #if defined _SKIA_SUPPORT_ |
256 DebugVerifyDeviceIsPreMultiplied(); | 256 DebugVerifyDeviceIsPreMultiplied(); |
257 #endif | 257 #endif |
258 CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth); | 258 CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth); |
259 if (++s_CurrentRecursionDepth > kRenderMaxRecursionDepth) { | 259 if (++s_CurrentRecursionDepth > kRenderMaxRecursionDepth) { |
260 return; | 260 return; |
261 } | 261 } |
262 m_pCurObj = pObj; | 262 m_pCurObj = pObj; |
263 if (m_Options.m_pOCContext && pObj->m_ContentMark.NotNull()) { | 263 if (m_Options.m_pOCContext && pObj->m_ContentMark) { |
264 if (!m_Options.m_pOCContext->CheckObjectVisible(pObj)) { | 264 if (!m_Options.m_pOCContext->CheckObjectVisible(pObj)) { |
265 return; | 265 return; |
266 } | 266 } |
267 } | 267 } |
268 ProcessClipPath(pObj->m_ClipPath, pObj2Device); | 268 ProcessClipPath(pObj->m_ClipPath, pObj2Device); |
269 if (ProcessTransparency(pObj, pObj2Device)) { | 269 if (ProcessTransparency(pObj, pObj2Device)) { |
270 return; | 270 return; |
271 } | 271 } |
272 ProcessObjectNoClip(pObj, pObj2Device); | 272 ProcessObjectNoClip(pObj, pObj2Device); |
273 #if defined _SKIA_SUPPORT_ | 273 #if defined _SKIA_SUPPORT_ |
274 DebugVerifyDeviceIsPreMultiplied(); | 274 DebugVerifyDeviceIsPreMultiplied(); |
275 #endif | 275 #endif |
276 } | 276 } |
277 | 277 |
278 FX_BOOL CPDF_RenderStatus::ContinueSingleObject(const CPDF_PageObject* pObj, | 278 FX_BOOL CPDF_RenderStatus::ContinueSingleObject(const CPDF_PageObject* pObj, |
279 const CFX_Matrix* pObj2Device, | 279 const CFX_Matrix* pObj2Device, |
280 IFX_Pause* pPause) { | 280 IFX_Pause* pPause) { |
281 if (m_pImageRenderer) { | 281 if (m_pImageRenderer) { |
282 if (m_pImageRenderer->Continue(pPause)) | 282 if (m_pImageRenderer->Continue(pPause)) |
283 return TRUE; | 283 return TRUE; |
284 | 284 |
285 if (!m_pImageRenderer->m_Result) | 285 if (!m_pImageRenderer->m_Result) |
286 DrawObjWithBackground(pObj, pObj2Device); | 286 DrawObjWithBackground(pObj, pObj2Device); |
287 m_pImageRenderer.reset(); | 287 m_pImageRenderer.reset(); |
288 return FALSE; | 288 return FALSE; |
289 } | 289 } |
290 | 290 |
291 m_pCurObj = pObj; | 291 m_pCurObj = pObj; |
292 if (m_Options.m_pOCContext && pObj->m_ContentMark.NotNull() && | 292 if (m_Options.m_pOCContext && pObj->m_ContentMark && |
293 !m_Options.m_pOCContext->CheckObjectVisible(pObj)) { | 293 !m_Options.m_pOCContext->CheckObjectVisible(pObj)) { |
294 return FALSE; | 294 return FALSE; |
295 } | 295 } |
296 | 296 |
297 ProcessClipPath(pObj->m_ClipPath, pObj2Device); | 297 ProcessClipPath(pObj->m_ClipPath, pObj2Device); |
298 if (ProcessTransparency(pObj, pObj2Device)) | 298 if (ProcessTransparency(pObj, pObj2Device)) |
299 return FALSE; | 299 return FALSE; |
300 | 300 |
301 if (pObj->IsImage()) { | 301 if (pObj->IsImage()) { |
302 m_pImageRenderer.reset(new CPDF_ImageRenderer); | 302 m_pImageRenderer.reset(new CPDF_ImageRenderer); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 rgb = pGeneralData->m_pTransferFunc->TranslateColor(rgb); | 567 rgb = pGeneralData->m_pTransferFunc->TranslateColor(rgb); |
568 } | 568 } |
569 } | 569 } |
570 } else { | 570 } else { |
571 alpha = 255; | 571 alpha = 255; |
572 } | 572 } |
573 return m_Options.TranslateColor(ArgbEncode(alpha, rgb)); | 573 return m_Options.TranslateColor(ArgbEncode(alpha, rgb)); |
574 } | 574 } |
575 void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath, | 575 void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath, |
576 const CFX_Matrix* pObj2Device) { | 576 const CFX_Matrix* pObj2Device) { |
577 if (ClipPath.IsNull()) { | 577 if (!ClipPath) { |
578 if (!m_LastClipPath.IsNull()) { | 578 if (m_LastClipPath) { |
579 m_pDevice->RestoreState(true); | 579 m_pDevice->RestoreState(true); |
580 m_LastClipPath.SetNull(); | 580 m_LastClipPath.SetNull(); |
581 } | 581 } |
582 return; | 582 return; |
583 } | 583 } |
584 if (m_LastClipPath == ClipPath) | 584 if (m_LastClipPath == ClipPath) |
585 return; | 585 return; |
586 | 586 |
587 m_LastClipPath = ClipPath; | 587 m_LastClipPath = ClipPath; |
588 m_pDevice->RestoreState(true); | 588 m_pDevice->RestoreState(true); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 int fill_mode = FXFILL_WINDING; | 627 int fill_mode = FXFILL_WINDING; |
628 if (m_Options.m_Flags & RENDER_NOTEXTSMOOTH) | 628 if (m_Options.m_Flags & RENDER_NOTEXTSMOOTH) |
629 fill_mode |= FXFILL_NOPATHSMOOTH; | 629 fill_mode |= FXFILL_NOPATHSMOOTH; |
630 m_pDevice->SetClip_PathFill(pTextClippingPath.get(), nullptr, fill_mode); | 630 m_pDevice->SetClip_PathFill(pTextClippingPath.get(), nullptr, fill_mode); |
631 pTextClippingPath.reset(); | 631 pTextClippingPath.reset(); |
632 } | 632 } |
633 } | 633 } |
634 | 634 |
635 void CPDF_RenderStatus::DrawClipPath(CPDF_ClipPath ClipPath, | 635 void CPDF_RenderStatus::DrawClipPath(CPDF_ClipPath ClipPath, |
636 const CFX_Matrix* pObj2Device) { | 636 const CFX_Matrix* pObj2Device) { |
637 if (ClipPath.IsNull()) { | 637 if (!ClipPath) |
638 return; | 638 return; |
639 } | 639 |
640 int fill_mode = 0; | 640 int fill_mode = 0; |
641 if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) { | 641 if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) { |
642 fill_mode |= FXFILL_NOPATHSMOOTH; | 642 fill_mode |= FXFILL_NOPATHSMOOTH; |
643 } | 643 } |
644 int nClipPath = ClipPath.GetPathCount(); | 644 int nClipPath = ClipPath.GetPathCount(); |
645 int i; | 645 int i; |
646 for (i = 0; i < nClipPath; i++) { | 646 for (i = 0; i < nClipPath; i++) { |
647 const CFX_PathData* pPathData = ClipPath.GetPath(i).GetObject(); | 647 const CFX_PathData* pPathData = ClipPath.GetPath(i).GetObject(); |
648 if (!pPathData) { | 648 if (!pPathData) { |
649 continue; | 649 continue; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 pFormObj->m_GeneralState.GetObject(); | 706 pFormObj->m_GeneralState.GetObject(); |
707 if (pStateData) { | 707 if (pStateData) { |
708 group_alpha = pStateData->m_FillAlpha; | 708 group_alpha = pStateData->m_FillAlpha; |
709 } | 709 } |
710 Transparency = pFormObj->m_pForm->m_Transparency; | 710 Transparency = pFormObj->m_pForm->m_Transparency; |
711 bGroupTransparent = !!(Transparency & PDFTRANS_ISOLATED); | 711 bGroupTransparent = !!(Transparency & PDFTRANS_ISOLATED); |
712 if (pFormObj->m_pForm->m_pFormDict) { | 712 if (pFormObj->m_pForm->m_pFormDict) { |
713 pFormResource = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); | 713 pFormResource = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); |
714 } | 714 } |
715 } | 715 } |
716 FX_BOOL bTextClip = FALSE; | 716 bool bTextClip = |
717 if (pPageObj->m_ClipPath.NotNull() && pPageObj->m_ClipPath.GetTextCount() && | 717 (pPageObj->m_ClipPath && pPageObj->m_ClipPath.GetTextCount() && |
718 m_pDevice->GetDeviceClass() == FXDC_DISPLAY && | 718 m_pDevice->GetDeviceClass() == FXDC_DISPLAY && |
719 !(m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_SOFT_CLIP)) { | 719 !(m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_SOFT_CLIP)); |
720 bTextClip = TRUE; | |
721 } | |
722 if ((m_Options.m_Flags & RENDER_OVERPRINT) && pPageObj->IsImage() && | 720 if ((m_Options.m_Flags & RENDER_OVERPRINT) && pPageObj->IsImage() && |
723 pGeneralState && pGeneralState->m_FillOP && pGeneralState->m_StrokeOP) { | 721 pGeneralState && pGeneralState->m_FillOP && pGeneralState->m_StrokeOP) { |
724 CPDF_Document* pDocument = nullptr; | 722 CPDF_Document* pDocument = nullptr; |
725 CPDF_Page* pPage = nullptr; | 723 CPDF_Page* pPage = nullptr; |
726 if (m_pContext->GetPageCache()) { | 724 if (m_pContext->GetPageCache()) { |
727 pPage = m_pContext->GetPageCache()->GetPage(); | 725 pPage = m_pContext->GetPageCache()->GetPage(); |
728 pDocument = pPage->m_pDocument; | 726 pDocument = pPage->m_pDocument; |
729 } else { | 727 } else { |
730 pDocument = pPageObj->AsImage()->GetImage()->GetDocument(); | 728 pDocument = pPageObj->AsImage()->GetImage()->GetDocument(); |
731 } | 729 } |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, | 1294 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, |
1297 m_Rect.top, m_Rect.Width(), m_Rect.Height()); | 1295 m_Rect.top, m_Rect.Width(), m_Rect.Height()); |
1298 } | 1296 } |
1299 } | 1297 } |
1300 | 1298 |
1301 #if defined _SKIA_SUPPORT_ | 1299 #if defined _SKIA_SUPPORT_ |
1302 void CPDF_RenderStatus::DebugVerifyDeviceIsPreMultiplied() const { | 1300 void CPDF_RenderStatus::DebugVerifyDeviceIsPreMultiplied() const { |
1303 m_pDevice->DebugVerifyBitmapIsPreMultiplied(); | 1301 m_pDevice->DebugVerifyBitmapIsPreMultiplied(); |
1304 } | 1302 } |
1305 #endif | 1303 #endif |
OLD | NEW |