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

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

Issue 2291833002: Revert "Replace wrapper methods in CPDF_Path with -> operator." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_textstate.cpp ('k') | core/fpdfapi/fpdf_page/fpdf_page_parser.cpp » ('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 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_textstatedata.h" 7 #include "core/fpdfapi/fpdf_page/include/cpdf_textstatedata.h"
8 8
9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
10 #include "core/fpdfapi/fpdf_page/pageint.h" 10 #include "core/fpdfapi/fpdf_page/pageint.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 } 66 }
67 67
68 CPDF_TextStateData::~CPDF_TextStateData() { 68 CPDF_TextStateData::~CPDF_TextStateData() {
69 if (m_pDocument && m_pFont) { 69 if (m_pDocument && m_pFont) {
70 CPDF_DocPageData* pPageData = m_pDocument->GetPageData(); 70 CPDF_DocPageData* pPageData = m_pDocument->GetPageData();
71 if (pPageData && !pPageData->IsForceClear()) 71 if (pPageData && !pPageData->IsForceClear())
72 pPageData->ReleaseFont(m_pFont->GetFontDict()); 72 pPageData->ReleaseFont(m_pFont->GetFontDict());
73 } 73 }
74 } 74 }
75
76 void CPDF_TextStateData::SetFont(CPDF_Font* pFont) {
77 CPDF_DocPageData* pPageData =
78 m_pDocument ? m_pDocument->GetPageData() : nullptr;
79 if (pPageData && m_pFont && !pPageData->IsForceClear())
80 pPageData->ReleaseFont(m_pFont->GetFontDict());
81
82 m_pDocument = pFont ? pFont->m_pDocument : nullptr;
83 m_pFont = pFont;
84 }
85
86 FX_FLOAT CPDF_TextStateData::GetFontSizeV() const {
87 const FX_FLOAT* pMatrix = GetMatrix();
88 FX_FLOAT unit = FXSYS_sqrt2(pMatrix[1], pMatrix[3]);
89 FX_FLOAT size = unit * GetFontSize();
90 return (FX_FLOAT)FXSYS_fabs(size);
91 }
92
93 FX_FLOAT CPDF_TextStateData::GetFontSizeH() const {
94 const FX_FLOAT* pMatrix = GetMatrix();
95 FX_FLOAT unit = FXSYS_sqrt2(pMatrix[0], pMatrix[2]);
96 FX_FLOAT size = unit * GetFontSize();
97 return (FX_FLOAT)FXSYS_fabs(size);
98 }
99
100 FX_FLOAT CPDF_TextStateData::GetBaselineAngle() const {
101 const FX_FLOAT* pMatrix = GetMatrix();
102 return FXSYS_atan2(pMatrix[2], pMatrix[0]);
103 }
104
105 FX_FLOAT CPDF_TextStateData::GetShearAngle() const {
106 const FX_FLOAT* pMatrix = GetMatrix();
107 FX_FLOAT shear_angle = FXSYS_atan2(pMatrix[1], pMatrix[3]);
108 return GetBaselineAngle() + shear_angle;
109 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_textstate.cpp ('k') | core/fpdfapi/fpdf_page/fpdf_page_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698