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

Side by Side Diff: core/src/reflow/reflowedpage.cpp

Issue 1177483002: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 6 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/src/reflow/reflowedpage.h ('k') | core/src/reflow/reflowedtextpage.h » ('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 "../../include/reflow/reflowengine.h" 7 #include "../../include/reflow/reflowengine.h"
8 #include "reflowedpage.h" 8 #include "reflowedpage.h"
9 CPDF_ProgressiveReflowPageParser::CPDF_ProgressiveReflowPageParser() 9 CPDF_ProgressiveReflowPageParser::CPDF_ProgressiveReflowPageParser()
10 { 10 {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 if (FALSE == RetainPageObjsMemberShip()) { 142 if (FALSE == RetainPageObjsMemberShip()) {
143 return NULL; 143 return NULL;
144 } 144 }
145 CRF_PageInfo* pPageInfo = (CRF_PageInfo*)m_pPageInfos->GetValueAt(pObj); 145 CRF_PageInfo* pPageInfo = (CRF_PageInfo*)m_pPageInfos->GetValueAt(pObj);
146 if (NULL == pPageInfo) { 146 if (NULL == pPageInfo) {
147 return NULL; 147 return NULL;
148 } 148 }
149 return pPageInfo->GetFormDict(); 149 return pPageInfo->GetFormDict();
150 } 150 }
151 void CPDF_ReflowedPage::GetDisplayMatrix(CFX_AffineMatrix& matrix, FX_INT32 xPos , FX_INT32 yPos, FX_INT32 xSize, FX_INT32 ySize, FX_INT32 iRotate, const CFX_Aff ineMatrix* pPageMatrix) 151 void CPDF_ReflowedPage::GetDisplayMatrix(CFX_AffineMatrix& matrix, int32_t xPos, int32_t yPos, int32_t xSize, int32_t ySize, int32_t iRotate, const CFX_AffineMa trix* pPageMatrix)
152 { 152 {
153 CFX_AffineMatrix display_matrix; 153 CFX_AffineMatrix display_matrix;
154 if(m_PageHeight == 0) { 154 if(m_PageHeight == 0) {
155 matrix.Set(1, 0, 0, -1, 0, 0); 155 matrix.Set(1, 0, 0, -1, 0, 0);
156 return; 156 return;
157 } 157 }
158 FX_INT32 x0, y0, x1, y1, x2, y2; 158 int32_t x0, y0, x1, y1, x2, y2;
159 iRotate %= 4; 159 iRotate %= 4;
160 switch (iRotate) { 160 switch (iRotate) {
161 case 0: 161 case 0:
162 x0 = xPos; 162 x0 = xPos;
163 y0 = yPos; 163 y0 = yPos;
164 x1 = xPos; 164 x1 = xPos;
165 y1 = yPos + ySize; 165 y1 = yPos + ySize;
166 x2 = xPos + xSize; 166 x2 = xPos + xSize;
167 y2 = yPos; 167 y2 = yPos;
168 break; 168 break;
(...skipping 28 matching lines...) Expand all
197 FXSYS_Div((FX_FLOAT)(y1 - y0), m_PageHeight), 197 FXSYS_Div((FX_FLOAT)(y1 - y0), m_PageHeight),
198 (FX_FLOAT)(x0), (FX_FLOAT)(y0)); 198 (FX_FLOAT)(x0), (FX_FLOAT)(y0));
199 matrix.Set(1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f); 199 matrix.Set(1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f);
200 matrix.Concat(display_matrix); 200 matrix.Concat(display_matrix);
201 return; 201 return;
202 } 202 }
203 FX_FLOAT CPDF_ReflowedPage::GetPageHeight() 203 FX_FLOAT CPDF_ReflowedPage::GetPageHeight()
204 { 204 {
205 return m_PageHeight; 205 return m_PageHeight;
206 } 206 }
207 void CPDF_ReflowedPage::FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x, FX_INT32 y, CFX_ByteString& str) 207 void CPDF_ReflowedPage::FocusGetData(const CFX_AffineMatrix matrix, int32_t x, i nt32_t y, CFX_ByteString& str)
208 { 208 {
209 if (NULL == m_pReflowed) { 209 if (NULL == m_pReflowed) {
210 return; 210 return;
211 } 211 }
212 CFX_AffineMatrix revMatrix; 212 CFX_AffineMatrix revMatrix;
213 revMatrix.SetReverse(matrix); 213 revMatrix.SetReverse(matrix);
214 FX_FLOAT x1, y1; 214 FX_FLOAT x1, y1;
215 revMatrix.Transform((float)x, (float)y, x1, y1); 215 revMatrix.Transform((float)x, (float)y, x1, y1);
216 int count = m_pReflowed->GetSize(); 216 int count = m_pReflowed->GetSize();
217 FX_FLOAT dx = 1000, dy = 1000; 217 FX_FLOAT dx = 1000, dy = 1000;
218 FX_INT32 pos = 0; 218 int32_t pos = 0;
219 FX_INT32 i; 219 int32_t i;
220 for(i = 0; i < count; i++) { 220 for(i = 0; i < count; i++) {
221 CRF_Data* pData = (*m_pReflowed)[i]; 221 CRF_Data* pData = (*m_pReflowed)[i];
222 FX_FLOAT tempdy = FXSYS_fabs(pData->m_PosY - y1); 222 FX_FLOAT tempdy = FXSYS_fabs(pData->m_PosY - y1);
223 if(FXSYS_fabs(tempdy - dy) < 1) { 223 if(FXSYS_fabs(tempdy - dy) < 1) {
224 continue; 224 continue;
225 } 225 }
226 CFX_FloatRect rect (0, pData->m_PosY + pData->m_Height, this->m_PageWidt h, pData->m_PosY); 226 CFX_FloatRect rect (0, pData->m_PosY + pData->m_Height, this->m_PageWidt h, pData->m_PosY);
227 if(rect.Contains(x1, y1)) { 227 if(rect.Contains(x1, y1)) {
228 pos = i; 228 pos = i;
229 dx = 0; 229 dx = 0;
(...skipping 26 matching lines...) Expand all
256 FX_FLOAT tempdx = FXSYS_fabs(pData->m_PosX - x1); 256 FX_FLOAT tempdx = FXSYS_fabs(pData->m_PosX - x1);
257 if(tempdx < dx) { 257 if(tempdx < dx) {
258 dx = tempdx; 258 dx = tempdx;
259 pos = i; 259 pos = i;
260 } 260 }
261 } 261 }
262 } 262 }
263 } 263 }
264 str.Format("%d", pos); 264 str.Format("%d", pos);
265 } 265 }
266 FX_BOOL CPDF_ReflowedPage::FocusGetPosition(const CFX_AffineMatrix matrix, CFX_B yteString str, FX_INT32& x, FX_INT32& y) 266 FX_BOOL CPDF_ReflowedPage::FocusGetPosition(const CFX_AffineMatrix matrix, CFX_B yteString str, int32_t& x, int32_t& y)
267 { 267 {
268 if (NULL == m_pReflowed) { 268 if (NULL == m_pReflowed) {
269 return FALSE; 269 return FALSE;
270 } 270 }
271 FX_INT32 pos = FXSYS_atoi(str); 271 int32_t pos = FXSYS_atoi(str);
272 if(pos < 0 || pos >= m_pReflowed->GetSize()) { 272 if(pos < 0 || pos >= m_pReflowed->GetSize()) {
273 return FALSE; 273 return FALSE;
274 } 274 }
275 CRF_Data* pData = (*m_pReflowed)[pos]; 275 CRF_Data* pData = (*m_pReflowed)[pos];
276 FX_FLOAT x1, y1; 276 FX_FLOAT x1, y1;
277 matrix.Transform(pData->m_PosX, pData->m_PosY + pData->m_Height, x1, y1); 277 matrix.Transform(pData->m_PosX, pData->m_PosY + pData->m_Height, x1, y1);
278 x = (int)x1; 278 x = (int)x1;
279 y = (int)y1; 279 y = (int)y1;
280 return TRUE; 280 return TRUE;
281 } 281 }
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 } 416 }
417 CPDF_ProgressiveReflowPageRender::CPDF_ProgressiveReflowPageRender() 417 CPDF_ProgressiveReflowPageRender::CPDF_ProgressiveReflowPageRender()
418 { 418 {
419 m_Status = Ready; 419 m_Status = Ready;
420 m_pReflowPage = NULL; 420 m_pReflowPage = NULL;
421 m_pDisplayMatrix = NULL; 421 m_pDisplayMatrix = NULL;
422 m_CurrNum = 0; 422 m_CurrNum = 0;
423 m_pFontEncoding = NULL; 423 m_pFontEncoding = NULL;
424 m_DisplayColor = -1; 424 m_DisplayColor = -1;
425 } 425 }
426 static FX_FLOAT _CIDTransformToFloat(FX_BYTE ch) 426 static FX_FLOAT _CIDTransformToFloat(uint8_t ch)
427 { 427 {
428 if (ch < 128) { 428 if (ch < 128) {
429 return ch * 1.0f / 127; 429 return ch * 1.0f / 127;
430 } 430 }
431 return (-255 + ch) * 1.0f / 127; 431 return (-255 + ch) * 1.0f / 127;
432 } 432 }
433 int CPDF_ProgressiveReflowPageRender::GetPosition() 433 int CPDF_ProgressiveReflowPageRender::GetPosition()
434 { 434 {
435 if(m_CurrNum == 0 || NULL == m_pReflowPage) { 435 if(m_CurrNum == 0 || NULL == m_pReflowPage) {
436 return 0; 436 return 0;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 { 608 {
609 if (m_pDisplayMatrix) { 609 if (m_pDisplayMatrix) {
610 delete m_pDisplayMatrix; 610 delete m_pDisplayMatrix;
611 } 611 }
612 m_pDisplayMatrix = NULL; 612 m_pDisplayMatrix = NULL;
613 m_pReflowPage = NULL; 613 m_pReflowPage = NULL;
614 m_pFXDevice = NULL; 614 m_pFXDevice = NULL;
615 m_CurrNum = 0; 615 m_CurrNum = 0;
616 m_Status = Ready; 616 m_Status = Ready;
617 } 617 }
OLDNEW
« no previous file with comments | « core/src/reflow/reflowedpage.h ('k') | core/src/reflow/reflowedtextpage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698