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 "render_int.h" | 7 #include "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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 while (pos) { | 251 while (pos) { |
252 index++; | 252 index++; |
253 CPDF_PageObject* pCurObj = pObjs->GetNextObject(pos); | 253 CPDF_PageObject* pCurObj = pObjs->GetNextObject(pos); |
254 if (pCurObj == m_pStopObj) { | 254 if (pCurObj == m_pStopObj) { |
255 m_bStopped = TRUE; | 255 m_bStopped = TRUE; |
256 return; | 256 return; |
257 } | 257 } |
258 if (!pCurObj) { | 258 if (!pCurObj) { |
259 continue; | 259 continue; |
260 } | 260 } |
261 if (pCurObj == NULL || pCurObj->m_Left > clip_rect.right || | 261 if (!pCurObj || pCurObj->m_Left > clip_rect.right || |
262 pCurObj->m_Right < clip_rect.left || | 262 pCurObj->m_Right < clip_rect.left || |
263 pCurObj->m_Bottom > clip_rect.top || | 263 pCurObj->m_Bottom > clip_rect.top || |
264 pCurObj->m_Top < clip_rect.bottom) { | 264 pCurObj->m_Top < clip_rect.bottom) { |
265 continue; | 265 continue; |
266 } | 266 } |
267 RenderSingleObject(pCurObj, pObj2Device); | 267 RenderSingleObject(pCurObj, pObj2Device); |
268 if (m_bStopped) { | 268 if (m_bStopped) { |
269 return; | 269 return; |
270 } | 270 } |
271 } | 271 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 rtClip.bottom = | 354 rtClip.bottom = |
355 rtClip.top + (int32_t)FXSYS_ceil((FX_FLOAT)rtClip.Height() * d); | 355 rtClip.top + (int32_t)FXSYS_ceil((FX_FLOAT)rtClip.Height() * d); |
356 } | 356 } |
357 } | 357 } |
358 rect.Intersect(rtClip); | 358 rect.Intersect(rtClip); |
359 return rect.IsEmpty(); | 359 return rect.IsEmpty(); |
360 } | 360 } |
361 void CPDF_RenderStatus::DitherObjectArea(const CPDF_PageObject* pObj, | 361 void CPDF_RenderStatus::DitherObjectArea(const CPDF_PageObject* pObj, |
362 const CFX_AffineMatrix* pObj2Device) { | 362 const CFX_AffineMatrix* pObj2Device) { |
363 CFX_DIBitmap* pBitmap = m_pDevice->GetBitmap(); | 363 CFX_DIBitmap* pBitmap = m_pDevice->GetBitmap(); |
364 if (pBitmap == NULL) { | 364 if (!pBitmap) { |
365 return; | 365 return; |
366 } | 366 } |
367 FX_RECT rect; | 367 FX_RECT rect; |
368 if (GetObjectClippedRect(pObj, pObj2Device, FALSE, rect)) { | 368 if (GetObjectClippedRect(pObj, pObj2Device, FALSE, rect)) { |
369 return; | 369 return; |
370 } | 370 } |
371 if (m_DitherBits == 2) { | 371 if (m_DitherBits == 2) { |
372 static FX_ARGB pal[4] = {0, 85, 170, 255}; | 372 static FX_ARGB pal[4] = {0, 85, 170, 255}; |
373 pBitmap->DitherFS(pal, 4, &rect); | 373 pBitmap->DitherFS(pal, 4, &rect); |
374 } else if (m_DitherBits == 3) { | 374 } else if (m_DitherBits == 3) { |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 return; | 686 return; |
687 } | 687 } |
688 int fill_mode = 0; | 688 int fill_mode = 0; |
689 if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) { | 689 if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) { |
690 fill_mode |= FXFILL_NOPATHSMOOTH; | 690 fill_mode |= FXFILL_NOPATHSMOOTH; |
691 } | 691 } |
692 int nClipPath = ClipPath.GetPathCount(); | 692 int nClipPath = ClipPath.GetPathCount(); |
693 int i; | 693 int i; |
694 for (i = 0; i < nClipPath; i++) { | 694 for (i = 0; i < nClipPath; i++) { |
695 const CFX_PathData* pPathData = ClipPath.GetPath(i); | 695 const CFX_PathData* pPathData = ClipPath.GetPath(i); |
696 if (pPathData == NULL) { | 696 if (!pPathData) { |
697 continue; | 697 continue; |
698 } | 698 } |
699 CFX_GraphStateData stroke_state; | 699 CFX_GraphStateData stroke_state; |
700 if (m_Options.m_Flags & RENDER_THINLINE) { | 700 if (m_Options.m_Flags & RENDER_THINLINE) { |
701 stroke_state.m_LineWidth = 0; | 701 stroke_state.m_LineWidth = 0; |
702 } | 702 } |
703 m_pDevice->DrawPath(pPathData, pObj2Device, &stroke_state, 0, 0xffff0000, | 703 m_pDevice->DrawPath(pPathData, pObj2Device, &stroke_state, 0, 0xffff0000, |
704 fill_mode); | 704 fill_mode); |
705 } | 705 } |
706 } | 706 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 pDocument->LoadColorSpace(pCSObj, pPageResources); | 783 pDocument->LoadColorSpace(pCSObj, pPageResources); |
784 if (pColorSpace) { | 784 if (pColorSpace) { |
785 int format = pColorSpace->GetFamily(); | 785 int format = pColorSpace->GetFamily(); |
786 if (format == PDFCS_DEVICECMYK || format == PDFCS_SEPARATION || | 786 if (format == PDFCS_DEVICECMYK || format == PDFCS_SEPARATION || |
787 format == PDFCS_DEVICEN) { | 787 format == PDFCS_DEVICEN) { |
788 blend_type = FXDIB_BLEND_DARKEN; | 788 blend_type = FXDIB_BLEND_DARKEN; |
789 } | 789 } |
790 pDocument->GetPageData()->ReleaseColorSpace(pCSObj); | 790 pDocument->GetPageData()->ReleaseColorSpace(pCSObj); |
791 } | 791 } |
792 } | 792 } |
793 if (pSMaskDict == NULL && group_alpha == 1.0f && | 793 if (!pSMaskDict && group_alpha == 1.0f && blend_type == FXDIB_BLEND_NORMAL && |
794 blend_type == FXDIB_BLEND_NORMAL && !bTextClip && !bGroupTransparent) { | 794 !bTextClip && !bGroupTransparent) { |
795 return FALSE; | 795 return FALSE; |
796 } | 796 } |
797 FX_BOOL isolated = Transparency & PDFTRANS_ISOLATED; | 797 FX_BOOL isolated = Transparency & PDFTRANS_ISOLATED; |
798 if (m_bPrint) { | 798 if (m_bPrint) { |
799 FX_BOOL bRet = FALSE; | 799 FX_BOOL bRet = FALSE; |
800 int rendCaps = m_pDevice->GetRenderCaps(); | 800 int rendCaps = m_pDevice->GetRenderCaps(); |
801 if (!((Transparency & PDFTRANS_ISOLATED) || pSMaskDict || bTextClip) && | 801 if (!((Transparency & PDFTRANS_ISOLATED) || pSMaskDict || bTextClip) && |
802 (rendCaps & FXRC_BLEND_MODE)) { | 802 (rendCaps & FXRC_BLEND_MODE)) { |
803 int oldBlend = m_curBlend; | 803 int oldBlend = m_curBlend; |
804 m_curBlend = blend_type; | 804 m_curBlend = blend_type; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 if (bTextClip) { | 841 if (bTextClip) { |
842 pTextMask.reset(new CFX_DIBitmap); | 842 pTextMask.reset(new CFX_DIBitmap); |
843 if (!pTextMask->Create(width, height, FXDIB_8bppMask)) | 843 if (!pTextMask->Create(width, height, FXDIB_8bppMask)) |
844 return TRUE; | 844 return TRUE; |
845 | 845 |
846 pTextMask->Clear(0); | 846 pTextMask->Clear(0); |
847 CFX_FxgeDevice text_device; | 847 CFX_FxgeDevice text_device; |
848 text_device.Attach(pTextMask.get()); | 848 text_device.Attach(pTextMask.get()); |
849 for (FX_DWORD i = 0; i < pPageObj->m_ClipPath.GetTextCount(); i++) { | 849 for (FX_DWORD i = 0; i < pPageObj->m_ClipPath.GetTextCount(); i++) { |
850 CPDF_TextObject* textobj = pPageObj->m_ClipPath.GetText(i); | 850 CPDF_TextObject* textobj = pPageObj->m_ClipPath.GetText(i); |
851 if (textobj == NULL) { | 851 if (!textobj) { |
852 break; | 852 break; |
853 } | 853 } |
854 CFX_AffineMatrix text_matrix; | 854 CFX_AffineMatrix text_matrix; |
855 textobj->GetTextMatrix(&text_matrix); | 855 textobj->GetTextMatrix(&text_matrix); |
856 CPDF_TextRenderer::DrawTextPath( | 856 CPDF_TextRenderer::DrawTextPath( |
857 &text_device, textobj->m_nChars, textobj->m_pCharCodes, | 857 &text_device, textobj->m_nChars, textobj->m_pCharCodes, |
858 textobj->m_pCharPos, textobj->m_TextState.GetFont(), | 858 textobj->m_pCharPos, textobj->m_TextState.GetFont(), |
859 textobj->m_TextState.GetFontSize(), &text_matrix, &new_matrix, | 859 textobj->m_TextState.GetFontSize(), &text_matrix, &new_matrix, |
860 textobj->m_GraphState, (FX_ARGB)-1, 0, NULL); | 860 textobj->m_GraphState, (FX_ARGB)-1, 0, NULL); |
861 } | 861 } |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 | 1083 |
1084 #define RENDER_STEP_LIMIT 100 | 1084 #define RENDER_STEP_LIMIT 100 |
1085 void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) { | 1085 void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) { |
1086 if (m_Status != ToBeContinued) { | 1086 if (m_Status != ToBeContinued) { |
1087 return; | 1087 return; |
1088 } | 1088 } |
1089 FX_DWORD nLayers = m_pContext->m_ContentList.GetSize(); | 1089 FX_DWORD nLayers = m_pContext->m_ContentList.GetSize(); |
1090 for (; m_LayerIndex < nLayers; m_LayerIndex++) { | 1090 for (; m_LayerIndex < nLayers; m_LayerIndex++) { |
1091 _PDF_RenderItem* pItem = m_pContext->m_ContentList.GetDataPtr(m_LayerIndex); | 1091 _PDF_RenderItem* pItem = m_pContext->m_ContentList.GetDataPtr(m_LayerIndex); |
1092 FX_POSITION LastPos = pItem->m_pObjectList->GetLastObjectPosition(); | 1092 FX_POSITION LastPos = pItem->m_pObjectList->GetLastObjectPosition(); |
1093 if (m_ObjectPos == NULL) { | 1093 if (!m_ObjectPos) { |
1094 if (LastPos == m_PrevLastPos) { | 1094 if (LastPos == m_PrevLastPos) { |
1095 if (!pItem->m_pObjectList->IsParsed()) { | 1095 if (!pItem->m_pObjectList->IsParsed()) { |
1096 pItem->m_pObjectList->ContinueParse(pPause); | 1096 pItem->m_pObjectList->ContinueParse(pPause); |
1097 if (!pItem->m_pObjectList->IsParsed()) { | 1097 if (!pItem->m_pObjectList->IsParsed()) { |
1098 return; | 1098 return; |
1099 } | 1099 } |
1100 LastPos = pItem->m_pObjectList->GetLastObjectPosition(); | 1100 LastPos = pItem->m_pObjectList->GetLastObjectPosition(); |
1101 } | 1101 } |
1102 } | 1102 } |
1103 if (LastPos == m_PrevLastPos) { | 1103 if (LastPos == m_PrevLastPos) { |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1422 item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict) { | 1422 item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict) { |
1423 CPDF_Dictionary* pOCG = | 1423 CPDF_Dictionary* pOCG = |
1424 ToDictionary(static_cast<CPDF_Object*>(item.GetParam())); | 1424 ToDictionary(static_cast<CPDF_Object*>(item.GetParam())); |
1425 if (!CheckOCGVisible(pOCG)) { | 1425 if (!CheckOCGVisible(pOCG)) { |
1426 return FALSE; | 1426 return FALSE; |
1427 } | 1427 } |
1428 } | 1428 } |
1429 } | 1429 } |
1430 return TRUE; | 1430 return TRUE; |
1431 } | 1431 } |
OLD | NEW |