| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 pBitmap->DitherFS(pal, 4, &rect); | 335 pBitmap->DitherFS(pal, 4, &rect); |
| 336 } else if (m_DitherBits == 3) { | 336 } else if (m_DitherBits == 3) { |
| 337 static FX_ARGB pal[8] = {0, 36, 73, 109, 146, 182, 219, 255}; | 337 static FX_ARGB pal[8] = {0, 36, 73, 109, 146, 182, 219, 255}; |
| 338 pBitmap->DitherFS(pal, 8, &rect); | 338 pBitmap->DitherFS(pal, 8, &rect); |
| 339 } else if (m_DitherBits == 4) { | 339 } else if (m_DitherBits == 4) { |
| 340 static FX_ARGB pal[16] = {0, 17, 34, 51, 68, 85, 102, 119, | 340 static FX_ARGB pal[16] = {0, 17, 34, 51, 68, 85, 102, 119, |
| 341 136, 153, 170, 187, 204, 221, 238, 255}; | 341 136, 153, 170, 187, 204, 221, 238, 255}; |
| 342 pBitmap->DitherFS(pal, 16, &rect); | 342 pBitmap->DitherFS(pal, 16, &rect); |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 |
| 345 void CPDF_RenderStatus::ProcessObjectNoClip(const CPDF_PageObject* pObj, | 346 void CPDF_RenderStatus::ProcessObjectNoClip(const CPDF_PageObject* pObj, |
| 346 const CFX_Matrix* pObj2Device) { | 347 const CFX_Matrix* pObj2Device) { |
| 347 FX_BOOL bRet = FALSE; | 348 FX_BOOL bRet = FALSE; |
| 348 switch (pObj->GetType()) { | 349 switch (pObj->GetType()) { |
| 349 case CPDF_PageObject::TEXT: | 350 case CPDF_PageObject::TEXT: |
| 350 bRet = ProcessText(pObj->AsText(), pObj2Device, NULL); | 351 bRet = ProcessText(pObj->AsText(), pObj2Device, NULL); |
| 351 break; | 352 break; |
| 352 case CPDF_PageObject::PATH: | 353 case CPDF_PageObject::PATH: |
| 353 bRet = ProcessPath(pObj->AsPath(), pObj2Device); | 354 bRet = ProcessPath(pObj->AsPath(), pObj2Device); |
| 354 break; | 355 break; |
| 355 case CPDF_PageObject::IMAGE: | 356 case CPDF_PageObject::IMAGE: |
| 356 bRet = ProcessImage(pObj->AsImage(), pObj2Device); | 357 bRet = ProcessImage(pObj->AsImage(), pObj2Device); |
| 357 break; | 358 break; |
| 358 case CPDF_PageObject::SHADING: | 359 case CPDF_PageObject::SHADING: |
| 359 bRet = ProcessShading(pObj->AsShading(), pObj2Device); | 360 ProcessShading(pObj->AsShading(), pObj2Device); |
| 360 break; | 361 return; |
| 361 case CPDF_PageObject::FORM: | 362 case CPDF_PageObject::FORM: |
| 362 bRet = ProcessForm(pObj->AsForm(), pObj2Device); | 363 bRet = ProcessForm(pObj->AsForm(), pObj2Device); |
| 363 break; | 364 break; |
| 364 } | 365 } |
| 365 if (!bRet) { | 366 if (!bRet) |
| 366 DrawObjWithBackground(pObj, pObj2Device); | 367 DrawObjWithBackground(pObj, pObj2Device); |
| 367 } | |
| 368 } | 368 } |
| 369 |
| 369 FX_BOOL CPDF_RenderStatus::DrawObjWithBlend(const CPDF_PageObject* pObj, | 370 FX_BOOL CPDF_RenderStatus::DrawObjWithBlend(const CPDF_PageObject* pObj, |
| 370 const CFX_Matrix* pObj2Device) { | 371 const CFX_Matrix* pObj2Device) { |
| 371 FX_BOOL bRet = FALSE; | 372 FX_BOOL bRet = FALSE; |
| 372 switch (pObj->GetType()) { | 373 switch (pObj->GetType()) { |
| 373 case CPDF_PageObject::PATH: | 374 case CPDF_PageObject::PATH: |
| 374 bRet = ProcessPath(pObj->AsPath(), pObj2Device); | 375 bRet = ProcessPath(pObj->AsPath(), pObj2Device); |
| 375 break; | 376 break; |
| 376 case CPDF_PageObject::IMAGE: | 377 case CPDF_PageObject::IMAGE: |
| 377 bRet = ProcessImage(pObj->AsImage(), pObj2Device); | 378 bRet = ProcessImage(pObj->AsImage(), pObj2Device); |
| 378 break; | 379 break; |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 | 1106 |
| 1106 std::unique_ptr<CPDF_Function> pFuncs[3]; | 1107 std::unique_ptr<CPDF_Function> pFuncs[3]; |
| 1107 FX_BOOL bUniTransfer = TRUE; | 1108 FX_BOOL bUniTransfer = TRUE; |
| 1108 FX_BOOL bIdentity = TRUE; | 1109 FX_BOOL bIdentity = TRUE; |
| 1109 if (CPDF_Array* pArray = pObj->AsArray()) { | 1110 if (CPDF_Array* pArray = pObj->AsArray()) { |
| 1110 bUniTransfer = FALSE; | 1111 bUniTransfer = FALSE; |
| 1111 if (pArray->GetCount() < 3) | 1112 if (pArray->GetCount() < 3) |
| 1112 return nullptr; | 1113 return nullptr; |
| 1113 | 1114 |
| 1114 for (uint32_t i = 0; i < 3; ++i) { | 1115 for (uint32_t i = 0; i < 3; ++i) { |
| 1115 pFuncs[2 - i].reset(CPDF_Function::Load(pArray->GetDirectObjectAt(i))); | 1116 pFuncs[2 - i] = CPDF_Function::Load(pArray->GetDirectObjectAt(i)); |
| 1116 if (!pFuncs[2 - i]) | 1117 if (!pFuncs[2 - i]) |
| 1117 return nullptr; | 1118 return nullptr; |
| 1118 } | 1119 } |
| 1119 } else { | 1120 } else { |
| 1120 pFuncs[0].reset(CPDF_Function::Load(pObj)); | 1121 pFuncs[0] = CPDF_Function::Load(pObj); |
| 1121 if (!pFuncs[0]) | 1122 if (!pFuncs[0]) |
| 1122 return nullptr; | 1123 return nullptr; |
| 1123 } | 1124 } |
| 1124 CPDF_TransferFunc* pTransfer = new CPDF_TransferFunc(m_pPDFDoc); | 1125 CPDF_TransferFunc* pTransfer = new CPDF_TransferFunc(m_pPDFDoc); |
| 1125 CPDF_CountedObject<CPDF_TransferFunc>* pTransferCounter = | 1126 CPDF_CountedObject<CPDF_TransferFunc>* pTransferCounter = |
| 1126 new CPDF_CountedObject<CPDF_TransferFunc>(pTransfer); | 1127 new CPDF_CountedObject<CPDF_TransferFunc>(pTransfer); |
| 1127 m_TransferFuncMap[pObj] = pTransferCounter; | 1128 m_TransferFuncMap[pObj] = pTransferCounter; |
| 1128 static const int kMaxOutputs = 16; | 1129 static const int kMaxOutputs = 16; |
| 1129 FX_FLOAT output[kMaxOutputs]; | 1130 FX_FLOAT output[kMaxOutputs]; |
| 1130 FXSYS_memset(output, 0, sizeof(output)); | 1131 FXSYS_memset(output, 0, sizeof(output)); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject, pOptions, | 1288 m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject, pOptions, |
| 1288 &m_Matrix); | 1289 &m_Matrix); |
| 1289 return TRUE; | 1290 return TRUE; |
| 1290 } | 1291 } |
| 1291 void CPDF_ScaledRenderBuffer::OutputToDevice() { | 1292 void CPDF_ScaledRenderBuffer::OutputToDevice() { |
| 1292 if (m_pBitmapDevice) { | 1293 if (m_pBitmapDevice) { |
| 1293 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, | 1294 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, |
| 1294 m_Rect.top, m_Rect.Width(), m_Rect.Height()); | 1295 m_Rect.top, m_Rect.Width(), m_Rect.Height()); |
| 1295 } | 1296 } |
| 1296 } | 1297 } |
| OLD | NEW |