| OLD | NEW |
| 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/fpdfview.h" | 8 #include "../include/fpdfview.h" |
| 9 #include "../include/fsdk_rendercontext.h" | 9 #include "../include/fsdk_rendercontext.h" |
| 10 #include "../include/fpdf_progressive.h" | 10 #include "../include/fpdf_progressive.h" |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 #ifndef _WIN32_WCE | 442 #ifndef _WIN32_WCE |
| 443 CFX_DIBitmap* pBitmap = NULL; | 443 CFX_DIBitmap* pBitmap = NULL; |
| 444 FX_BOOL bBackgroundAlphaNeeded=FALSE; | 444 FX_BOOL bBackgroundAlphaNeeded=FALSE; |
| 445 bBackgroundAlphaNeeded = pPage->BackgroundAlphaNeeded(); | 445 bBackgroundAlphaNeeded = pPage->BackgroundAlphaNeeded(); |
| 446 if (bBackgroundAlphaNeeded) | 446 if (bBackgroundAlphaNeeded) |
| 447 { | 447 { |
| 448 | 448 |
| 449 pBitmap = FX_NEW CFX_DIBitmap; | 449 pBitmap = FX_NEW CFX_DIBitmap; |
| 450 pBitmap->Create(size_x, size_y, FXDIB_Argb); | 450 pBitmap->Create(size_x, size_y, FXDIB_Argb); |
| 451 pBitmap->Clear(0x00ffffff); | 451 pBitmap->Clear(0x00ffffff); |
| 452 #ifdef _SKIA_SUPPORT_ | |
| 453 pContext->m_pDevice = FX_NEW CFX_SkiaDevice; | |
| 454 ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pB
itmap); | |
| 455 #else | |
| 456 pContext->m_pDevice = FX_NEW CFX_FxgeDevice; | 452 pContext->m_pDevice = FX_NEW CFX_FxgeDevice; |
| 457 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pB
itmap); | 453 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pB
itmap); |
| 458 #endif | |
| 459 } | 454 } |
| 460 else | 455 else |
| 461 pContext->m_pDevice = FX_NEW CFX_WindowsDevice(dc); | 456 pContext->m_pDevice = FX_NEW CFX_WindowsDevice(dc); |
| 462 if (flags & FPDF_NO_CATCH) | 457 if (flags & FPDF_NO_CATCH) |
| 463 Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y
, rotate, flags,TRUE,NULL); | 458 Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y
, rotate, flags,TRUE,NULL); |
| 464 else { | 459 else { |
| 465 try { | 460 try { |
| 466 Func_RenderPage(pContext, page, start_x, start_y, size_x
, size_y, rotate, flags,TRUE,NULL); | 461 Func_RenderPage(pContext, page, start_x, start_y, size_x
, size_y, rotate, flags,TRUE,NULL); |
| 467 } catch (...) { | 462 } catch (...) { |
| 468 } | 463 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 | 593 |
| 599 DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page,
int start_x, int start_y, | 594 DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page,
int start_x, int start_y, |
| 600 int size_x, int size_y, int rota
te, int flags) | 595 int size_x, int size_y, int rota
te, int flags) |
| 601 { | 596 { |
| 602 if (bitmap == NULL || page == NULL) return; | 597 if (bitmap == NULL || page == NULL) return; |
| 603 CPDF_Page* pPage = (CPDF_Page*)page; | 598 CPDF_Page* pPage = (CPDF_Page*)page; |
| 604 | 599 |
| 605 | 600 |
| 606 CRenderContext* pContext = FX_NEW CRenderContext; | 601 CRenderContext* pContext = FX_NEW CRenderContext; |
| 607 pPage->SetPrivateData((void*)1, pContext, DropContext); | 602 pPage->SetPrivateData((void*)1, pContext, DropContext); |
| 608 #ifdef _SKIA_SUPPORT_ | |
| 609 pContext->m_pDevice = FX_NEW CFX_SkiaDevice; | |
| 610 | 603 |
| 611 if (flags & FPDF_REVERSE_BYTE_ORDER) | |
| 612 ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bi
tmap,0,TRUE); | |
| 613 else | |
| 614 ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bi
tmap); | |
| 615 #else | |
| 616 pContext->m_pDevice = FX_NEW CFX_FxgeDevice; | 604 pContext->m_pDevice = FX_NEW CFX_FxgeDevice; |
| 617 | 605 |
| 618 if (flags & FPDF_REVERSE_BYTE_ORDER) | 606 if (flags & FPDF_REVERSE_BYTE_ORDER) |
| 619 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bi
tmap,0,TRUE); | 607 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bi
tmap,0,TRUE); |
| 620 else | 608 else |
| 621 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bi
tmap); | 609 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bi
tmap); |
| 622 #endif | 610 |
| 623 if (flags & FPDF_NO_CATCH) | 611 if (flags & FPDF_NO_CATCH) |
| 624 Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y
, rotate, flags,TRUE,NULL); | 612 Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y
, rotate, flags,TRUE,NULL); |
| 625 else { | 613 else { |
| 626 try { | 614 try { |
| 627 Func_RenderPage(pContext, page, start_x, start_y, size_x
, size_y, rotate, flags,TRUE,NULL); | 615 Func_RenderPage(pContext, page, start_x, start_y, size_x
, size_y, rotate, flags,TRUE,NULL); |
| 628 } catch (...) { | 616 } catch (...) { |
| 629 } | 617 } |
| 630 } | 618 } |
| 631 | 619 |
| 632 delete pContext; | 620 delete pContext; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 return NULL; | 709 return NULL; |
| 722 } | 710 } |
| 723 CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap; | 711 CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap; |
| 724 pBitmap->Create(width, height, fx_format, (FX_LPBYTE)first_scan, stride)
; | 712 pBitmap->Create(width, height, fx_format, (FX_LPBYTE)first_scan, stride)
; |
| 725 return pBitmap; | 713 return pBitmap; |
| 726 } | 714 } |
| 727 | 715 |
| 728 DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top
, int width, int height, FPDF_DWORD color) | 716 DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top
, int width, int height, FPDF_DWORD color) |
| 729 { | 717 { |
| 730 if (bitmap == NULL) return; | 718 if (bitmap == NULL) return; |
| 731 #ifdef _SKIA_SUPPORT_ | |
| 732 CFX_SkiaDevice device; | |
| 733 #else | |
| 734 CFX_FxgeDevice device; | 719 CFX_FxgeDevice device; |
| 735 #endif | |
| 736 device.Attach((CFX_DIBitmap*)bitmap); | 720 device.Attach((CFX_DIBitmap*)bitmap); |
| 737 if (!((CFX_DIBitmap*)bitmap)->HasAlpha()) color |= 0xFF000000; | 721 if (!((CFX_DIBitmap*)bitmap)->HasAlpha()) color |= 0xFF000000; |
| 738 FX_RECT rect(left, top, left+width, top+height); | 722 FX_RECT rect(left, top, left+width, top+height); |
| 739 device.FillRect(&rect, color); | 723 device.FillRect(&rect, color); |
| 740 } | 724 } |
| 741 | 725 |
| 742 DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap) | 726 DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap) |
| 743 { | 727 { |
| 744 if (bitmap == NULL) return NULL; | 728 if (bitmap == NULL) return NULL; |
| 745 return ((CFX_DIBitmap*)bitmap)->GetBuffer(); | 729 return ((CFX_DIBitmap*)bitmap)->GetBuffer(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 { | 878 { |
| 895 if (document == NULL) | 879 if (document == NULL) |
| 896 return NULL; | 880 return NULL; |
| 897 if (name == NULL || name[0] == 0) | 881 if (name == NULL || name[0] == 0) |
| 898 return NULL; | 882 return NULL; |
| 899 | 883 |
| 900 CPDF_Document* pDoc = (CPDF_Document*)document; | 884 CPDF_Document* pDoc = (CPDF_Document*)document; |
| 901 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests")); | 885 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests")); |
| 902 return name_tree.LookupNamedDest(pDoc, name); | 886 return name_tree.LookupNamedDest(pDoc, name); |
| 903 } | 887 } |
| OLD | NEW |