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

Side by Side Diff: core/fpdfapi/fpdf_page/fpdf_page_path.cpp

Issue 1811053002: Move core/include/fpdfapi/fpdf_pageobj.h into core/fpdfapi. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #include "core/fpdfapi/fpdf_page/pageint.h"
8
9 #include "core/include/fpdfapi/fpdf_pageobj.h"
10
11 CPDF_PathObject::CPDF_PathObject() {}
12
13 CPDF_PathObject::~CPDF_PathObject() {}
14
15 CPDF_PathObject* CPDF_PathObject::Clone() const {
16 CPDF_PathObject* obj = new CPDF_PathObject;
17 obj->CopyData(this);
18
19 obj->m_Path = m_Path;
20 obj->m_FillType = m_FillType;
21 obj->m_bStroke = m_bStroke;
22 obj->m_Matrix = m_Matrix;
23 return obj;
24 }
25
26 void CPDF_PathObject::Transform(const CFX_Matrix& matrix) {
27 m_Matrix.Concat(matrix);
28 CalcBoundingBox();
29 }
30
31 void CPDF_PathObject::CalcBoundingBox() {
32 if (m_Path.IsNull()) {
33 return;
34 }
35 CFX_FloatRect rect;
36 FX_FLOAT width = m_GraphState.GetObject()->m_LineWidth;
37 if (m_bStroke && width != 0) {
38 rect = m_Path.GetBoundingBox(width, m_GraphState.GetObject()->m_MiterLimit);
39 } else {
40 rect = m_Path.GetBoundingBox();
41 }
42 rect.Transform(&m_Matrix);
43 if (width == 0 && m_bStroke) {
44 rect.left += -0.5f;
45 rect.right += 0.5f;
46 rect.bottom += -0.5f;
47 rect.top += 0.5f;
48 }
49 m_Left = rect.left;
50 m_Right = rect.right;
51 m_Top = rect.top;
52 m_Bottom = rect.bottom;
53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698