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

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

Issue 1881803003: Remove IFDE_Pen and IFDE_Brush. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « xfa/fde/fde_gedevice.h ('k') | xfa/fde/fde_object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/fde_brush.h"
12 #include "xfa/fde/fde_geobject.h" 11 #include "xfa/fde/fde_geobject.h"
13 #include "xfa/fde/fde_image.h" 12 #include "xfa/fde/fde_image.h"
14 #include "xfa/fde/fde_object.h" 13 #include "xfa/fde/fde_object.h"
15 #include "xfa/fde/fde_pen.h"
16 14
17 IFDE_RenderDevice* IFDE_RenderDevice::Create(CFX_DIBitmap* pBitmap, 15 IFDE_RenderDevice* IFDE_RenderDevice::Create(CFX_DIBitmap* pBitmap,
18 FX_BOOL bRgbByteOrder) { 16 FX_BOOL bRgbByteOrder) {
19 if (pBitmap == NULL) { 17 if (pBitmap == NULL) {
20 return NULL; 18 return NULL;
21 } 19 }
22 CFX_FxgeDevice* pDevice = new CFX_FxgeDevice; 20 CFX_FxgeDevice* pDevice = new CFX_FxgeDevice;
23 pDevice->Attach(pBitmap, 0, bRgbByteOrder); 21 pDevice->Attach(pBitmap, 0, bRgbByteOrder);
24 return new CFDE_FxgeDevice(pDevice, TRUE); 22 return new CFDE_FxgeDevice(pDevice, TRUE);
25 } 23 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 dib2fxdev.Concat(*pDevMatrix); 107 dib2fxdev.Concat(*pDevMatrix);
110 } 108 }
111 void* handle = NULL; 109 void* handle = NULL;
112 m_pDevice->StartDIBits(pDib, 255, 0, (const CFX_Matrix*)&dib2fxdev, 0, 110 m_pDevice->StartDIBits(pDib, 255, 0, (const CFX_Matrix*)&dib2fxdev, 0,
113 handle); 111 handle);
114 while (m_pDevice->ContinueDIBits(handle, NULL)) { 112 while (m_pDevice->ContinueDIBits(handle, NULL)) {
115 } 113 }
116 m_pDevice->CancelDIBits(handle); 114 m_pDevice->CancelDIBits(handle);
117 return handle != NULL; 115 return handle != NULL;
118 } 116 }
119 FX_BOOL CFDE_FxgeDevice::DrawString(IFDE_Brush* pBrush, 117 FX_BOOL CFDE_FxgeDevice::DrawString(CFDE_Brush* pBrush,
120 IFX_Font* pFont, 118 IFX_Font* pFont,
121 const FXTEXT_CHARPOS* pCharPos, 119 const FXTEXT_CHARPOS* pCharPos,
122 int32_t iCount, 120 int32_t iCount,
123 FX_FLOAT fFontSize, 121 FX_FLOAT fFontSize,
124 const CFX_Matrix* pMatrix) { 122 const CFX_Matrix* pMatrix) {
125 FXSYS_assert(pBrush != NULL && pFont != NULL && pCharPos != NULL && 123 FXSYS_assert(pBrush != NULL && pFont != NULL && pCharPos != NULL &&
126 iCount > 0); 124 iCount > 0);
127 CFX_FontCache* pCache = CFX_GEModule::Get()->GetFontCache(); 125 CFX_FontCache* pCache = CFX_GEModule::Get()->GetFontCache();
128 CFX_Font* pFxFont = (CFX_Font*)pFont->GetDevFont(); 126 CFX_Font* pFxFont = (CFX_Font*)pFont->GetDevFont();
129 switch (pBrush->GetType()) { 127
130 case FDE_BRUSHTYPE_Solid: { 128 FX_ARGB argb = pBrush->GetColor();
131 FX_ARGB argb = ((IFDE_SolidBrush*)pBrush)->GetColor(); 129 if ((pFont->GetFontStyles() & FX_FONTSTYLE_Italic) != 0 &&
132 if ((pFont->GetFontStyles() & FX_FONTSTYLE_Italic) != 0 && 130 !pFxFont->IsItalic()) {
133 !pFxFont->IsItalic()) { 131 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos;
134 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; 132 FX_FLOAT* pAM;
135 FX_FLOAT* pAM; 133 for (int32_t i = 0; i < iCount; ++i) {
136 for (int32_t i = 0; i < iCount; ++i) { 134 static const FX_FLOAT mc = 0.267949f;
137 static const FX_FLOAT mc = 0.267949f; 135 pAM = pCP->m_AdjustMatrix;
138 pAM = pCP->m_AdjustMatrix; 136 pAM[2] = mc * pAM[0] + pAM[2];
139 pAM[2] = mc * pAM[0] + pAM[2]; 137 pAM[3] = mc * pAM[1] + pAM[3];
140 pAM[3] = mc * pAM[1] + pAM[3]; 138 pCP++;
141 pCP++; 139 }
142 } 140 }
143 } 141 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos;
144 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; 142 IFX_Font* pCurFont = NULL;
145 IFX_Font* pCurFont = NULL; 143 IFX_Font* pSTFont = NULL;
146 IFX_Font* pSTFont = NULL; 144 FXTEXT_CHARPOS* pCurCP = NULL;
147 FXTEXT_CHARPOS* pCurCP = NULL; 145 int32_t iCurCount = 0;
148 int32_t iCurCount = 0; 146
149 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 147 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
150 uint32_t dwFontStyle = pFont->GetFontStyles(); 148 uint32_t dwFontStyle = pFont->GetFontStyles();
151 CFX_Font FxFont; 149 CFX_Font FxFont;
152 CFX_SubstFont SubstFxFont; 150 CFX_SubstFont SubstFxFont;
153 FxFont.SetSubstFont(&SubstFxFont); 151 FxFont.SetSubstFont(&SubstFxFont);
154 SubstFxFont.m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400; 152 SubstFxFont.m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400;
155 SubstFxFont.m_WeightCJK = SubstFxFont.m_Weight; 153 SubstFxFont.m_WeightCJK = SubstFxFont.m_Weight;
156 SubstFxFont.m_ItalicAngle = dwFontStyle & FX_FONTSTYLE_Italic ? -12 : 0; 154 SubstFxFont.m_ItalicAngle = dwFontStyle & FX_FONTSTYLE_Italic ? -12 : 0;
157 SubstFxFont.m_bItlicCJK = !!(dwFontStyle & FX_FONTSTYLE_Italic); 155 SubstFxFont.m_bItlicCJK = !!(dwFontStyle & FX_FONTSTYLE_Italic);
158 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 156 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
159 for (int32_t i = 0; i < iCount; ++i) { 157
160 pSTFont = pFont->GetSubstFont((int32_t)pCP->m_GlyphIndex); 158 for (int32_t i = 0; i < iCount; ++i) {
161 pCP->m_GlyphIndex &= 0x00FFFFFF; 159 pSTFont = pFont->GetSubstFont((int32_t)pCP->m_GlyphIndex);
162 pCP->m_bFontStyle = FALSE; 160 pCP->m_GlyphIndex &= 0x00FFFFFF;
163 if (pCurFont != pSTFont) { 161 pCP->m_bFontStyle = FALSE;
164 if (pCurFont != NULL) { 162 if (pCurFont != pSTFont) {
165 pFxFont = (CFX_Font*)pCurFont->GetDevFont(); 163 if (pCurFont != NULL) {
166 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
167 FxFont.SetFace(pFxFont->GetFace());
168 m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, pCache,
169 -fFontSize, (const CFX_Matrix*)pMatrix,
170 argb, FXTEXT_CLEARTYPE);
171 #else
172 m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, pCache,
173 -fFontSize, (const CFX_Matrix*)pMatrix,
174 argb, FXTEXT_CLEARTYPE);
175 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
176 }
177 pCurFont = pSTFont;
178 pCurCP = pCP;
179 iCurCount = 1;
180 } else {
181 iCurCount++;
182 }
183 pCP++;
184 }
185 if (pCurFont != NULL && iCurCount) {
186 pFxFont = (CFX_Font*)pCurFont->GetDevFont(); 164 pFxFont = (CFX_Font*)pCurFont->GetDevFont();
165
187 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 166 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
188 FxFont.SetFace(pFxFont->GetFace()); 167 FxFont.SetFace(pFxFont->GetFace());
189 FX_BOOL bRet = m_pDevice->DrawNormalText( 168 m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, pCache,
190 iCurCount, pCurCP, &FxFont, pCache, -fFontSize, 169 -fFontSize, (const CFX_Matrix*)pMatrix, argb,
191 (const CFX_Matrix*)pMatrix, argb, FXTEXT_CLEARTYPE); 170 FXTEXT_CLEARTYPE);
192 FxFont.SetSubstFont(nullptr);
193 FxFont.SetFace(nullptr);
194 return bRet;
195 #else 171 #else
196 return m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, pCache, 172 m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, pCache,
197 -fFontSize, (const CFX_Matrix*)pMatrix, 173 -fFontSize, (const CFX_Matrix*)pMatrix, argb,
198 argb, FXTEXT_CLEARTYPE); 174 FXTEXT_CLEARTYPE);
199 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 175 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
200 } 176 }
177 pCurFont = pSTFont;
178 pCurCP = pCP;
179 iCurCount = 1;
180 } else {
181 iCurCount++;
182 }
183 pCP++;
184 }
185 if (pCurFont != NULL && iCurCount) {
186 pFxFont = (CFX_Font*)pCurFont->GetDevFont();
187
201 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 188 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
202 FxFont.SetSubstFont(nullptr); 189 FxFont.SetFace(pFxFont->GetFace());
203 FxFont.SetFace(nullptr); 190 FX_BOOL bRet = m_pDevice->DrawNormalText(
191 iCurCount, pCurCP, &FxFont, pCache, -fFontSize,
192 (const CFX_Matrix*)pMatrix, argb, FXTEXT_CLEARTYPE);
193 FxFont.SetSubstFont(nullptr);
194 FxFont.SetFace(nullptr);
195 return bRet;
196 #else
197 return m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, pCache,
198 -fFontSize, (const CFX_Matrix*)pMatrix,
199 argb, FXTEXT_CLEARTYPE);
204 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 200 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
205 return TRUE;
206 } break;
207 default:
208 return FALSE;
209 } 201 }
202
203 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
204 FxFont.SetSubstFont(nullptr);
205 FxFont.SetFace(nullptr);
206 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
207
208 return TRUE;
210 } 209 }
211 FX_BOOL CFDE_FxgeDevice::DrawBezier(IFDE_Pen* pPen, 210
211 FX_BOOL CFDE_FxgeDevice::DrawBezier(CFDE_Pen* pPen,
212 FX_FLOAT fPenWidth, 212 FX_FLOAT fPenWidth,
213 const CFX_PointF& pt1, 213 const CFX_PointF& pt1,
214 const CFX_PointF& pt2, 214 const CFX_PointF& pt2,
215 const CFX_PointF& pt3, 215 const CFX_PointF& pt3,
216 const CFX_PointF& pt4, 216 const CFX_PointF& pt4,
217 const CFX_Matrix* pMatrix) { 217 const CFX_Matrix* pMatrix) {
218 CFX_PointsF points; 218 CFX_PointsF points;
219 points.Add(pt1); 219 points.Add(pt1);
220 points.Add(pt2); 220 points.Add(pt2);
221 points.Add(pt3); 221 points.Add(pt3);
222 points.Add(pt4); 222 points.Add(pt4);
223 CFDE_Path path; 223 CFDE_Path path;
224 path.AddBezier(points); 224 path.AddBezier(points);
225 return DrawPath(pPen, fPenWidth, &path, pMatrix); 225 return DrawPath(pPen, fPenWidth, &path, pMatrix);
226 } 226 }
227 FX_BOOL CFDE_FxgeDevice::DrawCurve(IFDE_Pen* pPen, 227 FX_BOOL CFDE_FxgeDevice::DrawCurve(CFDE_Pen* pPen,
228 FX_FLOAT fPenWidth, 228 FX_FLOAT fPenWidth,
229 const CFX_PointsF& points, 229 const CFX_PointsF& points,
230 FX_BOOL bClosed, 230 FX_BOOL bClosed,
231 FX_FLOAT fTension, 231 FX_FLOAT fTension,
232 const CFX_Matrix* pMatrix) { 232 const CFX_Matrix* pMatrix) {
233 CFDE_Path path; 233 CFDE_Path path;
234 path.AddCurve(points, bClosed, fTension); 234 path.AddCurve(points, bClosed, fTension);
235 return DrawPath(pPen, fPenWidth, &path, pMatrix); 235 return DrawPath(pPen, fPenWidth, &path, pMatrix);
236 } 236 }
237 FX_BOOL CFDE_FxgeDevice::DrawEllipse(IFDE_Pen* pPen, 237 FX_BOOL CFDE_FxgeDevice::DrawEllipse(CFDE_Pen* pPen,
238 FX_FLOAT fPenWidth, 238 FX_FLOAT fPenWidth,
239 const CFX_RectF& rect, 239 const CFX_RectF& rect,
240 const CFX_Matrix* pMatrix) { 240 const CFX_Matrix* pMatrix) {
241 CFDE_Path path; 241 CFDE_Path path;
242 path.AddEllipse(rect); 242 path.AddEllipse(rect);
243 return DrawPath(pPen, fPenWidth, &path, pMatrix); 243 return DrawPath(pPen, fPenWidth, &path, pMatrix);
244 } 244 }
245 FX_BOOL CFDE_FxgeDevice::DrawLines(IFDE_Pen* pPen, 245 FX_BOOL CFDE_FxgeDevice::DrawLines(CFDE_Pen* pPen,
246 FX_FLOAT fPenWidth, 246 FX_FLOAT fPenWidth,
247 const CFX_PointsF& points, 247 const CFX_PointsF& points,
248 const CFX_Matrix* pMatrix) { 248 const CFX_Matrix* pMatrix) {
249 CFDE_Path path; 249 CFDE_Path path;
250 path.AddLines(points); 250 path.AddLines(points);
251 return DrawPath(pPen, fPenWidth, &path, pMatrix); 251 return DrawPath(pPen, fPenWidth, &path, pMatrix);
252 } 252 }
253 FX_BOOL CFDE_FxgeDevice::DrawLine(IFDE_Pen* pPen, 253 FX_BOOL CFDE_FxgeDevice::DrawLine(CFDE_Pen* pPen,
254 FX_FLOAT fPenWidth, 254 FX_FLOAT fPenWidth,
255 const CFX_PointF& pt1, 255 const CFX_PointF& pt1,
256 const CFX_PointF& pt2, 256 const CFX_PointF& pt2,
257 const CFX_Matrix* pMatrix) { 257 const CFX_Matrix* pMatrix) {
258 CFDE_Path path; 258 CFDE_Path path;
259 path.AddLine(pt1, pt2); 259 path.AddLine(pt1, pt2);
260 return DrawPath(pPen, fPenWidth, &path, pMatrix); 260 return DrawPath(pPen, fPenWidth, &path, pMatrix);
261 } 261 }
262 FX_BOOL CFDE_FxgeDevice::DrawPath(IFDE_Pen* pPen, 262 FX_BOOL CFDE_FxgeDevice::DrawPath(CFDE_Pen* pPen,
263 FX_FLOAT fPenWidth, 263 FX_FLOAT fPenWidth,
264 const IFDE_Path* pPath, 264 const IFDE_Path* pPath,
265 const CFX_Matrix* pMatrix) { 265 const CFX_Matrix* pMatrix) {
266 CFDE_Path* pGePath = (CFDE_Path*)pPath; 266 CFDE_Path* pGePath = (CFDE_Path*)pPath;
267 if (pGePath == NULL) { 267 if (pGePath == NULL) {
268 return FALSE; 268 return FALSE;
269 } 269 }
270 CFX_GraphStateData graphState; 270 CFX_GraphStateData graphState;
271 if (!CreatePen(pPen, fPenWidth, graphState)) { 271 if (!CreatePen(pPen, fPenWidth, graphState)) {
272 return FALSE; 272 return FALSE;
273 } 273 }
274 return m_pDevice->DrawPath(&pGePath->m_Path, (const CFX_Matrix*)pMatrix, 274 return m_pDevice->DrawPath(&pGePath->m_Path, (const CFX_Matrix*)pMatrix,
275 &graphState, 0, pPen->GetColor(), 0); 275 &graphState, 0, pPen->GetColor(), 0);
276 } 276 }
277 FX_BOOL CFDE_FxgeDevice::DrawPolygon(IFDE_Pen* pPen, 277 FX_BOOL CFDE_FxgeDevice::DrawPolygon(CFDE_Pen* pPen,
278 FX_FLOAT fPenWidth, 278 FX_FLOAT fPenWidth,
279 const CFX_PointsF& points, 279 const CFX_PointsF& points,
280 const CFX_Matrix* pMatrix) { 280 const CFX_Matrix* pMatrix) {
281 CFDE_Path path; 281 CFDE_Path path;
282 path.AddPolygon(points); 282 path.AddPolygon(points);
283 return DrawPath(pPen, fPenWidth, &path, pMatrix); 283 return DrawPath(pPen, fPenWidth, &path, pMatrix);
284 } 284 }
285 FX_BOOL CFDE_FxgeDevice::DrawRectangle(IFDE_Pen* pPen, 285 FX_BOOL CFDE_FxgeDevice::DrawRectangle(CFDE_Pen* pPen,
286 FX_FLOAT fPenWidth, 286 FX_FLOAT fPenWidth,
287 const CFX_RectF& rect, 287 const CFX_RectF& rect,
288 const CFX_Matrix* pMatrix) { 288 const CFX_Matrix* pMatrix) {
289 CFDE_Path path; 289 CFDE_Path path;
290 path.AddRectangle(rect); 290 path.AddRectangle(rect);
291 return DrawPath(pPen, fPenWidth, &path, pMatrix); 291 return DrawPath(pPen, fPenWidth, &path, pMatrix);
292 } 292 }
293 FX_BOOL CFDE_FxgeDevice::FillClosedCurve(IFDE_Brush* pBrush, 293 FX_BOOL CFDE_FxgeDevice::FillClosedCurve(CFDE_Brush* pBrush,
294 const CFX_PointsF& points, 294 const CFX_PointsF& points,
295 FX_FLOAT fTension, 295 FX_FLOAT fTension,
296 const CFX_Matrix* pMatrix) { 296 const CFX_Matrix* pMatrix) {
297 CFDE_Path path; 297 CFDE_Path path;
298 path.AddCurve(points, TRUE, fTension); 298 path.AddCurve(points, TRUE, fTension);
299 return FillPath(pBrush, &path, pMatrix); 299 return FillPath(pBrush, &path, pMatrix);
300 } 300 }
301 FX_BOOL CFDE_FxgeDevice::FillEllipse(IFDE_Brush* pBrush, 301 FX_BOOL CFDE_FxgeDevice::FillEllipse(CFDE_Brush* pBrush,
302 const CFX_RectF& rect, 302 const CFX_RectF& rect,
303 const CFX_Matrix* pMatrix) { 303 const CFX_Matrix* pMatrix) {
304 CFDE_Path path; 304 CFDE_Path path;
305 path.AddEllipse(rect); 305 path.AddEllipse(rect);
306 return FillPath(pBrush, &path, pMatrix); 306 return FillPath(pBrush, &path, pMatrix);
307 } 307 }
308 FX_BOOL CFDE_FxgeDevice::FillPolygon(IFDE_Brush* pBrush, 308 FX_BOOL CFDE_FxgeDevice::FillPolygon(CFDE_Brush* pBrush,
309 const CFX_PointsF& points, 309 const CFX_PointsF& points,
310 const CFX_Matrix* pMatrix) { 310 const CFX_Matrix* pMatrix) {
311 CFDE_Path path; 311 CFDE_Path path;
312 path.AddPolygon(points); 312 path.AddPolygon(points);
313 return FillPath(pBrush, &path, pMatrix); 313 return FillPath(pBrush, &path, pMatrix);
314 } 314 }
315 FX_BOOL CFDE_FxgeDevice::FillRectangle(IFDE_Brush* pBrush, 315 FX_BOOL CFDE_FxgeDevice::FillRectangle(CFDE_Brush* pBrush,
316 const CFX_RectF& rect, 316 const CFX_RectF& rect,
317 const CFX_Matrix* pMatrix) { 317 const CFX_Matrix* pMatrix) {
318 CFDE_Path path; 318 CFDE_Path path;
319 path.AddRectangle(rect); 319 path.AddRectangle(rect);
320 return FillPath(pBrush, &path, pMatrix); 320 return FillPath(pBrush, &path, pMatrix);
321 } 321 }
322 FX_BOOL CFDE_FxgeDevice::CreatePen(IFDE_Pen* pPen, 322 FX_BOOL CFDE_FxgeDevice::CreatePen(CFDE_Pen* pPen,
323 FX_FLOAT fPenWidth, 323 FX_FLOAT fPenWidth,
324 CFX_GraphStateData& graphState) { 324 CFX_GraphStateData& graphState) {
325 if (pPen == NULL) { 325 if (!pPen)
326 return FALSE; 326 return FALSE;
327 } 327
328 graphState.m_LineCap = (CFX_GraphStateData::LineCap)pPen->GetLineCap(); 328 graphState.m_LineCap = CFX_GraphStateData::LineCapButt;
329 graphState.m_LineJoin = (CFX_GraphStateData::LineJoin)pPen->GetLineJoin(); 329 graphState.m_LineJoin = CFX_GraphStateData::LineJoinMiter;
330 graphState.m_LineWidth = fPenWidth; 330 graphState.m_LineWidth = fPenWidth;
331 graphState.m_MiterLimit = pPen->GetMiterLimit(); 331 graphState.m_MiterLimit = 10;
332 graphState.m_DashPhase = pPen->GetDashPhase(); 332 graphState.m_DashPhase = 0;
333 CFX_FloatArray dashArray;
334 switch (pPen->GetDashStyle()) {
335 case FDE_DASHSTYLE_Dash:
336 dashArray.Add(3);
337 dashArray.Add(1);
338 break;
339 case FDE_DASHSTYLE_Dot:
340 dashArray.Add(1);
341 dashArray.Add(1);
342 break;
343 case FDE_DASHSTYLE_DashDot:
344 dashArray.Add(3);
345 dashArray.Add(1);
346 dashArray.Add(1);
347 dashArray.Add(1);
348 break;
349 case FDE_DASHSTYLE_DashDotDot:
350 dashArray.Add(3);
351 dashArray.Add(1);
352 dashArray.Add(1);
353 dashArray.Add(1);
354 dashArray.Add(1);
355 dashArray.Add(1);
356 break;
357 case FDE_DASHSTYLE_Customized:
358 pPen->GetDashArray(dashArray);
359 break;
360 }
361 int32_t iDashCount = dashArray.GetSize();
362 if (iDashCount > 0) {
363 graphState.SetDashCount(iDashCount);
364 for (int32_t i = 0; i < iDashCount; ++i) {
365 graphState.m_DashArray[i] = dashArray[i] * fPenWidth;
366 }
367 }
368 return TRUE; 333 return TRUE;
369 } 334 }
370 335
371 FX_BOOL CFDE_FxgeDevice::FillPath(IFDE_Brush* pBrush, 336 FX_BOOL CFDE_FxgeDevice::FillPath(CFDE_Brush* pBrush,
372 const IFDE_Path* pPath, 337 const IFDE_Path* pPath,
373 const CFX_Matrix* pMatrix) { 338 const CFX_Matrix* pMatrix) {
374 CFDE_Path* pGePath = (CFDE_Path*)pPath; 339 CFDE_Path* pGePath = (CFDE_Path*)pPath;
375 if (!pGePath) 340 if (!pGePath)
376 return FALSE; 341 return FALSE;
377
378 if (!pBrush) 342 if (!pBrush)
379 return FALSE; 343 return FALSE;
380 344 return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr,
381 return FillSolidPath(pBrush, &pGePath->m_Path, pMatrix); 345 pBrush->GetColor(), 0, FXFILL_WINDING);
382 } 346 }
383 347
384 FX_BOOL CFDE_FxgeDevice::FillSolidPath(IFDE_Brush* pBrush,
385 const CFX_PathData* pPath,
386 const CFX_Matrix* pMatrix) {
387 FXSYS_assert(pPath && pBrush && pBrush->GetType() == FDE_BRUSHTYPE_Solid);
388
389 IFDE_SolidBrush* pSolidBrush = static_cast<IFDE_SolidBrush*>(pBrush);
390 return m_pDevice->DrawPath(pPath, (const CFX_Matrix*)pMatrix, NULL,
391 pSolidBrush->GetColor(), 0, FXFILL_WINDING);
392 }
OLDNEW
« no previous file with comments | « xfa/fde/fde_gedevice.h ('k') | xfa/fde/fde_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698