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

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

Issue 2301263003: Make CPDF_ClipPath have a CPDF_ClipPathData rather than inheriting (Closed)
Patch Set: safe bool while we're at it Created 4 years, 3 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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 "core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h" 7 #include "core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h"
8 8
9 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" 9 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h"
10 #include "core/fpdfapi/fpdf_page/pageint.h" 10 #include "core/fpdfapi/fpdf_page/pageint.h"
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 obj->m_Matrix = m_Matrix; 29 obj->m_Matrix = m_Matrix;
30 return obj; 30 return obj;
31 } 31 }
32 32
33 CPDF_PageObject::Type CPDF_ShadingObject::GetType() const { 33 CPDF_PageObject::Type CPDF_ShadingObject::GetType() const {
34 return SHADING; 34 return SHADING;
35 } 35 }
36 36
37 void CPDF_ShadingObject::Transform(const CFX_Matrix& matrix) { 37 void CPDF_ShadingObject::Transform(const CFX_Matrix& matrix) {
38 if (m_ClipPath) { 38 if (m_ClipPath)
39 m_ClipPath.GetPrivateCopy();
40 m_ClipPath.Transform(matrix); 39 m_ClipPath.Transform(matrix);
41 } 40
42 m_Matrix.Concat(matrix); 41 m_Matrix.Concat(matrix);
43 if (m_ClipPath) { 42 if (m_ClipPath) {
44 CalcBoundingBox(); 43 CalcBoundingBox();
45 } else { 44 } else {
46 matrix.TransformRect(m_Left, m_Right, m_Top, m_Bottom); 45 matrix.TransformRect(m_Left, m_Right, m_Top, m_Bottom);
47 } 46 }
48 } 47 }
49 48
50 bool CPDF_ShadingObject::IsShading() const { 49 bool CPDF_ShadingObject::IsShading() const {
51 return true; 50 return true;
52 } 51 }
53 52
54 CPDF_ShadingObject* CPDF_ShadingObject::AsShading() { 53 CPDF_ShadingObject* CPDF_ShadingObject::AsShading() {
55 return this; 54 return this;
56 } 55 }
57 56
58 const CPDF_ShadingObject* CPDF_ShadingObject::AsShading() const { 57 const CPDF_ShadingObject* CPDF_ShadingObject::AsShading() const {
59 return this; 58 return this;
60 } 59 }
61 60
62 void CPDF_ShadingObject::CalcBoundingBox() { 61 void CPDF_ShadingObject::CalcBoundingBox() {
63 if (!m_ClipPath) 62 if (!m_ClipPath)
64 return; 63 return;
65 CFX_FloatRect rect = m_ClipPath.GetClipBox(); 64 CFX_FloatRect rect = m_ClipPath.GetClipBox();
66 m_Left = rect.left; 65 m_Left = rect.left;
67 m_Bottom = rect.bottom; 66 m_Bottom = rect.bottom;
68 m_Right = rect.right; 67 m_Right = rect.right;
69 m_Top = rect.top; 68 m_Top = rect.top;
70 } 69 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_pageobject.cpp ('k') | core/fpdfapi/fpdf_page/include/cpdf_clippath.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698