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