| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 return matrix.a != 0 && matrix.d != 0; | 428 return matrix.a != 0 && matrix.d != 0; |
| 429 } | 429 } |
| 430 return TRUE; | 430 return TRUE; |
| 431 } | 431 } |
| 432 | 432 |
| 433 FX_BOOL CPDF_RenderStatus::ProcessPath(const CPDF_PathObject* pPathObj, | 433 FX_BOOL CPDF_RenderStatus::ProcessPath(const CPDF_PathObject* pPathObj, |
| 434 const CFX_Matrix* pObj2Device) { | 434 const CFX_Matrix* pObj2Device) { |
| 435 int FillType = pPathObj->m_FillType; | 435 int FillType = pPathObj->m_FillType; |
| 436 FX_BOOL bStroke = pPathObj->m_bStroke; | 436 FX_BOOL bStroke = pPathObj->m_bStroke; |
| 437 ProcessPathPattern(pPathObj, pObj2Device, FillType, bStroke); | 437 ProcessPathPattern(pPathObj, pObj2Device, FillType, bStroke); |
| 438 if (FillType == 0 && !bStroke) { | 438 if (FillType == 0 && !bStroke) |
| 439 return TRUE; | 439 return TRUE; |
| 440 } | 440 |
| 441 uint32_t fill_argb = 0; | 441 uint32_t fill_argb = FillType ? GetFillArgb(pPathObj) : 0; |
| 442 if (FillType) { | 442 uint32_t stroke_argb = bStroke ? GetStrokeArgb(pPathObj) : 0; |
| 443 fill_argb = GetFillArgb(pPathObj); | |
| 444 } | |
| 445 uint32_t stroke_argb = 0; | |
| 446 if (bStroke) { | |
| 447 stroke_argb = GetStrokeArgb(pPathObj); | |
| 448 } | |
| 449 CFX_Matrix path_matrix = pPathObj->m_Matrix; | 443 CFX_Matrix path_matrix = pPathObj->m_Matrix; |
| 450 path_matrix.Concat(*pObj2Device); | 444 path_matrix.Concat(*pObj2Device); |
| 451 if (!IsAvailableMatrix(path_matrix)) { | 445 if (!IsAvailableMatrix(path_matrix)) |
| 452 return TRUE; | 446 return TRUE; |
| 453 } | 447 |
| 454 if (FillType && (m_Options.m_Flags & RENDER_RECT_AA)) { | 448 if (FillType && (m_Options.m_Flags & RENDER_RECT_AA)) |
| 455 FillType |= FXFILL_RECT_AA; | 449 FillType |= FXFILL_RECT_AA; |
| 456 } | 450 if (m_Options.m_Flags & RENDER_FILL_FULLCOVER) |
| 457 if (m_Options.m_Flags & RENDER_FILL_FULLCOVER) { | |
| 458 FillType |= FXFILL_FULLCOVER; | 451 FillType |= FXFILL_FULLCOVER; |
| 459 } | 452 if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) |
| 460 if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) { | |
| 461 FillType |= FXFILL_NOPATHSMOOTH; | 453 FillType |= FXFILL_NOPATHSMOOTH; |
| 462 } | 454 if (bStroke) |
| 463 if (bStroke) { | |
| 464 FillType |= FX_FILL_STROKE; | 455 FillType |= FX_FILL_STROKE; |
| 465 } | |
| 466 const CPDF_GeneralStateData* pGeneralData = | 456 const CPDF_GeneralStateData* pGeneralData = |
| 467 static_cast<const CPDF_PageObject*>(pPathObj)->m_GeneralState.GetObject(); | 457 static_cast<const CPDF_PageObject*>(pPathObj)->m_GeneralState.GetObject(); |
| 468 if (pGeneralData && pGeneralData->m_StrokeAdjust) { | 458 if (pGeneralData && pGeneralData->m_StrokeAdjust) |
| 469 FillType |= FX_STROKE_ADJUST; | 459 FillType |= FX_STROKE_ADJUST; |
| 470 } | 460 if (m_pType3Char) |
| 471 if (m_pType3Char) { | |
| 472 FillType |= FX_FILL_TEXT_MODE; | 461 FillType |= FX_FILL_TEXT_MODE; |
| 473 } | 462 |
| 474 CFX_GraphStateData graphState(*pPathObj->m_GraphState.GetObject()); | 463 CFX_GraphStateData graphState(*pPathObj->m_GraphState.GetObject()); |
| 475 if (m_Options.m_Flags & RENDER_THINLINE) { | 464 if (m_Options.m_Flags & RENDER_THINLINE) |
| 476 graphState.m_LineWidth = 0; | 465 graphState.m_LineWidth = 0; |
| 477 } | |
| 478 return m_pDevice->DrawPathWithBlend(pPathObj->m_Path.GetObject(), | 466 return m_pDevice->DrawPathWithBlend(pPathObj->m_Path.GetObject(), |
| 479 &path_matrix, &graphState, fill_argb, | 467 &path_matrix, &graphState, fill_argb, |
| 480 stroke_argb, FillType, m_curBlend); | 468 stroke_argb, FillType, m_curBlend); |
| 481 } | 469 } |
| 482 | 470 |
| 483 CPDF_TransferFunc* CPDF_RenderStatus::GetTransferFunc(CPDF_Object* pObj) const { | 471 CPDF_TransferFunc* CPDF_RenderStatus::GetTransferFunc(CPDF_Object* pObj) const { |
| 484 ASSERT(pObj); | 472 ASSERT(pObj); |
| 485 CPDF_DocRenderData* pDocCache = m_pContext->GetDocument()->GetRenderData(); | 473 CPDF_DocRenderData* pDocCache = m_pContext->GetDocument()->GetRenderData(); |
| 486 return pDocCache ? pDocCache->GetTransferFunc(pObj) : nullptr; | 474 return pDocCache ? pDocCache->GetTransferFunc(pObj) : nullptr; |
| 487 } | 475 } |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject, pOptions, | 1256 m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject, pOptions, |
| 1269 &m_Matrix); | 1257 &m_Matrix); |
| 1270 return TRUE; | 1258 return TRUE; |
| 1271 } | 1259 } |
| 1272 void CPDF_ScaledRenderBuffer::OutputToDevice() { | 1260 void CPDF_ScaledRenderBuffer::OutputToDevice() { |
| 1273 if (m_pBitmapDevice) { | 1261 if (m_pBitmapDevice) { |
| 1274 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, | 1262 m_pDevice->StretchDIBits(m_pBitmapDevice->GetBitmap(), m_Rect.left, |
| 1275 m_Rect.top, m_Rect.Width(), m_Rect.Height()); | 1263 m_Rect.top, m_Rect.Width(), m_Rect.Height()); |
| 1276 } | 1264 } |
| 1277 } | 1265 } |
| OLD | NEW |