| 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_gedevice.h" | 7 #include "xfa/fde/fde_gedevice.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "xfa/fde/cfde_path.h" | 11 #include "xfa/fde/cfde_path.h" |
| 12 #include "xfa/fde/fde_object.h" | 12 #include "xfa/fde/fde_object.h" |
| 13 #include "xfa/fgas/font/fgas_font.h" | 13 #include "xfa/fgas/font/fgas_font.h" |
| 14 #include "xfa/fgas/font/fgas_gefont.h" |
| 14 | 15 |
| 15 CFDE_RenderDevice::CFDE_RenderDevice(CFX_RenderDevice* pDevice, | 16 CFDE_RenderDevice::CFDE_RenderDevice(CFX_RenderDevice* pDevice, |
| 16 FX_BOOL bOwnerDevice) | 17 FX_BOOL bOwnerDevice) |
| 17 : m_pDevice(pDevice), | 18 : m_pDevice(pDevice), |
| 18 m_bOwnerDevice(bOwnerDevice), | 19 m_bOwnerDevice(bOwnerDevice), |
| 19 m_pCharPos(nullptr), | 20 m_pCharPos(nullptr), |
| 20 m_iCharCount(0) { | 21 m_iCharCount(0) { |
| 21 ASSERT(pDevice); | 22 ASSERT(pDevice); |
| 22 | 23 |
| 23 FX_RECT rt = m_pDevice->GetClipBox(); | 24 FX_RECT rt = m_pDevice->GetClipBox(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 98 } |
| 98 void* handle = NULL; | 99 void* handle = NULL; |
| 99 m_pDevice->StartDIBits(pDib, 255, 0, (const CFX_Matrix*)&dib2fxdev, 0, | 100 m_pDevice->StartDIBits(pDib, 255, 0, (const CFX_Matrix*)&dib2fxdev, 0, |
| 100 handle); | 101 handle); |
| 101 while (m_pDevice->ContinueDIBits(handle, NULL)) { | 102 while (m_pDevice->ContinueDIBits(handle, NULL)) { |
| 102 } | 103 } |
| 103 m_pDevice->CancelDIBits(handle); | 104 m_pDevice->CancelDIBits(handle); |
| 104 return handle != NULL; | 105 return handle != NULL; |
| 105 } | 106 } |
| 106 FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, | 107 FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, |
| 107 IFGAS_Font* pFont, | 108 CFGAS_GEFont* pFont, |
| 108 const FXTEXT_CHARPOS* pCharPos, | 109 const FXTEXT_CHARPOS* pCharPos, |
| 109 int32_t iCount, | 110 int32_t iCount, |
| 110 FX_FLOAT fFontSize, | 111 FX_FLOAT fFontSize, |
| 111 const CFX_Matrix* pMatrix) { | 112 const CFX_Matrix* pMatrix) { |
| 112 ASSERT(pBrush && pFont && pCharPos && iCount > 0); | 113 ASSERT(pBrush && pFont && pCharPos && iCount > 0); |
| 113 CFX_FontCache* pCache = CFX_GEModule::Get()->GetFontCache(); | 114 CFX_FontCache* pCache = CFX_GEModule::Get()->GetFontCache(); |
| 114 CFX_Font* pFxFont = pFont->GetDevFont(); | 115 CFX_Font* pFxFont = pFont->GetDevFont(); |
| 115 FX_ARGB argb = pBrush->GetColor(); | 116 FX_ARGB argb = pBrush->GetColor(); |
| 116 if ((pFont->GetFontStyles() & FX_FONTSTYLE_Italic) != 0 && | 117 if ((pFont->GetFontStyles() & FX_FONTSTYLE_Italic) != 0 && |
| 117 !pFxFont->IsItalic()) { | 118 !pFxFont->IsItalic()) { |
| 118 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; | 119 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; |
| 119 FX_FLOAT* pAM; | 120 FX_FLOAT* pAM; |
| 120 for (int32_t i = 0; i < iCount; ++i) { | 121 for (int32_t i = 0; i < iCount; ++i) { |
| 121 static const FX_FLOAT mc = 0.267949f; | 122 static const FX_FLOAT mc = 0.267949f; |
| 122 pAM = pCP->m_AdjustMatrix; | 123 pAM = pCP->m_AdjustMatrix; |
| 123 pAM[2] = mc * pAM[0] + pAM[2]; | 124 pAM[2] = mc * pAM[0] + pAM[2]; |
| 124 pAM[3] = mc * pAM[1] + pAM[3]; | 125 pAM[3] = mc * pAM[1] + pAM[3]; |
| 125 pCP++; | 126 pCP++; |
| 126 } | 127 } |
| 127 } | 128 } |
| 128 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; | 129 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; |
| 129 IFGAS_Font* pCurFont = NULL; | 130 CFGAS_GEFont* pCurFont = NULL; |
| 130 IFGAS_Font* pSTFont = NULL; | 131 CFGAS_GEFont* pSTFont = NULL; |
| 131 FXTEXT_CHARPOS* pCurCP = NULL; | 132 FXTEXT_CHARPOS* pCurCP = NULL; |
| 132 int32_t iCurCount = 0; | 133 int32_t iCurCount = 0; |
| 133 | 134 |
| 134 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 135 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
| 135 uint32_t dwFontStyle = pFont->GetFontStyles(); | 136 uint32_t dwFontStyle = pFont->GetFontStyles(); |
| 136 CFX_Font FxFont; | 137 CFX_Font FxFont; |
| 137 CFX_SubstFont SubstFxFont; | 138 CFX_SubstFont SubstFxFont; |
| 138 FxFont.SetSubstFont(&SubstFxFont); | 139 FxFont.SetSubstFont(&SubstFxFont); |
| 139 SubstFxFont.m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400; | 140 SubstFxFont.m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400; |
| 140 SubstFxFont.m_WeightCJK = SubstFxFont.m_Weight; | 141 SubstFxFont.m_WeightCJK = SubstFxFont.m_Weight; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 const CFX_Matrix* pMatrix) { | 324 const CFX_Matrix* pMatrix) { |
| 324 CFDE_Path* pGePath = (CFDE_Path*)pPath; | 325 CFDE_Path* pGePath = (CFDE_Path*)pPath; |
| 325 if (!pGePath) | 326 if (!pGePath) |
| 326 return FALSE; | 327 return FALSE; |
| 327 if (!pBrush) | 328 if (!pBrush) |
| 328 return FALSE; | 329 return FALSE; |
| 329 return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr, | 330 return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr, |
| 330 pBrush->GetColor(), 0, FXFILL_WINDING); | 331 pBrush->GetColor(), 0, FXFILL_WINDING); |
| 331 } | 332 } |
| 332 | 333 |
| OLD | NEW |