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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 fx_format = FXDIB_Argb; | 718 fx_format = FXDIB_Argb; |
719 break; | 719 break; |
720 default: | 720 default: |
721 return NULL; | 721 return NULL; |
722 } | 722 } |
723 CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap; | 723 CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap; |
724 pBitmap->Create(width, height, fx_format, (FX_LPBYTE)first_scan, stride)
; | 724 pBitmap->Create(width, height, fx_format, (FX_LPBYTE)first_scan, stride)
; |
725 return pBitmap; | 725 return pBitmap; |
726 } | 726 } |
727 | 727 |
728 DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top
, int width, int height, | 728 DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top
, int width, int height, FPDF_DWORD color) |
729 » » » » » » » » » int red,
int green, int blue, int alpha) | |
730 { | 729 { |
731 if (bitmap == NULL) return; | 730 if (bitmap == NULL) return; |
732 #ifdef _SKIA_SUPPORT_ | 731 #ifdef _SKIA_SUPPORT_ |
733 CFX_SkiaDevice device; | 732 CFX_SkiaDevice device; |
734 #else | 733 #else |
735 CFX_FxgeDevice device; | 734 CFX_FxgeDevice device; |
736 #endif | 735 #endif |
737 device.Attach((CFX_DIBitmap*)bitmap); | 736 device.Attach((CFX_DIBitmap*)bitmap); |
738 » if (!((CFX_DIBitmap*)bitmap)->HasAlpha()) alpha = 255; | 737 » if (!((CFX_DIBitmap*)bitmap)->HasAlpha()) color |= 0xFF000000; |
739 FX_RECT rect(left, top, left+width, top+height); | 738 FX_RECT rect(left, top, left+width, top+height); |
740 » device.FillRect(&rect, FXARGB_MAKE(alpha, red, green, blue)); | 739 » device.FillRect(&rect, color); |
741 } | 740 } |
742 | 741 |
743 DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap) | 742 DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap) |
744 { | 743 { |
745 if (bitmap == NULL) return NULL; | 744 if (bitmap == NULL) return NULL; |
746 return ((CFX_DIBitmap*)bitmap)->GetBuffer(); | 745 return ((CFX_DIBitmap*)bitmap)->GetBuffer(); |
747 } | 746 } |
748 | 747 |
749 DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap) | 748 DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap) |
750 { | 749 { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 { | 863 { |
865 if (document == NULL) | 864 if (document == NULL) |
866 return NULL; | 865 return NULL; |
867 if (name == NULL || name[0] == 0) | 866 if (name == NULL || name[0] == 0) |
868 return NULL; | 867 return NULL; |
869 | 868 |
870 CPDF_Document* pDoc = (CPDF_Document*)document; | 869 CPDF_Document* pDoc = (CPDF_Document*)document; |
871 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests")); | 870 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests")); |
872 return name_tree.LookupNamedDest(pDoc, name); | 871 return name_tree.LookupNamedDest(pDoc, name); |
873 } | 872 } |
OLD | NEW |