Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: xfa/fde/fde_gedevice.cpp

Issue 2037563002: Replace IFGAS_Font with underlying concrete type (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Fix Windows Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 99 }
99 void* handle = NULL; 100 void* handle = NULL;
100 m_pDevice->StartDIBits(pDib, 255, 0, (const CFX_Matrix*)&dib2fxdev, 0, 101 m_pDevice->StartDIBits(pDib, 255, 0, (const CFX_Matrix*)&dib2fxdev, 0,
101 handle); 102 handle);
102 while (m_pDevice->ContinueDIBits(handle, NULL)) { 103 while (m_pDevice->ContinueDIBits(handle, NULL)) {
103 } 104 }
104 m_pDevice->CancelDIBits(handle); 105 m_pDevice->CancelDIBits(handle);
105 return handle != NULL; 106 return handle != NULL;
106 } 107 }
107 FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, 108 FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush,
108 IFX_Font* pFont, 109 CFX_GEFont* pFont,
109 const FXTEXT_CHARPOS* pCharPos, 110 const FXTEXT_CHARPOS* pCharPos,
110 int32_t iCount, 111 int32_t iCount,
111 FX_FLOAT fFontSize, 112 FX_FLOAT fFontSize,
112 const CFX_Matrix* pMatrix) { 113 const CFX_Matrix* pMatrix) {
113 ASSERT(pBrush != NULL && pFont != NULL && pCharPos != NULL && iCount > 0); 114 ASSERT(pBrush != NULL && pFont != NULL && pCharPos != NULL && iCount > 0);
114 CFX_FontCache* pCache = CFX_GEModule::Get()->GetFontCache(); 115 CFX_FontCache* pCache = CFX_GEModule::Get()->GetFontCache();
115 CFX_Font* pFxFont = (CFX_Font*)pFont->GetDevFont(); 116 CFX_Font* pFxFont = (CFX_Font*)pFont->GetDevFont();
116 117
117 FX_ARGB argb = pBrush->GetColor(); 118 FX_ARGB argb = pBrush->GetColor();
118 if ((pFont->GetFontStyles() & FX_FONTSTYLE_Italic) != 0 && 119 if ((pFont->GetFontStyles() & FX_FONTSTYLE_Italic) != 0 &&
119 !pFxFont->IsItalic()) { 120 !pFxFont->IsItalic()) {
120 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; 121 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos;
121 FX_FLOAT* pAM; 122 FX_FLOAT* pAM;
122 for (int32_t i = 0; i < iCount; ++i) { 123 for (int32_t i = 0; i < iCount; ++i) {
123 static const FX_FLOAT mc = 0.267949f; 124 static const FX_FLOAT mc = 0.267949f;
124 pAM = pCP->m_AdjustMatrix; 125 pAM = pCP->m_AdjustMatrix;
125 pAM[2] = mc * pAM[0] + pAM[2]; 126 pAM[2] = mc * pAM[0] + pAM[2];
126 pAM[3] = mc * pAM[1] + pAM[3]; 127 pAM[3] = mc * pAM[1] + pAM[3];
127 pCP++; 128 pCP++;
128 } 129 }
129 } 130 }
130 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; 131 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos;
131 IFX_Font* pCurFont = NULL; 132 CFX_GEFont* pCurFont = NULL;
132 IFX_Font* pSTFont = NULL; 133 CFX_GEFont* pSTFont = NULL;
133 FXTEXT_CHARPOS* pCurCP = NULL; 134 FXTEXT_CHARPOS* pCurCP = NULL;
134 int32_t iCurCount = 0; 135 int32_t iCurCount = 0;
135 136
136 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 137 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
137 uint32_t dwFontStyle = pFont->GetFontStyles(); 138 uint32_t dwFontStyle = pFont->GetFontStyles();
138 CFX_Font FxFont; 139 CFX_Font FxFont;
139 CFX_SubstFont SubstFxFont; 140 CFX_SubstFont SubstFxFont;
140 FxFont.SetSubstFont(&SubstFxFont); 141 FxFont.SetSubstFont(&SubstFxFont);
141 SubstFxFont.m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400; 142 SubstFxFont.m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400;
142 SubstFxFont.m_WeightCJK = SubstFxFont.m_Weight; 143 SubstFxFont.m_WeightCJK = SubstFxFont.m_Weight;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 const CFX_Matrix* pMatrix) { 328 const CFX_Matrix* pMatrix) {
328 CFDE_Path* pGePath = (CFDE_Path*)pPath; 329 CFDE_Path* pGePath = (CFDE_Path*)pPath;
329 if (!pGePath) 330 if (!pGePath)
330 return FALSE; 331 return FALSE;
331 if (!pBrush) 332 if (!pBrush)
332 return FALSE; 333 return FALSE;
333 return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr, 334 return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr,
334 pBrush->GetColor(), 0, FXFILL_WINDING); 335 pBrush->GetColor(), 0, FXFILL_WINDING);
335 } 336 }
336 337
OLDNEW
« no previous file with comments | « xfa/fde/fde_gedevice.h ('k') | xfa/fde/fde_render.cpp » ('j') | xfa/fgas/font/fgas_font.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698