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

Side by Side Diff: fpdfsdk/src/fpdfview.cpp

Issue 1089823004: Replace FX_NEW with new, remove tests from fpdfsdk (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebased Created 5 years, 8 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/fpdfformfill.cpp ('k') | fpdfsdk/src/fsdk_baseannot.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 "../include/fsdk_define.h" 7 #include "../include/fsdk_define.h"
8 #include "../include/fsdk_mgr.h" 8 #include "../include/fsdk_mgr.h"
9 #include "../include/fpdfview.h" 9 #include "../include/fpdfview.h"
10 #include "../include/fsdk_rendercontext.h" 10 #include "../include/fsdk_rendercontext.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 SetLastError(err_code); 177 SetLastError(err_code);
178 } 178 }
179 179
180 DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enabl e) 180 DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enabl e)
181 { 181 {
182 return FSDK_SetSandBoxPolicy(policy, enable); 182 return FSDK_SetSandBoxPolicy(policy, enable);
183 } 183 }
184 184
185 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, FPDF_BY TESTRING password) 185 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, FPDF_BY TESTRING password)
186 { 186 {
187 » CPDF_Parser* pParser = FX_NEW CPDF_Parser; 187 » CPDF_Parser* pParser = new CPDF_Parser;
188 pParser->SetPassword(password); 188 pParser->SetPassword(password);
189 189
190 FX_DWORD err_code = pParser->StartParse((FX_LPCSTR)file_path); 190 FX_DWORD err_code = pParser->StartParse((FX_LPCSTR)file_path);
191 if (err_code) { 191 if (err_code) {
192 delete pParser; 192 delete pParser;
193 ProcessParseError(err_code); 193 ProcessParseError(err_code);
194 return NULL; 194 return NULL;
195 } 195 }
196 return pParser->GetDocument(); 196 return pParser->GetDocument();
197 } 197 }
(...skipping 19 matching lines...) Expand all
217 } 217 }
218 FXSYS_memcpy(buffer, m_pBuf+offset, size); 218 FXSYS_memcpy(buffer, m_pBuf+offset, size);
219 return TRUE; 219 return TRUE;
220 } 220 }
221 private: 221 private:
222 FX_BYTE* m_pBuf; 222 FX_BYTE* m_pBuf;
223 FX_FILESIZE m_size; 223 FX_FILESIZE m_size;
224 }; 224 };
225 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, int s ize, FPDF_BYTESTRING password) 225 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, int s ize, FPDF_BYTESTRING password)
226 { 226 {
227 » CPDF_Parser* pParser = FX_NEW CPDF_Parser; 227 » CPDF_Parser* pParser = new CPDF_Parser;
228 pParser->SetPassword(password); 228 pParser->SetPassword(password);
229 » CMemFile* pMemFile = FX_NEW CMemFile((FX_BYTE*)data_buf, size); 229 » CMemFile* pMemFile = new CMemFile((FX_BYTE*)data_buf, size);
230 FX_DWORD err_code = pParser->StartParse(pMemFile); 230 FX_DWORD err_code = pParser->StartParse(pMemFile);
231 if (err_code) { 231 if (err_code) {
232 delete pParser; 232 delete pParser;
233 ProcessParseError(err_code); 233 ProcessParseError(err_code);
234 return NULL; 234 return NULL;
235 } 235 }
236 CPDF_Document * pDoc = NULL; 236 CPDF_Document * pDoc = NULL;
237 pDoc = pParser?pParser->GetDocument():NULL; 237 pDoc = pParser?pParser->GetDocument():NULL;
238 CheckUnSupportError(pDoc, err_code); 238 CheckUnSupportError(pDoc, err_code);
239 return pParser->GetDocument(); 239 return pParser->GetDocument();
240 } 240 }
241 241
242 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAc cess, FPDF_BYTESTRING password) 242 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAc cess, FPDF_BYTESTRING password)
243 { 243 {
244 » CPDF_Parser* pParser = FX_NEW CPDF_Parser; 244 » CPDF_Parser* pParser = new CPDF_Parser;
245 pParser->SetPassword(password); 245 pParser->SetPassword(password);
246 » CPDF_CustomAccess* pFile = FX_NEW CPDF_CustomAccess(pFileAccess); 246 » CPDF_CustomAccess* pFile = new CPDF_CustomAccess(pFileAccess);
247 FX_DWORD err_code = pParser->StartParse(pFile); 247 FX_DWORD err_code = pParser->StartParse(pFile);
248 if (err_code) { 248 if (err_code) {
249 delete pParser; 249 delete pParser;
250 ProcessParseError(err_code); 250 ProcessParseError(err_code);
251 return NULL; 251 return NULL;
252 } 252 }
253 CPDF_Document * pDoc = NULL; 253 CPDF_Document * pDoc = NULL;
254 pDoc = pParser?pParser->GetDocument():NULL; 254 pDoc = pParser?pParser->GetDocument():NULL;
255 CheckUnSupportError(pDoc, err_code); 255 CheckUnSupportError(pDoc, err_code);
256 return pParser->GetDocument(); 256 return pParser->GetDocument();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document) 294 DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document)
295 { 295 {
296 if (document == NULL) return 0; 296 if (document == NULL) return 0;
297 return ((CPDF_Document*)document)->GetPageCount(); 297 return ((CPDF_Document*)document)->GetPageCount();
298 } 298 }
299 299
300 DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, int page_index ) 300 DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, int page_index )
301 { 301 {
302 if (document == NULL) return NULL; 302 if (document == NULL) return NULL;
303 if (page_index < 0 || page_index >= FPDF_GetPageCount(document)) return NULL; 303 if (page_index < 0 || page_index >= FPDF_GetPageCount(document)) return NULL;
304 //» CPDF_Parser* pParser = (CPDF_Parser*)document; 304
305 CPDF_Document* pDoc = (CPDF_Document*)document; 305 CPDF_Document* pDoc = (CPDF_Document*)document;
306 if (pDoc == NULL) return NULL; 306 if (pDoc == NULL) return NULL;
307 CPDF_Dictionary* pDict = pDoc->GetPage(page_index); 307 CPDF_Dictionary* pDict = pDoc->GetPage(page_index);
308 if (pDict == NULL) return NULL; 308 if (pDict == NULL) return NULL;
309 » CPDF_Page* pPage = FX_NEW CPDF_Page; 309 » CPDF_Page* pPage = new CPDF_Page;
310 pPage->Load(pDoc, pDict); 310 pPage->Load(pDoc, pDict);
311 pPage->ParseContent(); 311 pPage->ParseContent();
312
313 // CheckUnSupportError(pDoc, 0);
314
315 return pPage; 312 return pPage;
316 } 313 }
317 314
318 DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page) 315 DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page)
319 { 316 {
320 if (!page) 317 if (!page)
321 return 0.0; 318 return 0.0;
322 return ((CPDF_Page*)page)->GetPageWidth(); 319 return ((CPDF_Page*)page)->GetPageWidth();
323 } 320 }
324 321
(...skipping 17 matching lines...) Expand all
342 #define DEBUG_TRACE 339 #define DEBUG_TRACE
343 #endif 340 #endif
344 341
345 #if defined(_WIN32) 342 #if defined(_WIN32)
346 DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, 343 DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
347 int rotate, int flags) 344 int rotate, int flags)
348 { 345 {
349 if (page==NULL) return; 346 if (page==NULL) return;
350 CPDF_Page* pPage = (CPDF_Page*)page; 347 CPDF_Page* pPage = (CPDF_Page*)page;
351 348
352 » CRenderContext* pContext = FX_NEW CRenderContext; 349 » CRenderContext* pContext = new CRenderContext;
353 pPage->SetPrivateData((void*)1, pContext, DropContext); 350 pPage->SetPrivateData((void*)1, pContext, DropContext);
354 351
355 #ifndef _WIN32_WCE 352 #ifndef _WIN32_WCE
356 CFX_DIBitmap* pBitmap = NULL; 353 CFX_DIBitmap* pBitmap = NULL;
357 FX_BOOL bBackgroundAlphaNeeded=FALSE; 354 FX_BOOL bBackgroundAlphaNeeded=FALSE;
358 bBackgroundAlphaNeeded = pPage->BackgroundAlphaNeeded(); 355 bBackgroundAlphaNeeded = pPage->BackgroundAlphaNeeded();
359 if (bBackgroundAlphaNeeded) 356 if (bBackgroundAlphaNeeded)
360 { 357 {
361 358
362 » » pBitmap = FX_NEW CFX_DIBitmap; 359 » » pBitmap = new CFX_DIBitmap;
363 pBitmap->Create(size_x, size_y, FXDIB_Argb); 360 pBitmap->Create(size_x, size_y, FXDIB_Argb);
364 pBitmap->Clear(0x00ffffff); 361 pBitmap->Clear(0x00ffffff);
365 #ifdef _SKIA_SUPPORT_ 362 #ifdef _SKIA_SUPPORT_
366 » » pContext->m_pDevice = FX_NEW CFX_SkiaDevice; 363 » » pContext->m_pDevice = new CFX_SkiaDevice;
367 ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pB itmap); 364 ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pB itmap);
368 #else 365 #else
369 » » pContext->m_pDevice = FX_NEW CFX_FxgeDevice; 366 » » pContext->m_pDevice = new CFX_FxgeDevice;
370 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pB itmap); 367 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pB itmap);
371 #endif 368 #endif
372 } 369 }
373 else 370 else
374 » pContext->m_pDevice = FX_NEW CFX_WindowsDevice(dc); 371 » pContext->m_pDevice = new CFX_WindowsDevice(dc);
375 372
376 Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate , flags,TRUE,NULL); 373 Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate , flags,TRUE,NULL);
377 374
378 if (bBackgroundAlphaNeeded) 375 if (bBackgroundAlphaNeeded)
379 { 376 {
380 if (pBitmap) 377 if (pBitmap)
381 { 378 {
382 CFX_WindowsDevice WinDC(dc); 379 CFX_WindowsDevice WinDC(dc);
383 380
384 if (WinDC.GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINT ER) 381 if (WinDC.GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINT ER)
385 { 382 {
386 » » » » CFX_DIBitmap* pDst = FX_NEW CFX_DIBitmap; 383 » » » » CFX_DIBitmap* pDst = new CFX_DIBitmap;
387 int pitch = pBitmap->GetPitch(); 384 int pitch = pBitmap->GetPitch();
388 pDst->Create(size_x, size_y, FXDIB_Rgb32); 385 pDst->Create(size_x, size_y, FXDIB_Rgb32);
389 FXSYS_memset(pDst->GetBuffer(), -1, pitch*size_y ); 386 FXSYS_memset(pDst->GetBuffer(), -1, pitch*size_y );
390 pDst->CompositeBitmap(0, 0, size_x, size_y, pBit map, 0, 0, FXDIB_BLEND_NORMAL, NULL, FALSE, NULL); 387 pDst->CompositeBitmap(0, 0, size_x, size_y, pBit map, 0, 0, FXDIB_BLEND_NORMAL, NULL, FALSE, NULL);
391 WinDC.StretchDIBits(pDst,0,0,size_x,size_y); 388 WinDC.StretchDIBits(pDst,0,0,size_x,size_y);
392 delete pDst; 389 delete pDst;
393 } 390 }
394 else 391 else
395 WinDC.SetDIBits(pBitmap,0,0); 392 WinDC.SetDIBits(pBitmap,0,0);
396 393
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 } 436 }
440 FXSYS_memset(pBuffer, 0xff, height*((width*3+3)/4*4)); 437 FXSYS_memset(pBuffer, 0xff, height*((width*3+3)/4*4));
441 438
442 #ifdef DEBUG_TRACE 439 #ifdef DEBUG_TRACE
443 { 440 {
444 CPDF_ModuleMgr::Get()->ReportError(999, "DIBSection created"); 441 CPDF_ModuleMgr::Get()->ReportError(999, "DIBSection created");
445 } 442 }
446 #endif 443 #endif
447 444
448 // Create a device with this external buffer 445 // Create a device with this external buffer
449 » pContext->m_pBitmap = FX_NEW CFX_DIBitmap; 446 » pContext->m_pBitmap = new CFX_DIBitmap;
450 pContext->m_pBitmap->Create(width, height, FXDIB_Rgb, (FX_LPBYTE)pBuffer ); 447 pContext->m_pBitmap->Create(width, height, FXDIB_Rgb, (FX_LPBYTE)pBuffer );
451 » pContext->m_pDevice = FX_NEW CPDF_FxgeDevice; 448 » pContext->m_pDevice = new CPDF_FxgeDevice;
452 ((CPDF_FxgeDevice*)pContext->m_pDevice)->Attach(pContext->m_pBitmap); 449 ((CPDF_FxgeDevice*)pContext->m_pDevice)->Attach(pContext->m_pBitmap);
453 » 450
454 #ifdef DEBUG_TRACE 451 #ifdef DEBUG_TRACE
455 CPDF_ModuleMgr::Get()->ReportError(999, "Ready for PDF rendering"); 452 CPDF_ModuleMgr::Get()->ReportError(999, "Ready for PDF rendering");
456 #endif 453 #endif
457 454
458 // output to bitmap device 455 // output to bitmap device
459 Func_RenderPage(pContext, page, start_x - rect.left, start_y - rect.top, size_x, size_y, rotate, flags); 456 Func_RenderPage(pContext, page, start_x - rect.left, start_y - rect.top, size_x, size_y, rotate, flags);
460 457
461 #ifdef DEBUG_TRACE 458 #ifdef DEBUG_TRACE
462 CPDF_ModuleMgr::Get()->ReportError(999, "Finished PDF rendering"); 459 CPDF_ModuleMgr::Get()->ReportError(999, "Finished PDF rendering");
463 #endif 460 #endif
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 } 498 }
502 #endif 499 #endif
503 500
504 DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, 501 DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y,
505 int size_x, int size_y, int rota te, int flags) 502 int size_x, int size_y, int rota te, int flags)
506 { 503 {
507 if (bitmap == NULL || page == NULL) return; 504 if (bitmap == NULL || page == NULL) return;
508 CPDF_Page* pPage = (CPDF_Page*)page; 505 CPDF_Page* pPage = (CPDF_Page*)page;
509 506
510 507
511 » CRenderContext* pContext = FX_NEW CRenderContext; 508 » CRenderContext* pContext = new CRenderContext;
512 pPage->SetPrivateData((void*)1, pContext, DropContext); 509 pPage->SetPrivateData((void*)1, pContext, DropContext);
513 #ifdef _SKIA_SUPPORT_ 510 #ifdef _SKIA_SUPPORT_
514 » pContext->m_pDevice = FX_NEW CFX_SkiaDevice; 511 » pContext->m_pDevice = new CFX_SkiaDevice;
515 512
516 if (flags & FPDF_REVERSE_BYTE_ORDER) 513 if (flags & FPDF_REVERSE_BYTE_ORDER)
517 ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bi tmap,0,TRUE); 514 ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bi tmap,0,TRUE);
518 else 515 else
519 ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bi tmap); 516 ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bi tmap);
520 #else 517 #else
521 » pContext->m_pDevice = FX_NEW CFX_FxgeDevice; 518 » pContext->m_pDevice = new CFX_FxgeDevice;
522 519
523 if (flags & FPDF_REVERSE_BYTE_ORDER) 520 if (flags & FPDF_REVERSE_BYTE_ORDER)
524 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bi tmap,0,TRUE); 521 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bi tmap,0,TRUE);
525 else 522 else
526 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bi tmap); 523 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bi tmap);
527 #endif 524 #endif
528 525
529 Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate , flags,TRUE,NULL); 526 Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate , flags,TRUE,NULL);
530 527
531 delete pContext; 528 delete pContext;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 590
594 FX_FLOAT device_x_f, device_y_f; 591 FX_FLOAT device_x_f, device_y_f;
595 page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f , device_y_f); 592 page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f , device_y_f);
596 593
597 *device_x = FXSYS_round(device_x_f); 594 *device_x = FXSYS_round(device_x_f);
598 *device_y = FXSYS_round(device_y_f); 595 *device_y = FXSYS_round(device_y_f);
599 } 596 }
600 597
601 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, int height, int alpha ) 598 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, int height, int alpha )
602 { 599 {
603 » CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap; 600 » CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
604 pBitmap->Create(width, height, alpha ? FXDIB_Argb : FXDIB_Rgb32); 601 pBitmap->Create(width, height, alpha ? FXDIB_Argb : FXDIB_Rgb32);
605 return pBitmap; 602 return pBitmap;
606 } 603 }
607 604
608 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int for mat, void* first_scan, int stride) 605 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int for mat, void* first_scan, int stride)
609 { 606 {
610 FXDIB_Format fx_format; 607 FXDIB_Format fx_format;
611 switch (format) { 608 switch (format) {
612 case FPDFBitmap_Gray: 609 case FPDFBitmap_Gray:
613 fx_format = FXDIB_8bppRgb; 610 fx_format = FXDIB_8bppRgb;
614 break; 611 break;
615 case FPDFBitmap_BGR: 612 case FPDFBitmap_BGR:
616 fx_format = FXDIB_Rgb; 613 fx_format = FXDIB_Rgb;
617 break; 614 break;
618 case FPDFBitmap_BGRx: 615 case FPDFBitmap_BGRx:
619 fx_format = FXDIB_Rgb32; 616 fx_format = FXDIB_Rgb32;
620 break; 617 break;
621 case FPDFBitmap_BGRA: 618 case FPDFBitmap_BGRA:
622 fx_format = FXDIB_Argb; 619 fx_format = FXDIB_Argb;
623 break; 620 break;
624 default: 621 default:
625 return NULL; 622 return NULL;
626 } 623 }
627 » CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap; 624 » CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
628 pBitmap->Create(width, height, fx_format, (FX_LPBYTE)first_scan, stride) ; 625 pBitmap->Create(width, height, fx_format, (FX_LPBYTE)first_scan, stride) ;
629 return pBitmap; 626 return pBitmap;
630 } 627 }
631 628
632 DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top , int width, int height, FPDF_DWORD color) 629 DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top , int width, int height, FPDF_DWORD color)
633 { 630 {
634 if (bitmap == NULL) return; 631 if (bitmap == NULL) return;
635 #ifdef _SKIA_SUPPORT_ 632 #ifdef _SKIA_SUPPORT_
636 CFX_SkiaDevice device; 633 CFX_SkiaDevice device;
637 #else 634 #else
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate ); 707 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate );
711 708
712 FX_RECT clip; 709 FX_RECT clip;
713 clip.left = start_x; 710 clip.left = start_x;
714 clip.right = start_x + size_x; 711 clip.right = start_x + size_x;
715 clip.top = start_y; 712 clip.top = start_y;
716 clip.bottom = start_y + size_y; 713 clip.bottom = start_y + size_y;
717 pContext->m_pDevice->SaveState(); 714 pContext->m_pDevice->SaveState();
718 pContext->m_pDevice->SetClip_Rect(&clip); 715 pContext->m_pDevice->SetClip_Rect(&clip);
719 716
720 » pContext->m_pContext = FX_NEW CPDF_RenderContext; 717 » pContext->m_pContext = new CPDF_RenderContext;
721 pContext->m_pContext->Create(pPage); 718 pContext->m_pContext->Create(pPage);
722 pContext->m_pContext->AppendObjectList(pPage, &matrix); 719 pContext->m_pContext->AppendObjectList(pPage, &matrix);
723 720
724 if (flags & FPDF_ANNOT) { 721 if (flags & FPDF_ANNOT) {
725 » » pContext->m_pAnnots = FX_NEW CPDF_AnnotList(pPage); 722 » » pContext->m_pAnnots = new CPDF_AnnotList(pPage);
726 FX_BOOL bPrinting = pContext->m_pDevice->GetDeviceClass() != FXD C_DISPLAY; 723 FX_BOOL bPrinting = pContext->m_pDevice->GetDeviceClass() != FXD C_DISPLAY;
727 pContext->m_pAnnots->DisplayAnnots(pPage, pContext->m_pContext, bPrinting, &matrix, TRUE, NULL); 724 pContext->m_pAnnots->DisplayAnnots(pPage, pContext->m_pContext, bPrinting, &matrix, TRUE, NULL);
728 } 725 }
729 726
730 » pContext->m_pRenderer = FX_NEW CPDF_ProgressiveRenderer; 727 » pContext->m_pRenderer = new CPDF_ProgressiveRenderer;
731 pContext->m_pRenderer->Start(pContext->m_pContext, pContext->m_pDevice, pContext->m_pOptions, pause); 728 pContext->m_pRenderer->Start(pContext->m_pContext, pContext->m_pDevice, pContext->m_pOptions, pause);
732 if (bNeedToRestore) 729 if (bNeedToRestore)
733 { 730 {
734 pContext->m_pDevice->RestoreState(); 731 pContext->m_pDevice->RestoreState();
735 } 732 }
736
737 //#endif
738 } 733 }
739 734
740 DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, int page_i ndex, double* width, double* height) 735 DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, int page_i ndex, double* width, double* height)
741 { 736 {
742 CPDF_Document* pDoc = (CPDF_Document*)document; 737 CPDF_Document* pDoc = (CPDF_Document*)document;
743 if(pDoc == NULL) 738 if(pDoc == NULL)
744 return FALSE; 739 return FALSE;
745 740
746 CPDF_Dictionary* pDict = pDoc->GetPage(page_index); 741 CPDF_Dictionary* pDict = pDoc->GetPage(page_index);
747 if (pDict == NULL) return FALSE; 742 if (pDict == NULL) return FALSE;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 if (!buffer) { 858 if (!buffer) {
864 buflen = len; 859 buflen = len;
865 } else if (buflen >= len) { 860 } else if (buflen >= len) {
866 memcpy(buffer, utf16Name.c_str(), len); 861 memcpy(buffer, utf16Name.c_str(), len);
867 buflen = len; 862 buflen = len;
868 } else { 863 } else {
869 buflen = -1; 864 buflen = -1;
870 } 865 }
871 return (FPDF_DEST)pDestObj; 866 return (FPDF_DEST)pDestObj;
872 } 867 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdfformfill.cpp ('k') | fpdfsdk/src/fsdk_baseannot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698