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 "core/fpdfapi/fpdf_font/cpdf_type3char.h" | 9 #include "core/fpdfapi/fpdf_font/cpdf_type3char.h" |
10 #include "core/fpdfapi/fpdf_font/cpdf_type3font.h" | 10 #include "core/fpdfapi/fpdf_font/cpdf_type3font.h" |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 pGeneralState && pGeneralState->m_FillOP && pGeneralState->m_StrokeOP) { | 770 pGeneralState && pGeneralState->m_FillOP && pGeneralState->m_StrokeOP) { |
771 CPDF_Document* pDocument = NULL; | 771 CPDF_Document* pDocument = NULL; |
772 CPDF_Page* pPage = NULL; | 772 CPDF_Page* pPage = NULL; |
773 if (m_pContext->GetPageCache()) { | 773 if (m_pContext->GetPageCache()) { |
774 pPage = m_pContext->GetPageCache()->GetPage(); | 774 pPage = m_pContext->GetPageCache()->GetPage(); |
775 pDocument = pPage->m_pDocument; | 775 pDocument = pPage->m_pDocument; |
776 } else { | 776 } else { |
777 pDocument = pPageObj->AsImage()->m_pImage->GetDocument(); | 777 pDocument = pPageObj->AsImage()->m_pImage->GetDocument(); |
778 } | 778 } |
779 CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : NULL; | 779 CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : NULL; |
780 CPDF_Object* pCSObj = | 780 CPDF_Object* pCSObj = pPageObj->AsImage() |
781 pPageObj->AsImage()->m_pImage->GetStream()->GetDict()->GetElementValue( | 781 ->m_pImage->GetStream() |
782 "ColorSpace"); | 782 ->GetDict() |
| 783 ->GetDirectObjectBy("ColorSpace"); |
783 CPDF_ColorSpace* pColorSpace = | 784 CPDF_ColorSpace* pColorSpace = |
784 pDocument->LoadColorSpace(pCSObj, pPageResources); | 785 pDocument->LoadColorSpace(pCSObj, pPageResources); |
785 if (pColorSpace) { | 786 if (pColorSpace) { |
786 int format = pColorSpace->GetFamily(); | 787 int format = pColorSpace->GetFamily(); |
787 if (format == PDFCS_DEVICECMYK || format == PDFCS_SEPARATION || | 788 if (format == PDFCS_DEVICECMYK || format == PDFCS_SEPARATION || |
788 format == PDFCS_DEVICEN) { | 789 format == PDFCS_DEVICEN) { |
789 blend_type = FXDIB_BLEND_DARKEN; | 790 blend_type = FXDIB_BLEND_DARKEN; |
790 } | 791 } |
791 pDocument->GetPageData()->ReleaseColorSpace(pCSObj); | 792 pDocument->GetPageData()->ReleaseColorSpace(pCSObj); |
792 } | 793 } |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 | 1151 |
1151 std::unique_ptr<CPDF_Function> pFuncs[3]; | 1152 std::unique_ptr<CPDF_Function> pFuncs[3]; |
1152 FX_BOOL bUniTransfer = TRUE; | 1153 FX_BOOL bUniTransfer = TRUE; |
1153 FX_BOOL bIdentity = TRUE; | 1154 FX_BOOL bIdentity = TRUE; |
1154 if (CPDF_Array* pArray = pObj->AsArray()) { | 1155 if (CPDF_Array* pArray = pObj->AsArray()) { |
1155 bUniTransfer = FALSE; | 1156 bUniTransfer = FALSE; |
1156 if (pArray->GetCount() < 3) | 1157 if (pArray->GetCount() < 3) |
1157 return nullptr; | 1158 return nullptr; |
1158 | 1159 |
1159 for (uint32_t i = 0; i < 3; ++i) { | 1160 for (uint32_t i = 0; i < 3; ++i) { |
1160 pFuncs[2 - i].reset(CPDF_Function::Load(pArray->GetElementValue(i))); | 1161 pFuncs[2 - i].reset(CPDF_Function::Load(pArray->GetDirectObjectAt(i))); |
1161 if (!pFuncs[2 - i]) | 1162 if (!pFuncs[2 - i]) |
1162 return nullptr; | 1163 return nullptr; |
1163 } | 1164 } |
1164 } else { | 1165 } else { |
1165 pFuncs[0].reset(CPDF_Function::Load(pObj)); | 1166 pFuncs[0].reset(CPDF_Function::Load(pObj)); |
1166 if (!pFuncs[0]) | 1167 if (!pFuncs[0]) |
1167 return nullptr; | 1168 return nullptr; |
1168 } | 1169 } |
1169 CPDF_TransferFunc* pTransfer = new CPDF_TransferFunc(m_pPDFDoc); | 1170 CPDF_TransferFunc* pTransfer = new CPDF_TransferFunc(m_pPDFDoc); |
1170 CPDF_CountedObject<CPDF_TransferFunc>* pTransferCounter = | 1171 CPDF_CountedObject<CPDF_TransferFunc>* pTransferCounter = |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject, pOptions, | 1333 m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject, pOptions, |
1333 &m_Matrix); | 1334 &m_Matrix); |
1334 return TRUE; | 1335 return TRUE; |
1335 } | 1336 } |
1336 void CPDF_ScaledRenderBuffer::OutputToDevice() { | 1337 void CPDF_ScaledRenderBuffer::OutputToDevice() { |
1337 if (m_pBitmapDevice) { | 1338 if (m_pBitmapDevice) { |
1338 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, | 1339 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, |
1339 m_Rect.top, m_Rect.Width(), m_Rect.Height()); | 1340 m_Rect.top, m_Rect.Width(), m_Rect.Height()); |
1340 } | 1341 } |
1341 } | 1342 } |
OLD | NEW |