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

Side by Side Diff: core/fpdfapi/fpdf_page/cpdf_shadingobject.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
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_pathobject.cpp ('k') | core/fpdfapi/fpdf_page/cpdf_textobject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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/include/cpdf_shadingobject.h"
8
9 #include "core/fpdfapi/fpdf_page/pageint.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
11
12 CPDF_ShadingObject::CPDF_ShadingObject() : m_pShading(nullptr) {}
13
14 CPDF_ShadingObject::~CPDF_ShadingObject() {}
15
16 CPDF_ShadingObject* CPDF_ShadingObject::Clone() const {
17 CPDF_ShadingObject* obj = new CPDF_ShadingObject;
18 obj->CopyData(this);
19
20 obj->m_pShading = m_pShading;
21 if (obj->m_pShading && obj->m_pShading->m_pDocument) {
22 CPDF_DocPageData* pDocPageData =
23 obj->m_pShading->m_pDocument->GetPageData();
24 obj->m_pShading = (CPDF_ShadingPattern*)pDocPageData->GetPattern(
25 obj->m_pShading->m_pShadingObj, m_pShading->m_bShadingObj,
26 &obj->m_pShading->m_ParentMatrix);
27 }
28 obj->m_Matrix = m_Matrix;
29 return obj;
30 }
31
32 void CPDF_ShadingObject::Transform(const CFX_Matrix& matrix) {
33 if (!m_ClipPath.IsNull()) {
34 m_ClipPath.GetModify();
35 m_ClipPath.Transform(matrix);
36 }
37 m_Matrix.Concat(matrix);
38 if (!m_ClipPath.IsNull()) {
39 CalcBoundingBox();
40 } else {
41 matrix.TransformRect(m_Left, m_Right, m_Top, m_Bottom);
42 }
43 }
44
45 void CPDF_ShadingObject::CalcBoundingBox() {
46 if (m_ClipPath.IsNull()) {
47 return;
48 }
49 CFX_FloatRect rect = m_ClipPath.GetClipBox();
50 m_Left = rect.left;
51 m_Bottom = rect.bottom;
52 m_Right = rect.right;
53 m_Top = rect.top;
54 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_pathobject.cpp ('k') | core/fpdfapi/fpdf_page/cpdf_textobject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698