| 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 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 CFX_FxgeDevice device; | 908 CFX_FxgeDevice device; |
| 909 device.Attach(pBackdrop); | 909 device.Attach(pBackdrop); |
| 910 m_pContext->Render(&device, pObj, &m_Options, &FinalMatrix); | 910 m_pContext->Render(&device, pObj, &m_Options, &FinalMatrix); |
| 911 return pBackdrop; | 911 return pBackdrop; |
| 912 } | 912 } |
| 913 void CPDF_RenderContext::GetBackground(CFX_DIBitmap* pBuffer, const CPDF_PageObj
ect* pObj, | 913 void CPDF_RenderContext::GetBackground(CFX_DIBitmap* pBuffer, const CPDF_PageObj
ect* pObj, |
| 914 const CPDF_RenderOptions* pOptions, CFX_A
ffineMatrix* pFinalMatrix) | 914 const CPDF_RenderOptions* pOptions, CFX_A
ffineMatrix* pFinalMatrix) |
| 915 { | 915 { |
| 916 CFX_FxgeDevice device; | 916 CFX_FxgeDevice device; |
| 917 device.Attach(pBuffer); | 917 device.Attach(pBuffer); |
| 918 if (m_pBackgroundDraw) { | 918 |
| 919 m_pBackgroundDraw->OnDrawBackground(&device, pFinalMatrix); | 919 FX_RECT rect(0, 0, device.GetWidth(), device.GetHeight()); |
| 920 } else { | 920 device.FillRect(&rect, 0xffffffff); |
| 921 FX_RECT rect(0, 0, device.GetWidth(), device.GetHeight()); | |
| 922 device.FillRect(&rect, 0xffffffff); | |
| 923 } | |
| 924 Render(&device, pObj, pOptions, pFinalMatrix); | 921 Render(&device, pObj, pOptions, pFinalMatrix); |
| 925 } | 922 } |
| 926 CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates(const CPDF_GraphicStates*
pSrcStates, FX_BOOL bStroke) | 923 CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates(const CPDF_GraphicStates*
pSrcStates, FX_BOOL bStroke) |
| 927 { | 924 { |
| 928 if (!pSrcStates) { | 925 if (!pSrcStates) { |
| 929 return NULL; | 926 return NULL; |
| 930 } | 927 } |
| 931 CPDF_GraphicStates* pStates = new CPDF_GraphicStates; | 928 CPDF_GraphicStates* pStates = new CPDF_GraphicStates; |
| 932 pStates->CopyStates(*pSrcStates); | 929 pStates->CopyStates(*pSrcStates); |
| 933 CPDF_Color* pObjColor = bStroke ? pSrcStates->m_ColorState.GetStrokeColor()
: | 930 CPDF_Color* pObjColor = bStroke ? pSrcStates->m_ColorState.GetStrokeColor()
: |
| 934 pSrcStates->m_ColorState.GetFillColor(); | 931 pSrcStates->m_ColorState.GetFillColor(); |
| 935 if (!pObjColor->IsNull()) { | 932 if (!pObjColor->IsNull()) { |
| 936 CPDF_ColorStateData* pColorData = pStates->m_ColorState.GetModify(); | 933 CPDF_ColorStateData* pColorData = pStates->m_ColorState.GetModify(); |
| 937 pColorData->m_FillRGB = bStroke ? pSrcStates->m_ColorState.GetObject()->
m_StrokeRGB : | 934 pColorData->m_FillRGB = bStroke ? pSrcStates->m_ColorState.GetObject()->
m_StrokeRGB : |
| 938 pSrcStates->m_ColorState.GetObject()->m_FillRGB; | 935 pSrcStates->m_ColorState.GetObject()->m_FillRGB; |
| 939 pColorData->m_StrokeRGB = pColorData->m_FillRGB; | 936 pColorData->m_StrokeRGB = pColorData->m_FillRGB; |
| 940 } | 937 } |
| 941 return pStates; | 938 return pStates; |
| 942 } | 939 } |
| 943 CPDF_RenderContext::CPDF_RenderContext() | 940 CPDF_RenderContext::CPDF_RenderContext() |
| 944 { | 941 { |
| 945 } | 942 } |
| 946 void CPDF_RenderContext::Create(CPDF_Document* pDoc, CPDF_PageRenderCache* pPage
Cache, | 943 void CPDF_RenderContext::Create(CPDF_Document* pDoc, CPDF_PageRenderCache* pPage
Cache, |
| 947 CPDF_Dictionary* pPageResources, FX_BOOL bFirstL
ayer) | 944 CPDF_Dictionary* pPageResources, FX_BOOL bFirstL
ayer) |
| 948 { | 945 { |
| 949 m_pBackgroundDraw = NULL; | |
| 950 m_pDocument = pDoc; | 946 m_pDocument = pDoc; |
| 951 m_pPageResources = pPageResources; | 947 m_pPageResources = pPageResources; |
| 952 m_pPageCache = pPageCache; | 948 m_pPageCache = pPageCache; |
| 953 m_bFirstLayer = bFirstLayer; | 949 m_bFirstLayer = bFirstLayer; |
| 954 } | 950 } |
| 955 void CPDF_RenderContext::Create(CPDF_Page* pPage, FX_BOOL bFirstLayer) | 951 void CPDF_RenderContext::Create(CPDF_Page* pPage, FX_BOOL bFirstLayer) |
| 956 { | 952 { |
| 957 m_pBackgroundDraw = NULL; | |
| 958 m_pDocument = pPage->m_pDocument; | 953 m_pDocument = pPage->m_pDocument; |
| 959 m_pPageResources = pPage->m_pPageResources; | 954 m_pPageResources = pPage->m_pPageResources; |
| 960 m_pPageCache = pPage->GetRenderCache(); | 955 m_pPageCache = pPage->GetRenderCache(); |
| 961 m_bFirstLayer = bFirstLayer; | 956 m_bFirstLayer = bFirstLayer; |
| 962 } | 957 } |
| 963 CPDF_RenderContext::~CPDF_RenderContext() | 958 CPDF_RenderContext::~CPDF_RenderContext() |
| 964 { | 959 { |
| 965 } | 960 } |
| 966 void CPDF_RenderContext::Clear() | 961 void CPDF_RenderContext::Clear() |
| 967 { | 962 { |
| 968 m_pDocument = NULL; | 963 m_pDocument = NULL; |
| 969 m_pPageResources = NULL; | 964 m_pPageResources = NULL; |
| 970 m_pPageCache = NULL; | 965 m_pPageCache = NULL; |
| 971 m_pBackgroundDraw = NULL; | |
| 972 m_bFirstLayer = TRUE; | 966 m_bFirstLayer = TRUE; |
| 973 m_ContentList.RemoveAll(); | 967 m_ContentList.RemoveAll(); |
| 974 } | 968 } |
| 975 void CPDF_RenderContext::AppendObjectList(CPDF_PageObjects* pObjs, const CFX_Aff
ineMatrix* pObject2Device) | 969 void CPDF_RenderContext::AppendObjectList(CPDF_PageObjects* pObjs, const CFX_Aff
ineMatrix* pObject2Device) |
| 976 { | 970 { |
| 977 _PDF_RenderItem* pItem = m_ContentList.AddSpace(); | 971 _PDF_RenderItem* pItem = m_ContentList.AddSpace(); |
| 978 pItem->m_pObjectList = pObjs; | 972 pItem->m_pObjectList = pObjs; |
| 979 if (pObject2Device) { | 973 if (pObject2Device) { |
| 980 pItem->m_Matrix = *pObject2Device; | 974 pItem->m_Matrix = *pObject2Device; |
| 981 } else { | 975 } else { |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 CPDF_ContentMarkItem& item = pData->GetItem(i); | 1411 CPDF_ContentMarkItem& item = pData->GetItem(i); |
| 1418 if (item.GetName() == FX_BSTRC("OC") && item.GetParamType() == CPDF_Cont
entMarkItem::PropertiesDict) { | 1412 if (item.GetName() == FX_BSTRC("OC") && item.GetParamType() == CPDF_Cont
entMarkItem::PropertiesDict) { |
| 1419 CPDF_Dictionary* pOCG = (CPDF_Dictionary*)item.GetParam(); | 1413 CPDF_Dictionary* pOCG = (CPDF_Dictionary*)item.GetParam(); |
| 1420 if (!CheckOCGVisible(pOCG)) { | 1414 if (!CheckOCGVisible(pOCG)) { |
| 1421 return FALSE; | 1415 return FALSE; |
| 1422 } | 1416 } |
| 1423 } | 1417 } |
| 1424 } | 1418 } |
| 1425 return TRUE; | 1419 return TRUE; |
| 1426 } | 1420 } |
| OLD | NEW |