Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: core/src/fpdfapi/fpdf_render/fpdf_render.cpp

Issue 1624553004: Merge to XFA: Change _PDF_RenderItem to CPDF_RenderContext::Layer. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/include/fpdfapi/fpdf_render.h ('k') | core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 if (pOptions) { 205 if (pOptions) {
206 m_Options = *pOptions; 206 m_Options = *pOptions;
207 } 207 }
208 m_bDropObjects = bDropObjects; 208 m_bDropObjects = bDropObjects;
209 m_bStdCS = bStdCS; 209 m_bStdCS = bStdCS;
210 m_T3FillColor = fill_color; 210 m_T3FillColor = fill_color;
211 m_pType3Char = pType3Char; 211 m_pType3Char = pType3Char;
212 m_GroupFamily = GroupFamily; 212 m_GroupFamily = GroupFamily;
213 m_bLoadMask = bLoadMask; 213 m_bLoadMask = bLoadMask;
214 m_pFormResource = pFormResource; 214 m_pFormResource = pFormResource;
215 m_pPageResource = m_pContext->m_pPageResources; 215 m_pPageResource = m_pContext->GetPageResources();
216 if (pInitialStates && !m_pType3Char) { 216 if (pInitialStates && !m_pType3Char) {
217 m_InitialStates.CopyStates(*pInitialStates); 217 m_InitialStates.CopyStates(*pInitialStates);
218 if (pParentState) { 218 if (pParentState) {
219 CPDF_ColorStateData* pColorData = 219 CPDF_ColorStateData* pColorData =
220 (CPDF_ColorStateData*)(const CPDF_ColorStateData*) 220 (CPDF_ColorStateData*)(const CPDF_ColorStateData*)
221 m_InitialStates.m_ColorState; 221 m_InitialStates.m_ColorState;
222 CPDF_ColorStateData* pParentData = 222 CPDF_ColorStateData* pParentData =
223 (CPDF_ColorStateData*)(const CPDF_ColorStateData*) 223 (CPDF_ColorStateData*)(const CPDF_ColorStateData*)
224 pParentState->m_InitialStates.m_ColorState; 224 pParentState->m_InitialStates.m_ColorState;
225 if (!pColorData || pColorData->m_FillColor.IsNull()) { 225 if (!pColorData || pColorData->m_FillColor.IsNull()) {
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 CFX_GraphStateData graphState(*pPathObj->m_GraphState); 531 CFX_GraphStateData graphState(*pPathObj->m_GraphState);
532 if (m_Options.m_Flags & RENDER_THINLINE) { 532 if (m_Options.m_Flags & RENDER_THINLINE) {
533 graphState.m_LineWidth = 0; 533 graphState.m_LineWidth = 0;
534 } 534 }
535 return m_pDevice->DrawPath(pPathObj->m_Path, &path_matrix, &graphState, 535 return m_pDevice->DrawPath(pPathObj->m_Path, &path_matrix, &graphState,
536 fill_argb, stroke_argb, FillType, 0, NULL, 536 fill_argb, stroke_argb, FillType, 0, NULL,
537 m_curBlend); 537 m_curBlend);
538 } 538 }
539 CPDF_TransferFunc* CPDF_RenderStatus::GetTransferFunc(CPDF_Object* pObj) const { 539 CPDF_TransferFunc* CPDF_RenderStatus::GetTransferFunc(CPDF_Object* pObj) const {
540 ASSERT(pObj); 540 ASSERT(pObj);
541 CPDF_DocRenderData* pDocCache = m_pContext->m_pDocument->GetRenderData(); 541 CPDF_DocRenderData* pDocCache = m_pContext->GetDocument()->GetRenderData();
542 return pDocCache ? pDocCache->GetTransferFunc(pObj) : nullptr; 542 return pDocCache ? pDocCache->GetTransferFunc(pObj) : nullptr;
543 } 543 }
544 FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj, 544 FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj,
545 FX_BOOL bType3) const { 545 FX_BOOL bType3) const {
546 CPDF_ColorStateData* pColorData = 546 CPDF_ColorStateData* pColorData =
547 (CPDF_ColorStateData*)(const CPDF_ColorStateData*)pObj->m_ColorState; 547 (CPDF_ColorStateData*)(const CPDF_ColorStateData*)pObj->m_ColorState;
548 if (m_pType3Char && !bType3 && 548 if (m_pType3Char && !bType3 &&
549 (!m_pType3Char->m_bColored || 549 (!m_pType3Char->m_bColored ||
550 (m_pType3Char->m_bColored && 550 (m_pType3Char->m_bColored &&
551 (!pColorData || pColorData->m_FillColor.IsNull())))) { 551 (!pColorData || pColorData->m_FillColor.IsNull())))) {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 if (pPageObj->m_ClipPath.NotNull() && pPageObj->m_ClipPath.GetTextCount() && 751 if (pPageObj->m_ClipPath.NotNull() && pPageObj->m_ClipPath.GetTextCount() &&
752 m_pDevice->GetDeviceClass() == FXDC_DISPLAY && 752 m_pDevice->GetDeviceClass() == FXDC_DISPLAY &&
753 !(m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_SOFT_CLIP)) { 753 !(m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_SOFT_CLIP)) {
754 bTextClip = TRUE; 754 bTextClip = TRUE;
755 } 755 }
756 if ((m_Options.m_Flags & RENDER_OVERPRINT) && 756 if ((m_Options.m_Flags & RENDER_OVERPRINT) &&
757 pPageObj->m_Type == PDFPAGE_IMAGE && pGeneralState && 757 pPageObj->m_Type == PDFPAGE_IMAGE && pGeneralState &&
758 pGeneralState->m_FillOP && pGeneralState->m_StrokeOP) { 758 pGeneralState->m_FillOP && pGeneralState->m_StrokeOP) {
759 CPDF_Document* pDocument = NULL; 759 CPDF_Document* pDocument = NULL;
760 CPDF_Page* pPage = NULL; 760 CPDF_Page* pPage = NULL;
761 if (m_pContext->m_pPageCache) { 761 if (m_pContext->GetPageCache()) {
762 pPage = m_pContext->m_pPageCache->GetPage(); 762 pPage = m_pContext->GetPageCache()->GetPage();
763 pDocument = pPage->m_pDocument; 763 pDocument = pPage->m_pDocument;
764 } else { 764 } else {
765 pDocument = ((CPDF_ImageObject*)pPageObj)->m_pImage->GetDocument(); 765 pDocument = ((CPDF_ImageObject*)pPageObj)->m_pImage->GetDocument();
766 } 766 }
767 CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : NULL; 767 CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : NULL;
768 CPDF_Object* pCSObj = ((CPDF_ImageObject*)pPageObj) 768 CPDF_Object* pCSObj = ((CPDF_ImageObject*)pPageObj)
769 ->m_pImage->GetStream() 769 ->m_pImage->GetStream()
770 ->GetDict() 770 ->GetDict()
771 ->GetElementValue("ColorSpace"); 771 ->GetElementValue("ColorSpace");
772 CPDF_ColorSpace* pColorSpace = 772 CPDF_ColorSpace* pColorSpace =
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 : pSrcStates->m_ColorState.GetFillColor(); 949 : pSrcStates->m_ColorState.GetFillColor();
950 if (!pObjColor->IsNull()) { 950 if (!pObjColor->IsNull()) {
951 CPDF_ColorStateData* pColorData = pStates->m_ColorState.GetModify(); 951 CPDF_ColorStateData* pColorData = pStates->m_ColorState.GetModify();
952 pColorData->m_FillRGB = 952 pColorData->m_FillRGB =
953 bStroke ? pSrcStates->m_ColorState.GetObject()->m_StrokeRGB 953 bStroke ? pSrcStates->m_ColorState.GetObject()->m_StrokeRGB
954 : pSrcStates->m_ColorState.GetObject()->m_FillRGB; 954 : pSrcStates->m_ColorState.GetObject()->m_FillRGB;
955 pColorData->m_StrokeRGB = pColorData->m_FillRGB; 955 pColorData->m_StrokeRGB = pColorData->m_FillRGB;
956 } 956 }
957 return pStates; 957 return pStates;
958 } 958 }
959
959 CPDF_RenderContext::CPDF_RenderContext(CPDF_Page* pPage) 960 CPDF_RenderContext::CPDF_RenderContext(CPDF_Page* pPage)
960 : m_pDocument(pPage->m_pDocument), 961 : m_pDocument(pPage->m_pDocument),
961 m_pPageResources(pPage->m_pPageResources), 962 m_pPageResources(pPage->m_pPageResources),
962 m_pPageCache(pPage->GetRenderCache()), 963 m_pPageCache(pPage->GetRenderCache()),
963 m_bFirstLayer(TRUE) {} 964 m_bFirstLayer(TRUE) {}
965
964 CPDF_RenderContext::CPDF_RenderContext(CPDF_Document* pDoc, 966 CPDF_RenderContext::CPDF_RenderContext(CPDF_Document* pDoc,
965 CPDF_PageRenderCache* pPageCache) 967 CPDF_PageRenderCache* pPageCache)
966 : m_pDocument(pDoc), 968 : m_pDocument(pDoc),
967 m_pPageResources(nullptr), 969 m_pPageResources(nullptr),
968 m_pPageCache(pPageCache), 970 m_pPageCache(pPageCache),
969 m_bFirstLayer(TRUE) {} 971 m_bFirstLayer(TRUE) {}
972
970 CPDF_RenderContext::~CPDF_RenderContext() {} 973 CPDF_RenderContext::~CPDF_RenderContext() {}
971 void CPDF_RenderContext::AppendObjectList(CPDF_PageObjectList* pObjs, 974
972 const CFX_Matrix* pObject2Device) { 975 void CPDF_RenderContext::AppendLayer(CPDF_PageObjectList* pObjs,
973 _PDF_RenderItem* pItem = m_ContentList.AddSpace(); 976 const CFX_Matrix* pObject2Device) {
974 pItem->m_pObjectList = pObjs; 977 Layer* pLayer = m_Layers.AddSpace();
978 pLayer->m_pObjectList = pObjs;
975 if (pObject2Device) { 979 if (pObject2Device) {
976 pItem->m_Matrix = *pObject2Device; 980 pLayer->m_Matrix = *pObject2Device;
977 } else { 981 } else {
978 pItem->m_Matrix.SetIdentity(); 982 pLayer->m_Matrix.SetIdentity();
979 } 983 }
980 } 984 }
981 void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, 985 void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice,
982 const CPDF_RenderOptions* pOptions, 986 const CPDF_RenderOptions* pOptions,
983 const CFX_Matrix* pLastMatrix) { 987 const CFX_Matrix* pLastMatrix) {
984 Render(pDevice, NULL, pOptions, pLastMatrix); 988 Render(pDevice, NULL, pOptions, pLastMatrix);
985 } 989 }
986 void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, 990 void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice,
987 const CPDF_PageObject* pStopObj, 991 const CPDF_PageObject* pStopObj,
988 const CPDF_RenderOptions* pOptions, 992 const CPDF_RenderOptions* pOptions,
989 const CFX_Matrix* pLastMatrix) { 993 const CFX_Matrix* pLastMatrix) {
990 int count = m_ContentList.GetSize(); 994 int count = m_Layers.GetSize();
991 for (int j = 0; j < count; j++) { 995 for (int j = 0; j < count; j++) {
992 pDevice->SaveState(); 996 pDevice->SaveState();
993 _PDF_RenderItem* pItem = m_ContentList.GetDataPtr(j); 997 Layer* pLayer = m_Layers.GetDataPtr(j);
994 if (pLastMatrix) { 998 if (pLastMatrix) {
995 CFX_Matrix FinalMatrix = pItem->m_Matrix; 999 CFX_Matrix FinalMatrix = pLayer->m_Matrix;
996 FinalMatrix.Concat(*pLastMatrix); 1000 FinalMatrix.Concat(*pLastMatrix);
997 CPDF_RenderStatus status; 1001 CPDF_RenderStatus status;
998 status.Initialize(this, pDevice, pLastMatrix, pStopObj, NULL, NULL, 1002 status.Initialize(this, pDevice, pLastMatrix, pStopObj, NULL, NULL,
999 pOptions, pItem->m_pObjectList->m_Transparency, FALSE, 1003 pOptions, pLayer->m_pObjectList->m_Transparency, FALSE,
1000 NULL); 1004 NULL);
1001 status.RenderObjectList(pItem->m_pObjectList, &FinalMatrix); 1005 status.RenderObjectList(pLayer->m_pObjectList, &FinalMatrix);
1002 if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { 1006 if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) {
1003 m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize); 1007 m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize);
1004 } 1008 }
1005 if (status.m_bStopped) { 1009 if (status.m_bStopped) {
1006 pDevice->RestoreState(); 1010 pDevice->RestoreState();
1007 break; 1011 break;
1008 } 1012 }
1009 } else { 1013 } else {
1010 CPDF_RenderStatus status; 1014 CPDF_RenderStatus status;
1011 status.Initialize(this, pDevice, NULL, pStopObj, NULL, NULL, pOptions, 1015 status.Initialize(this, pDevice, NULL, pStopObj, NULL, NULL, pOptions,
1012 pItem->m_pObjectList->m_Transparency, FALSE, NULL); 1016 pLayer->m_pObjectList->m_Transparency, FALSE, NULL);
1013 status.RenderObjectList(pItem->m_pObjectList, &pItem->m_Matrix); 1017 status.RenderObjectList(pLayer->m_pObjectList, &pLayer->m_Matrix);
1014 if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { 1018 if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) {
1015 m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize); 1019 m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize);
1016 } 1020 }
1017 if (status.m_bStopped) { 1021 if (status.m_bStopped) {
1018 pDevice->RestoreState(); 1022 pDevice->RestoreState();
1019 break; 1023 break;
1020 } 1024 }
1021 } 1025 }
1022 pDevice->RestoreState(); 1026 pDevice->RestoreState();
1023 } 1027 }
1024 } 1028 }
1025 void CPDF_RenderContext::DrawObjectList(CFX_RenderDevice* pDevice,
1026 CPDF_PageObjectList* pObjs,
1027 const CFX_Matrix* pObject2Device,
1028 const CPDF_RenderOptions* pOptions) {
1029 AppendObjectList(pObjs, pObject2Device);
1030 Render(pDevice, pOptions);
1031 }
1032 1029
1033 CPDF_ProgressiveRenderer::CPDF_ProgressiveRenderer( 1030 CPDF_ProgressiveRenderer::CPDF_ProgressiveRenderer(
1034 CPDF_RenderContext* pContext, 1031 CPDF_RenderContext* pContext,
1035 CFX_RenderDevice* pDevice, 1032 CFX_RenderDevice* pDevice,
1036 const CPDF_RenderOptions* pOptions) 1033 const CPDF_RenderOptions* pOptions)
1037 : m_Status(Ready), 1034 : m_Status(Ready),
1038 m_pContext(pContext), 1035 m_pContext(pContext),
1039 m_pDevice(pDevice), 1036 m_pDevice(pDevice),
1040 m_pOptions(pOptions), 1037 m_pOptions(pOptions),
1041 m_LayerIndex(0), 1038 m_LayerIndex(0),
1042 m_ObjectIndex(0), 1039 m_ObjectIndex(0),
1043 m_ObjectPos(nullptr), 1040 m_ObjectPos(nullptr),
1044 m_PrevLastPos(nullptr) { 1041 m_PrevLastPos(nullptr) {
1045 } 1042 }
1046 1043
1047 CPDF_ProgressiveRenderer::~CPDF_ProgressiveRenderer() { 1044 CPDF_ProgressiveRenderer::~CPDF_ProgressiveRenderer() {
1048 if (m_pRenderStatus) 1045 if (m_pRenderStatus)
1049 m_pDevice->RestoreState(); 1046 m_pDevice->RestoreState();
1050 } 1047 }
1051 1048
1052 void CPDF_ProgressiveRenderer::Start(IFX_Pause* pPause) { 1049 void CPDF_ProgressiveRenderer::Start(IFX_Pause* pPause) {
1053 if (!m_pContext || !m_pDevice || m_Status != Ready) { 1050 if (!m_pContext || !m_pDevice || m_Status != Ready) {
1054 m_Status = Failed; 1051 m_Status = Failed;
1055 return; 1052 return;
1056 } 1053 }
1057 m_Status = ToBeContinued; 1054 m_Status = ToBeContinued;
1058 Continue(pPause); 1055 Continue(pPause);
1059 } 1056 }
1060 1057
1061 #define RENDER_STEP_LIMIT 100
1062 void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) { 1058 void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) {
1063 if (m_Status != ToBeContinued) { 1059 if (m_Status != ToBeContinued) {
1064 return; 1060 return;
1065 } 1061 }
1066 FX_DWORD nLayers = m_pContext->m_ContentList.GetSize(); 1062 FX_DWORD nLayers = m_pContext->CountLayers();
1067 for (; m_LayerIndex < nLayers; m_LayerIndex++) { 1063 for (; m_LayerIndex < nLayers; m_LayerIndex++) {
1068 _PDF_RenderItem* pItem = m_pContext->m_ContentList.GetDataPtr(m_LayerIndex); 1064 CPDF_RenderContext::Layer* pLayer = m_pContext->GetLayer(m_LayerIndex);
1069 FX_POSITION LastPos = pItem->m_pObjectList->GetLastObjectPosition(); 1065 FX_POSITION LastPos = pLayer->m_pObjectList->GetLastObjectPosition();
1070 if (!m_ObjectPos) { 1066 if (!m_ObjectPos) {
1071 if (LastPos == m_PrevLastPos) { 1067 if (LastPos == m_PrevLastPos) {
1072 if (!pItem->m_pObjectList->IsParsed()) { 1068 if (!pLayer->m_pObjectList->IsParsed()) {
1073 pItem->m_pObjectList->ContinueParse(pPause); 1069 pLayer->m_pObjectList->ContinueParse(pPause);
1074 if (!pItem->m_pObjectList->IsParsed()) { 1070 if (!pLayer->m_pObjectList->IsParsed()) {
1075 return; 1071 return;
1076 } 1072 }
1077 LastPos = pItem->m_pObjectList->GetLastObjectPosition(); 1073 LastPos = pLayer->m_pObjectList->GetLastObjectPosition();
1078 } 1074 }
1079 } 1075 }
1080 if (LastPos == m_PrevLastPos) { 1076 if (LastPos == m_PrevLastPos) {
1081 if (m_pRenderStatus) { 1077 if (m_pRenderStatus) {
1082 m_pRenderStatus.reset(); 1078 m_pRenderStatus.reset();
1083 m_pDevice->RestoreState(); 1079 m_pDevice->RestoreState();
1084 m_ObjectPos = NULL; 1080 m_ObjectPos = NULL;
1085 m_PrevLastPos = NULL; 1081 m_PrevLastPos = NULL;
1086 } 1082 }
1087 continue; 1083 continue;
1088 } 1084 }
1089 if (m_PrevLastPos) { 1085 if (m_PrevLastPos) {
1090 m_ObjectPos = m_PrevLastPos; 1086 m_ObjectPos = m_PrevLastPos;
1091 pItem->m_pObjectList->GetNextObject(m_ObjectPos); 1087 pLayer->m_pObjectList->GetNextObject(m_ObjectPos);
1092 } else { 1088 } else {
1093 m_ObjectPos = pItem->m_pObjectList->GetFirstObjectPosition(); 1089 m_ObjectPos = pLayer->m_pObjectList->GetFirstObjectPosition();
1094 } 1090 }
1095 m_PrevLastPos = LastPos; 1091 m_PrevLastPos = LastPos;
1096 } 1092 }
1097 if (!m_pRenderStatus) { 1093 if (!m_pRenderStatus) {
1098 m_ObjectPos = pItem->m_pObjectList->GetFirstObjectPosition(); 1094 m_ObjectPos = pLayer->m_pObjectList->GetFirstObjectPosition();
1099 m_ObjectIndex = 0; 1095 m_ObjectIndex = 0;
1100 m_pRenderStatus.reset(new CPDF_RenderStatus()); 1096 m_pRenderStatus.reset(new CPDF_RenderStatus());
1101 m_pRenderStatus->Initialize( 1097 m_pRenderStatus->Initialize(
1102 m_pContext, m_pDevice, NULL, NULL, NULL, NULL, m_pOptions, 1098 m_pContext, m_pDevice, NULL, NULL, NULL, NULL, m_pOptions,
1103 pItem->m_pObjectList->m_Transparency, FALSE, NULL); 1099 pLayer->m_pObjectList->m_Transparency, FALSE, NULL);
1104 m_pDevice->SaveState(); 1100 m_pDevice->SaveState();
1105 m_ClipRect = m_pDevice->GetClipBox(); 1101 m_ClipRect = m_pDevice->GetClipBox();
1106 CFX_Matrix device2object; 1102 CFX_Matrix device2object;
1107 device2object.SetReverse(pItem->m_Matrix); 1103 device2object.SetReverse(pLayer->m_Matrix);
1108 device2object.TransformRect(m_ClipRect); 1104 device2object.TransformRect(m_ClipRect);
1109 } 1105 }
1110 int objs_to_go = CPDF_ModuleMgr::Get() 1106 int objs_to_go = CPDF_ModuleMgr::Get()
1111 ->GetRenderModule() 1107 ->GetRenderModule()
1112 ->GetConfig() 1108 ->GetConfig()
1113 ->m_RenderStepLimit; 1109 ->m_RenderStepLimit;
1114 while (m_ObjectPos) { 1110 while (m_ObjectPos) {
1115 CPDF_PageObject* pCurObj = pItem->m_pObjectList->GetObjectAt(m_ObjectPos); 1111 CPDF_PageObject* pCurObj =
1112 pLayer->m_pObjectList->GetObjectAt(m_ObjectPos);
1116 if (pCurObj && pCurObj->m_Left <= m_ClipRect.right && 1113 if (pCurObj && pCurObj->m_Left <= m_ClipRect.right &&
1117 pCurObj->m_Right >= m_ClipRect.left && 1114 pCurObj->m_Right >= m_ClipRect.left &&
1118 pCurObj->m_Bottom <= m_ClipRect.top && 1115 pCurObj->m_Bottom <= m_ClipRect.top &&
1119 pCurObj->m_Top >= m_ClipRect.bottom) { 1116 pCurObj->m_Top >= m_ClipRect.bottom) {
1120 if (m_pRenderStatus->ContinueSingleObject(pCurObj, &pItem->m_Matrix, 1117 if (m_pRenderStatus->ContinueSingleObject(pCurObj, &pLayer->m_Matrix,
1121 pPause)) { 1118 pPause)) {
1122 return; 1119 return;
1123 } 1120 }
1124 if (pCurObj->m_Type == PDFPAGE_IMAGE && 1121 if (pCurObj->m_Type == PDFPAGE_IMAGE &&
1125 m_pRenderStatus->m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { 1122 m_pRenderStatus->m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) {
1126 m_pContext->GetPageCache()->CacheOptimization( 1123 m_pContext->GetPageCache()->CacheOptimization(
1127 m_pRenderStatus->m_Options.m_dwLimitCacheSize); 1124 m_pRenderStatus->m_Options.m_dwLimitCacheSize);
1128 } 1125 }
1129 if (pCurObj->m_Type == PDFPAGE_FORM || 1126 if (pCurObj->m_Type == PDFPAGE_FORM ||
1130 pCurObj->m_Type == PDFPAGE_SHADING) { 1127 pCurObj->m_Type == PDFPAGE_SHADING) {
1131 objs_to_go = 0; 1128 objs_to_go = 0;
1132 } else { 1129 } else {
1133 objs_to_go--; 1130 objs_to_go--;
1134 } 1131 }
1135 } 1132 }
1136 m_ObjectIndex++; 1133 m_ObjectIndex++;
1137 pItem->m_pObjectList->GetNextObject(m_ObjectPos); 1134 pLayer->m_pObjectList->GetNextObject(m_ObjectPos);
1138 if (objs_to_go == 0) { 1135 if (objs_to_go == 0) {
1139 if (pPause && pPause->NeedToPauseNow()) { 1136 if (pPause && pPause->NeedToPauseNow()) {
1140 return; 1137 return;
1141 } 1138 }
1142 objs_to_go = CPDF_ModuleMgr::Get() 1139 objs_to_go = CPDF_ModuleMgr::Get()
1143 ->GetRenderModule() 1140 ->GetRenderModule()
1144 ->GetConfig() 1141 ->GetConfig()
1145 ->m_RenderStepLimit; 1142 ->m_RenderStepLimit;
1146 } 1143 }
1147 } 1144 }
1148 if (!pItem->m_pObjectList->IsParsed()) { 1145 if (!pLayer->m_pObjectList->IsParsed()) {
1149 return; 1146 return;
1150 } 1147 }
1151 m_pRenderStatus.reset(); 1148 m_pRenderStatus.reset();
1152 m_pDevice->RestoreState(); 1149 m_pDevice->RestoreState();
1153 m_ObjectPos = NULL; 1150 m_ObjectPos = NULL;
1154 m_PrevLastPos = NULL; 1151 m_PrevLastPos = NULL;
1155 if (pPause && pPause->NeedToPauseNow()) { 1152 if (pPause && pPause->NeedToPauseNow()) {
1156 m_LayerIndex++; 1153 m_LayerIndex++;
1157 return; 1154 return;
1158 } 1155 }
1159 } 1156 }
1160 m_Status = Done; 1157 m_Status = Done;
1161 } 1158 }
1162 int CPDF_ProgressiveRenderer::EstimateProgress() { 1159 int CPDF_ProgressiveRenderer::EstimateProgress() {
1163 if (!m_pContext) { 1160 if (!m_pContext) {
1164 return 0; 1161 return 0;
1165 } 1162 }
1166 FX_DWORD nLayers = m_pContext->m_ContentList.GetSize(); 1163 FX_DWORD nLayers = m_pContext->CountLayers();
1167 int nTotal = 0, nRendered = 0; 1164 int nTotal = 0;
1165 int nRendered = 0;
1168 for (FX_DWORD layer = 0; layer < nLayers; layer++) { 1166 for (FX_DWORD layer = 0; layer < nLayers; layer++) {
1169 _PDF_RenderItem* pItem = m_pContext->m_ContentList.GetDataPtr(layer); 1167 CPDF_RenderContext::Layer* pLayer = m_pContext->GetLayer(layer);
1170 int nObjs = pItem->m_pObjectList->CountObjects(); 1168 int nObjs = pLayer->m_pObjectList->CountObjects();
1171 if (layer == m_LayerIndex) { 1169 if (layer == m_LayerIndex) {
1172 nRendered += m_ObjectIndex; 1170 nRendered += m_ObjectIndex;
1173 } else if (layer < m_LayerIndex) { 1171 } else if (layer < m_LayerIndex) {
1174 nRendered += nObjs; 1172 nRendered += nObjs;
1175 } 1173 }
1176 nTotal += nObjs; 1174 nTotal += nObjs;
1177 } 1175 }
1178 if (nTotal == 0) { 1176 if (nTotal == 0) {
1179 return 0; 1177 return 0;
1180 } 1178 }
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict) { 1396 item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict) {
1399 CPDF_Dictionary* pOCG = 1397 CPDF_Dictionary* pOCG =
1400 ToDictionary(static_cast<CPDF_Object*>(item.GetParam())); 1398 ToDictionary(static_cast<CPDF_Object*>(item.GetParam()));
1401 if (!CheckOCGVisible(pOCG)) { 1399 if (!CheckOCGVisible(pOCG)) {
1402 return FALSE; 1400 return FALSE;
1403 } 1401 }
1404 } 1402 }
1405 } 1403 }
1406 return TRUE; 1404 return TRUE;
1407 } 1405 }
OLDNEW
« no previous file with comments | « core/include/fpdfapi/fpdf_render.h ('k') | core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698