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

Side by Side Diff: fpdfsdk/src/pdfwindow/PWL_Icon.cpp

Issue 1737593006: Re-land "Replace CPDF_Rect and CPDF_Point with CFX types." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Ooops. 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 | « fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_IconList.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 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 "fpdfsdk/include/pdfwindow/PWL_Icon.h" 7 #include "fpdfsdk/include/pdfwindow/PWL_Icon.h"
8 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" 8 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
9 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" 9 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
10 10
11 CPWL_Image::CPWL_Image() : m_pPDFStream(NULL) {} 11 CPWL_Image::CPWL_Image() : m_pPDFStream(NULL) {}
12 12
13 CPWL_Image::~CPWL_Image() {} 13 CPWL_Image::~CPWL_Image() {}
14 14
15 CFX_ByteString CPWL_Image::GetImageAppStream() { 15 CFX_ByteString CPWL_Image::GetImageAppStream() {
16 CFX_ByteTextBuf sAppStream; 16 CFX_ByteTextBuf sAppStream;
17 17
18 CFX_ByteString sAlias = GetImageAlias(); 18 CFX_ByteString sAlias = GetImageAlias();
19 CPDF_Rect rcPlate = GetClientRect(); 19 CFX_FloatRect rcPlate = GetClientRect();
20 CFX_Matrix mt; 20 CFX_Matrix mt;
21 mt.SetReverse(GetImageMatrix()); 21 mt.SetReverse(GetImageMatrix());
22 22
23 FX_FLOAT fHScale = 1.0f; 23 FX_FLOAT fHScale = 1.0f;
24 FX_FLOAT fVScale = 1.0f; 24 FX_FLOAT fVScale = 1.0f;
25 GetScale(fHScale, fVScale); 25 GetScale(fHScale, fVScale);
26 26
27 FX_FLOAT fx = 0.0f; 27 FX_FLOAT fx = 0.0f;
28 FX_FLOAT fy = 0.0f; 28 FX_FLOAT fy = 0.0f;
29 GetImageOffset(fx, fy); 29 GetImageOffset(fx, fy);
(...skipping 23 matching lines...) Expand all
53 CPDF_Stream* CPWL_Image::GetPDFStream() { 53 CPDF_Stream* CPWL_Image::GetPDFStream() {
54 return m_pPDFStream; 54 return m_pPDFStream;
55 } 55 }
56 56
57 void CPWL_Image::GetImageSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight) { 57 void CPWL_Image::GetImageSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight) {
58 fWidth = 0.0f; 58 fWidth = 0.0f;
59 fHeight = 0.0f; 59 fHeight = 0.0f;
60 60
61 if (m_pPDFStream) { 61 if (m_pPDFStream) {
62 if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) { 62 if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) {
63 CPDF_Rect rect = pDict->GetRectBy("BBox"); 63 CFX_FloatRect rect = pDict->GetRectBy("BBox");
64 64
65 fWidth = rect.right - rect.left; 65 fWidth = rect.right - rect.left;
66 fHeight = rect.top - rect.bottom; 66 fHeight = rect.top - rect.bottom;
67 } 67 }
68 } 68 }
69 } 69 }
70 70
71 CFX_Matrix CPWL_Image::GetImageMatrix() { 71 CFX_Matrix CPWL_Image::GetImageMatrix() {
72 if (m_pPDFStream) { 72 if (m_pPDFStream) {
73 if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) { 73 if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 150 }
151 151
152 void CPWL_Icon::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) { 152 void CPWL_Icon::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) {
153 fHScale = 1.0f; 153 fHScale = 1.0f;
154 fVScale = 1.0f; 154 fVScale = 1.0f;
155 155
156 if (m_pPDFStream) { 156 if (m_pPDFStream) {
157 FX_FLOAT fImageWidth, fImageHeight; 157 FX_FLOAT fImageWidth, fImageHeight;
158 FX_FLOAT fPlateWidth, fPlateHeight; 158 FX_FLOAT fPlateWidth, fPlateHeight;
159 159
160 CPDF_Rect rcPlate = GetClientRect(); 160 CFX_FloatRect rcPlate = GetClientRect();
161 fPlateWidth = rcPlate.right - rcPlate.left; 161 fPlateWidth = rcPlate.right - rcPlate.left;
162 fPlateHeight = rcPlate.top - rcPlate.bottom; 162 fPlateHeight = rcPlate.top - rcPlate.bottom;
163 163
164 GetImageSize(fImageWidth, fImageHeight); 164 GetImageSize(fImageWidth, fImageHeight);
165 165
166 int32_t nScaleMethod = GetScaleMethod(); 166 int32_t nScaleMethod = GetScaleMethod();
167 167
168 switch (nScaleMethod) { 168 switch (nScaleMethod) {
169 default: 169 default:
170 case 0: 170 case 0:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 FX_FLOAT fImageWidth, fImageHeight; 206 FX_FLOAT fImageWidth, fImageHeight;
207 GetImageSize(fImageWidth, fImageHeight); 207 GetImageSize(fImageWidth, fImageHeight);
208 208
209 FX_FLOAT fHScale, fVScale; 209 FX_FLOAT fHScale, fVScale;
210 GetScale(fHScale, fVScale); 210 GetScale(fHScale, fVScale);
211 211
212 FX_FLOAT fImageFactWidth = fImageWidth * fHScale; 212 FX_FLOAT fImageFactWidth = fImageWidth * fHScale;
213 FX_FLOAT fImageFactHeight = fImageHeight * fVScale; 213 FX_FLOAT fImageFactHeight = fImageHeight * fVScale;
214 214
215 FX_FLOAT fPlateWidth, fPlateHeight; 215 FX_FLOAT fPlateWidth, fPlateHeight;
216 CPDF_Rect rcPlate = GetClientRect(); 216 CFX_FloatRect rcPlate = GetClientRect();
217 fPlateWidth = rcPlate.right - rcPlate.left; 217 fPlateWidth = rcPlate.right - rcPlate.left;
218 fPlateHeight = rcPlate.top - rcPlate.bottom; 218 fPlateHeight = rcPlate.top - rcPlate.bottom;
219 219
220 x = (fPlateWidth - fImageFactWidth) * fLeft; 220 x = (fPlateWidth - fImageFactWidth) * fLeft;
221 y = (fPlateHeight - fImageFactHeight) * fBottom; 221 y = (fPlateHeight - fImageFactHeight) * fBottom;
222 } 222 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_IconList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698