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