| 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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 } | 448 } |
| 449 FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix) { | 449 FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix) { |
| 450 if (matrix.a == 0 || matrix.d == 0) { | 450 if (matrix.a == 0 || matrix.d == 0) { |
| 451 return matrix.b != 0 && matrix.c != 0; | 451 return matrix.b != 0 && matrix.c != 0; |
| 452 } | 452 } |
| 453 if (matrix.b == 0 || matrix.c == 0) { | 453 if (matrix.b == 0 || matrix.c == 0) { |
| 454 return matrix.a != 0 && matrix.d != 0; | 454 return matrix.a != 0 && matrix.d != 0; |
| 455 } | 455 } |
| 456 return TRUE; | 456 return TRUE; |
| 457 } | 457 } |
| 458 |
| 458 FX_BOOL CPDF_RenderStatus::ProcessPath(const CPDF_PathObject* pPathObj, | 459 FX_BOOL CPDF_RenderStatus::ProcessPath(const CPDF_PathObject* pPathObj, |
| 459 const CFX_Matrix* pObj2Device) { | 460 const CFX_Matrix* pObj2Device) { |
| 460 int FillType = pPathObj->m_FillType; | 461 int FillType = pPathObj->m_FillType; |
| 461 FX_BOOL bStroke = pPathObj->m_bStroke; | 462 FX_BOOL bStroke = pPathObj->m_bStroke; |
| 462 ProcessPathPattern(pPathObj, pObj2Device, FillType, bStroke); | 463 ProcessPathPattern(pPathObj, pObj2Device, FillType, bStroke); |
| 463 if (FillType == 0 && !bStroke) { | 464 if (FillType == 0 && !bStroke) { |
| 464 return TRUE; | 465 return TRUE; |
| 465 } | 466 } |
| 466 uint32_t fill_argb = 0; | 467 uint32_t fill_argb = 0; |
| 467 if (FillType) { | 468 if (FillType) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 493 if (pGeneralData && pGeneralData->m_StrokeAdjust) { | 494 if (pGeneralData && pGeneralData->m_StrokeAdjust) { |
| 494 FillType |= FX_STROKE_ADJUST; | 495 FillType |= FX_STROKE_ADJUST; |
| 495 } | 496 } |
| 496 if (m_pType3Char) { | 497 if (m_pType3Char) { |
| 497 FillType |= FX_FILL_TEXT_MODE; | 498 FillType |= FX_FILL_TEXT_MODE; |
| 498 } | 499 } |
| 499 CFX_GraphStateData graphState(*pPathObj->m_GraphState); | 500 CFX_GraphStateData graphState(*pPathObj->m_GraphState); |
| 500 if (m_Options.m_Flags & RENDER_THINLINE) { | 501 if (m_Options.m_Flags & RENDER_THINLINE) { |
| 501 graphState.m_LineWidth = 0; | 502 graphState.m_LineWidth = 0; |
| 502 } | 503 } |
| 503 return m_pDevice->DrawPath(pPathObj->m_Path, &path_matrix, &graphState, | 504 return m_pDevice->DrawPathWithBlend(pPathObj->m_Path, &path_matrix, |
| 504 fill_argb, stroke_argb, FillType, 0, NULL, | 505 &graphState, fill_argb, stroke_argb, |
| 505 m_curBlend); | 506 FillType, m_curBlend); |
| 506 } | 507 } |
| 508 |
| 507 CPDF_TransferFunc* CPDF_RenderStatus::GetTransferFunc(CPDF_Object* pObj) const { | 509 CPDF_TransferFunc* CPDF_RenderStatus::GetTransferFunc(CPDF_Object* pObj) const { |
| 508 ASSERT(pObj); | 510 ASSERT(pObj); |
| 509 CPDF_DocRenderData* pDocCache = m_pContext->GetDocument()->GetRenderData(); | 511 CPDF_DocRenderData* pDocCache = m_pContext->GetDocument()->GetRenderData(); |
| 510 return pDocCache ? pDocCache->GetTransferFunc(pObj) : nullptr; | 512 return pDocCache ? pDocCache->GetTransferFunc(pObj) : nullptr; |
| 511 } | 513 } |
| 512 FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj, | 514 FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj, |
| 513 FX_BOOL bType3) const { | 515 FX_BOOL bType3) const { |
| 514 CPDF_ColorStateData* pColorData = | 516 CPDF_ColorStateData* pColorData = |
| 515 (CPDF_ColorStateData*)(const CPDF_ColorStateData*)pObj->m_ColorState; | 517 (CPDF_ColorStateData*)(const CPDF_ColorStateData*)pObj->m_ColorState; |
| 516 if (m_pType3Char && !bType3 && | 518 if (m_pType3Char && !bType3 && |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject, pOptions, | 1290 m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject, pOptions, |
| 1289 &m_Matrix); | 1291 &m_Matrix); |
| 1290 return TRUE; | 1292 return TRUE; |
| 1291 } | 1293 } |
| 1292 void CPDF_ScaledRenderBuffer::OutputToDevice() { | 1294 void CPDF_ScaledRenderBuffer::OutputToDevice() { |
| 1293 if (m_pBitmapDevice) { | 1295 if (m_pBitmapDevice) { |
| 1294 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, | 1296 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, |
| 1295 m_Rect.top, m_Rect.Width(), m_Rect.Height()); | 1297 m_Rect.top, m_Rect.Width(), m_Rect.Height()); |
| 1296 } | 1298 } |
| 1297 } | 1299 } |
| OLD | NEW |