| 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 #include <memory> | 10 #include <memory> |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 return true; | 191 return true; |
| 192 } | 192 } |
| 193 | 193 |
| 194 bool CFDE_RenderDevice::DrawBezier(CFDE_Pen* pPen, | 194 bool CFDE_RenderDevice::DrawBezier(CFDE_Pen* pPen, |
| 195 FX_FLOAT fPenWidth, | 195 FX_FLOAT fPenWidth, |
| 196 const CFX_PointF& pt1, | 196 const CFX_PointF& pt1, |
| 197 const CFX_PointF& pt2, | 197 const CFX_PointF& pt2, |
| 198 const CFX_PointF& pt3, | 198 const CFX_PointF& pt3, |
| 199 const CFX_PointF& pt4, | 199 const CFX_PointF& pt4, |
| 200 const CFX_Matrix* pMatrix) { | 200 const CFX_Matrix* pMatrix) { |
| 201 CFX_PointsF points; | 201 std::vector<CFX_PointF> points; |
| 202 points.Add(pt1); | 202 points.push_back(pt1); |
| 203 points.Add(pt2); | 203 points.push_back(pt2); |
| 204 points.Add(pt3); | 204 points.push_back(pt3); |
| 205 points.Add(pt4); | 205 points.push_back(pt4); |
| 206 CFDE_Path path; | 206 CFDE_Path path; |
| 207 path.AddBezier(points); | 207 path.AddBezier(points); |
| 208 return DrawPath(pPen, fPenWidth, &path, pMatrix); | 208 return DrawPath(pPen, fPenWidth, &path, pMatrix); |
| 209 } | 209 } |
| 210 bool CFDE_RenderDevice::DrawCurve(CFDE_Pen* pPen, | 210 bool CFDE_RenderDevice::DrawCurve(CFDE_Pen* pPen, |
| 211 FX_FLOAT fPenWidth, | 211 FX_FLOAT fPenWidth, |
| 212 const CFX_PointsF& points, | 212 const std::vector<CFX_PointF>& points, |
| 213 bool bClosed, | 213 bool bClosed, |
| 214 FX_FLOAT fTension, | 214 FX_FLOAT fTension, |
| 215 const CFX_Matrix* pMatrix) { | 215 const CFX_Matrix* pMatrix) { |
| 216 CFDE_Path path; | 216 CFDE_Path path; |
| 217 path.AddCurve(points, bClosed, fTension); | 217 path.AddCurve(points, bClosed, fTension); |
| 218 return DrawPath(pPen, fPenWidth, &path, pMatrix); | 218 return DrawPath(pPen, fPenWidth, &path, pMatrix); |
| 219 } | 219 } |
| 220 bool CFDE_RenderDevice::DrawEllipse(CFDE_Pen* pPen, | 220 bool CFDE_RenderDevice::DrawEllipse(CFDE_Pen* pPen, |
| 221 FX_FLOAT fPenWidth, | 221 FX_FLOAT fPenWidth, |
| 222 const CFX_RectF& rect, | 222 const CFX_RectF& rect, |
| 223 const CFX_Matrix* pMatrix) { | 223 const CFX_Matrix* pMatrix) { |
| 224 CFDE_Path path; | 224 CFDE_Path path; |
| 225 path.AddEllipse(rect); | 225 path.AddEllipse(rect); |
| 226 return DrawPath(pPen, fPenWidth, &path, pMatrix); | 226 return DrawPath(pPen, fPenWidth, &path, pMatrix); |
| 227 } | 227 } |
| 228 bool CFDE_RenderDevice::DrawLines(CFDE_Pen* pPen, | 228 bool CFDE_RenderDevice::DrawLines(CFDE_Pen* pPen, |
| 229 FX_FLOAT fPenWidth, | 229 FX_FLOAT fPenWidth, |
| 230 const CFX_PointsF& points, | 230 const std::vector<CFX_PointF>& points, |
| 231 const CFX_Matrix* pMatrix) { | 231 const CFX_Matrix* pMatrix) { |
| 232 CFDE_Path path; | 232 CFDE_Path path; |
| 233 path.AddLines(points); | 233 path.AddLines(points); |
| 234 return DrawPath(pPen, fPenWidth, &path, pMatrix); | 234 return DrawPath(pPen, fPenWidth, &path, pMatrix); |
| 235 } | 235 } |
| 236 bool CFDE_RenderDevice::DrawLine(CFDE_Pen* pPen, | 236 bool CFDE_RenderDevice::DrawLine(CFDE_Pen* pPen, |
| 237 FX_FLOAT fPenWidth, | 237 FX_FLOAT fPenWidth, |
| 238 const CFX_PointF& pt1, | 238 const CFX_PointF& pt1, |
| 239 const CFX_PointF& pt2, | 239 const CFX_PointF& pt2, |
| 240 const CFX_Matrix* pMatrix) { | 240 const CFX_Matrix* pMatrix) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 252 | 252 |
| 253 CFX_GraphStateData graphState; | 253 CFX_GraphStateData graphState; |
| 254 if (!CreatePen(pPen, fPenWidth, graphState)) { | 254 if (!CreatePen(pPen, fPenWidth, graphState)) { |
| 255 return false; | 255 return false; |
| 256 } | 256 } |
| 257 return m_pDevice->DrawPath(&pGePath->m_Path, (const CFX_Matrix*)pMatrix, | 257 return m_pDevice->DrawPath(&pGePath->m_Path, (const CFX_Matrix*)pMatrix, |
| 258 &graphState, 0, pPen->GetColor(), 0); | 258 &graphState, 0, pPen->GetColor(), 0); |
| 259 } | 259 } |
| 260 bool CFDE_RenderDevice::DrawPolygon(CFDE_Pen* pPen, | 260 bool CFDE_RenderDevice::DrawPolygon(CFDE_Pen* pPen, |
| 261 FX_FLOAT fPenWidth, | 261 FX_FLOAT fPenWidth, |
| 262 const CFX_PointsF& points, | 262 const std::vector<CFX_PointF>& points, |
| 263 const CFX_Matrix* pMatrix) { | 263 const CFX_Matrix* pMatrix) { |
| 264 CFDE_Path path; | 264 CFDE_Path path; |
| 265 path.AddPolygon(points); | 265 path.AddPolygon(points); |
| 266 return DrawPath(pPen, fPenWidth, &path, pMatrix); | 266 return DrawPath(pPen, fPenWidth, &path, pMatrix); |
| 267 } | 267 } |
| 268 bool CFDE_RenderDevice::DrawRectangle(CFDE_Pen* pPen, | 268 bool CFDE_RenderDevice::DrawRectangle(CFDE_Pen* pPen, |
| 269 FX_FLOAT fPenWidth, | 269 FX_FLOAT fPenWidth, |
| 270 const CFX_RectF& rect, | 270 const CFX_RectF& rect, |
| 271 const CFX_Matrix* pMatrix) { | 271 const CFX_Matrix* pMatrix) { |
| 272 CFDE_Path path; | 272 CFDE_Path path; |
| 273 path.AddRectangle(rect); | 273 path.AddRectangle(rect); |
| 274 return DrawPath(pPen, fPenWidth, &path, pMatrix); | 274 return DrawPath(pPen, fPenWidth, &path, pMatrix); |
| 275 } | 275 } |
| 276 bool CFDE_RenderDevice::FillClosedCurve(CFDE_Brush* pBrush, | 276 bool CFDE_RenderDevice::FillClosedCurve(CFDE_Brush* pBrush, |
| 277 const CFX_PointsF& points, | 277 const std::vector<CFX_PointF>& points, |
| 278 FX_FLOAT fTension, | 278 FX_FLOAT fTension, |
| 279 const CFX_Matrix* pMatrix) { | 279 const CFX_Matrix* pMatrix) { |
| 280 CFDE_Path path; | 280 CFDE_Path path; |
| 281 path.AddCurve(points, true, fTension); | 281 path.AddCurve(points, true, fTension); |
| 282 return FillPath(pBrush, &path, pMatrix); | 282 return FillPath(pBrush, &path, pMatrix); |
| 283 } | 283 } |
| 284 bool CFDE_RenderDevice::FillEllipse(CFDE_Brush* pBrush, | 284 bool CFDE_RenderDevice::FillEllipse(CFDE_Brush* pBrush, |
| 285 const CFX_RectF& rect, | 285 const CFX_RectF& rect, |
| 286 const CFX_Matrix* pMatrix) { | 286 const CFX_Matrix* pMatrix) { |
| 287 CFDE_Path path; | 287 CFDE_Path path; |
| 288 path.AddEllipse(rect); | 288 path.AddEllipse(rect); |
| 289 return FillPath(pBrush, &path, pMatrix); | 289 return FillPath(pBrush, &path, pMatrix); |
| 290 } | 290 } |
| 291 bool CFDE_RenderDevice::FillPolygon(CFDE_Brush* pBrush, | 291 bool CFDE_RenderDevice::FillPolygon(CFDE_Brush* pBrush, |
| 292 const CFX_PointsF& points, | 292 const std::vector<CFX_PointF>& points, |
| 293 const CFX_Matrix* pMatrix) { | 293 const CFX_Matrix* pMatrix) { |
| 294 CFDE_Path path; | 294 CFDE_Path path; |
| 295 path.AddPolygon(points); | 295 path.AddPolygon(points); |
| 296 return FillPath(pBrush, &path, pMatrix); | 296 return FillPath(pBrush, &path, pMatrix); |
| 297 } | 297 } |
| 298 bool CFDE_RenderDevice::FillRectangle(CFDE_Brush* pBrush, | 298 bool CFDE_RenderDevice::FillRectangle(CFDE_Brush* pBrush, |
| 299 const CFX_RectF& rect, | 299 const CFX_RectF& rect, |
| 300 const CFX_Matrix* pMatrix) { | 300 const CFX_Matrix* pMatrix) { |
| 301 CFDE_Path path; | 301 CFDE_Path path; |
| 302 path.AddRectangle(rect); | 302 path.AddRectangle(rect); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 321 const CFX_Matrix* pMatrix) { | 321 const CFX_Matrix* pMatrix) { |
| 322 CFDE_Path* pGePath = (CFDE_Path*)pPath; | 322 CFDE_Path* pGePath = (CFDE_Path*)pPath; |
| 323 if (!pGePath) | 323 if (!pGePath) |
| 324 return false; | 324 return false; |
| 325 if (!pBrush) | 325 if (!pBrush) |
| 326 return false; | 326 return false; |
| 327 return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr, | 327 return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr, |
| 328 pBrush->GetColor(), 0, FXFILL_WINDING); | 328 pBrush->GetColor(), 0, FXFILL_WINDING); |
| 329 } | 329 } |
| 330 | 330 |
| OLD | NEW |