| 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 "xfa/fde/fde_render.h" | 7 #include "xfa/fde/fde_render.h" |
| 8 | 8 |
| 9 #include "third_party/base/ptr_util.h" | 9 #include "third_party/base/ptr_util.h" |
| 10 #include "xfa/fde/fde_gedevice.h" | 10 #include "xfa/fde/fde_gedevice.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 m_pIterator.reset(); | 101 m_pIterator.reset(); |
| 102 m_pBrush.reset(); | 102 m_pBrush.reset(); |
| 103 m_CharPos.clear(); | 103 m_CharPos.clear(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void CFDE_RenderContext::RenderText(IFDE_TextSet* pTextSet, | 106 void CFDE_RenderContext::RenderText(IFDE_TextSet* pTextSet, |
| 107 FDE_TEXTEDITPIECE* pText) { | 107 FDE_TEXTEDITPIECE* pText) { |
| 108 ASSERT(m_pRenderDevice); | 108 ASSERT(m_pRenderDevice); |
| 109 ASSERT(pTextSet && pText); | 109 ASSERT(pTextSet && pText); |
| 110 | 110 |
| 111 CFGAS_GEFont* pFont = pTextSet->GetFont(); | 111 CFX_RetainPtr<CFGAS_GEFont> pFont = pTextSet->GetFont(); |
| 112 if (!pFont) | 112 if (!pFont) |
| 113 return; | 113 return; |
| 114 | 114 |
| 115 int32_t iCount = pTextSet->GetDisplayPos(pText, nullptr, false); | 115 int32_t iCount = pTextSet->GetDisplayPos(pText, nullptr, false); |
| 116 if (iCount < 1) | 116 if (iCount < 1) |
| 117 return; | 117 return; |
| 118 | 118 |
| 119 if (!m_pBrush) | 119 if (!m_pBrush) |
| 120 m_pBrush = pdfium::MakeUnique<CFDE_Brush>(); | 120 m_pBrush = pdfium::MakeUnique<CFDE_Brush>(); |
| 121 | 121 |
| 122 if (m_CharPos.size() < static_cast<size_t>(iCount)) | 122 if (m_CharPos.size() < static_cast<size_t>(iCount)) |
| 123 m_CharPos.resize(iCount, FXTEXT_CHARPOS()); | 123 m_CharPos.resize(iCount, FXTEXT_CHARPOS()); |
| 124 | 124 |
| 125 iCount = pTextSet->GetDisplayPos(pText, m_CharPos.data(), false); | 125 iCount = pTextSet->GetDisplayPos(pText, m_CharPos.data(), false); |
| 126 FX_FLOAT fFontSize = pTextSet->GetFontSize(); | 126 FX_FLOAT fFontSize = pTextSet->GetFontSize(); |
| 127 FX_ARGB dwColor = pTextSet->GetFontColor(); | 127 FX_ARGB dwColor = pTextSet->GetFontColor(); |
| 128 m_pBrush->SetColor(dwColor); | 128 m_pBrush->SetColor(dwColor); |
| 129 m_pRenderDevice->DrawString(m_pBrush.get(), pFont, m_CharPos.data(), iCount, | 129 m_pRenderDevice->DrawString(m_pBrush.get(), pFont, m_CharPos.data(), iCount, |
| 130 fFontSize, &m_Transform); | 130 fFontSize, &m_Transform); |
| 131 } | 131 } |
| 132 | 132 |
| OLD | NEW |