| 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/fxge/fx_ge.h" | 7 #include "../../../include/fxge/fx_ge.h" |
| 8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ | 8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 typedef GpStatus (WINGDIPAPI *FuncType_GdipGetImagePalette)(GpImage *image, Colo
rPalette *palette, INT size); | 213 typedef GpStatus (WINGDIPAPI *FuncType_GdipGetImagePalette)(GpImage *image, Colo
rPalette *palette, INT size); |
| 214 typedef GpStatus (WINGDIPAPI *FuncType_GdipGetImagePaletteSize)(GpImage *image,
INT *size); | 214 typedef GpStatus (WINGDIPAPI *FuncType_GdipGetImagePaletteSize)(GpImage *image,
INT *size); |
| 215 typedef GpStatus (WINGDIPAPI *FuncType_GdipBitmapUnlockBits)(GpBitmap* bitmap, B
itmapData* lockedBitmapData); | 215 typedef GpStatus (WINGDIPAPI *FuncType_GdipBitmapUnlockBits)(GpBitmap* bitmap, B
itmapData* lockedBitmapData); |
| 216 typedef GpStatus (WINGDIPAPI *FuncType_GdipDisposeImage)(GpImage *image); | 216 typedef GpStatus (WINGDIPAPI *FuncType_GdipDisposeImage)(GpImage *image); |
| 217 typedef GpStatus (WINGDIPAPI *FuncType_GdipFillRectangle)(GpGraphics *graphics,
GpBrush *brush, REAL x, REAL y, REAL width, REAL height); | 217 typedef GpStatus (WINGDIPAPI *FuncType_GdipFillRectangle)(GpGraphics *graphics,
GpBrush *brush, REAL x, REAL y, REAL width, REAL height); |
| 218 typedef GpStatus (WINGDIPAPI *FuncType_GdipCreateBitmapFromScan0)(INT width, INT
height, INT stride, PixelFormat format, BYTE* scan0, GpBitmap** bitmap); | 218 typedef GpStatus (WINGDIPAPI *FuncType_GdipCreateBitmapFromScan0)(INT width, INT
height, INT stride, PixelFormat format, BYTE* scan0, GpBitmap** bitmap); |
| 219 typedef GpStatus (WINGDIPAPI *FuncType_GdipSetImagePalette)(GpImage *image, GDIP
CONST ColorPalette *palette); | 219 typedef GpStatus (WINGDIPAPI *FuncType_GdipSetImagePalette)(GpImage *image, GDIP
CONST ColorPalette *palette); |
| 220 typedef GpStatus (WINGDIPAPI *FuncType_GdipSetInterpolationMode)(GpGraphics *gra
phics, InterpolationMode interpolationMode); | 220 typedef GpStatus (WINGDIPAPI *FuncType_GdipSetInterpolationMode)(GpGraphics *gra
phics, InterpolationMode interpolationMode); |
| 221 typedef GpStatus (WINGDIPAPI *FuncType_GdipDrawImagePointsI)(GpGraphics *graphic
s, GpImage *image, GDIPCONST GpPoint *dstpoints, INT count); | 221 typedef GpStatus (WINGDIPAPI *FuncType_GdipDrawImagePointsI)(GpGraphics *graphic
s, GpImage *image, GDIPCONST GpPoint *dstpoints, INT count); |
| 222 typedef GpStatus (WINGDIPAPI *FuncType_GdipCreateBitmapFromGdiDib)(GDIPCONST BIT
MAPINFO* gdiBitmapInfo, VOID* gdiBitmapData, GpBitmap** bitmap); | 222 typedef GpStatus (WINGDIPAPI *FuncType_GdipCreateBitmapFromGdiDib)(GDIPCONST BIT
MAPINFO* gdiBitmapInfo, VOID* gdiBitmapData, GpBitmap** bitmap); |
| 223 typedef Status (WINAPI *FuncType_GdiplusStartup)(OUT FX_UINTPTR *token, const Gd
iplusStartupInput *input, OUT GdiplusStartupOutput *output); | 223 typedef Status (WINAPI *FuncType_GdiplusStartup)(OUT uintptr_t *token, const Gdi
plusStartupInput *input, OUT GdiplusStartupOutput *output); |
| 224 typedef GpStatus (WINGDIPAPI *FuncType_GdipDrawLineI)(GpGraphics *graphics, GpPe
n *pen, int x1, int y1, int x2, int y2); | 224 typedef GpStatus (WINGDIPAPI *FuncType_GdipDrawLineI)(GpGraphics *graphics, GpPe
n *pen, int x1, int y1, int x2, int y2); |
| 225 typedef GpStatus (WINGDIPAPI *FuncType_GdipResetClip)(GpGraphics *graphics); | 225 typedef GpStatus (WINGDIPAPI *FuncType_GdipResetClip)(GpGraphics *graphics); |
| 226 typedef GpStatus (WINGDIPAPI *FuncType_GdipCreatePath)(GpFillMode brushMode, GpP
ath **path); | 226 typedef GpStatus (WINGDIPAPI *FuncType_GdipCreatePath)(GpFillMode brushMode, GpP
ath **path); |
| 227 typedef GpStatus (WINGDIPAPI *FuncType_GdipAddPathPath)(GpPath *path, GDIPCONST
GpPath* addingPath, BOOL connect); | 227 typedef GpStatus (WINGDIPAPI *FuncType_GdipAddPathPath)(GpPath *path, GDIPCONST
GpPath* addingPath, BOOL connect); |
| 228 typedef GpStatus (WINGDIPAPI *FuncType_GdipSetPathFillMode)(GpPath *path, GpFill
Mode fillmode); | 228 typedef GpStatus (WINGDIPAPI *FuncType_GdipSetPathFillMode)(GpPath *path, GpFill
Mode fillmode); |
| 229 typedef GpStatus (WINGDIPAPI *FuncType_GdipSetClipPath)(GpGraphics *graphics, Gp
Path *path, CombineMode combineMode); | 229 typedef GpStatus (WINGDIPAPI *FuncType_GdipSetClipPath)(GpGraphics *graphics, Gp
Path *path, CombineMode combineMode); |
| 230 typedef GpStatus (WINGDIPAPI *FuncType_GdipGetClip)(GpGraphics *graphics, GpRegi
on *region); | 230 typedef GpStatus (WINGDIPAPI *FuncType_GdipGetClip)(GpGraphics *graphics, GpRegi
on *region); |
| 231 typedef GpStatus (WINGDIPAPI *FuncType_GdipCreateRegion)(GpRegion **region); | 231 typedef GpStatus (WINGDIPAPI *FuncType_GdipCreateRegion)(GpRegion **region); |
| 232 typedef GpStatus (WINGDIPAPI *FuncType_GdipGetClipBoundsI)(GpGraphics *graphics,
GpRect *rect); | 232 typedef GpStatus (WINGDIPAPI *FuncType_GdipGetClipBoundsI)(GpGraphics *graphics,
GpRect *rect); |
| 233 typedef GpStatus (WINGDIPAPI *FuncType_GdipSetClipRegion)(GpGraphics *graphics,
GpRegion *region, CombineMode combineMode); | 233 typedef GpStatus (WINGDIPAPI *FuncType_GdipSetClipRegion)(GpGraphics *graphics,
GpRegion *region, CombineMode combineMode); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 if (m_hModule == NULL) { | 499 if (m_hModule == NULL) { |
| 500 return; | 500 return; |
| 501 } | 501 } |
| 502 for (int i = 0; i < sizeof g_GdipFuncNames / sizeof(LPCSTR); i ++) { | 502 for (int i = 0; i < sizeof g_GdipFuncNames / sizeof(LPCSTR); i ++) { |
| 503 m_Functions[i] = GetProcAddress(m_hModule, g_GdipFuncNames[i]); | 503 m_Functions[i] = GetProcAddress(m_hModule, g_GdipFuncNames[i]); |
| 504 if (m_Functions[i] == NULL) { | 504 if (m_Functions[i] == NULL) { |
| 505 m_hModule = NULL; | 505 m_hModule = NULL; |
| 506 return; | 506 return; |
| 507 } | 507 } |
| 508 } | 508 } |
| 509 FX_UINTPTR gdiplusToken; | 509 uintptr_t gdiplusToken; |
| 510 GdiplusStartupInput gdiplusStartupInput; | 510 GdiplusStartupInput gdiplusStartupInput; |
| 511 ((FuncType_GdiplusStartup)m_Functions[FuncId_GdiplusStartup])(&gdiplusToken,
&gdiplusStartupInput, NULL); | 511 ((FuncType_GdiplusStartup)m_Functions[FuncId_GdiplusStartup])(&gdiplusToken,
&gdiplusStartupInput, NULL); |
| 512 m_GdiModule = LoadLibraryA("GDI32.DLL"); | 512 m_GdiModule = LoadLibraryA("GDI32.DLL"); |
| 513 if (m_GdiModule == NULL) { | 513 if (m_GdiModule == NULL) { |
| 514 return; | 514 return; |
| 515 } | 515 } |
| 516 m_pGdiAddFontMemResourceEx = GetProcAddress(m_GdiModule, "AddFontMemResource
Ex"); | 516 m_pGdiAddFontMemResourceEx = GetProcAddress(m_GdiModule, "AddFontMemResource
Ex"); |
| 517 m_pGdiRemoveFontMemResourseEx = GetProcAddress(m_GdiModule, "RemoveFontMemRe
sourceEx"); | 517 m_pGdiRemoveFontMemResourseEx = GetProcAddress(m_GdiModule, "RemoveFontMemRe
sourceEx"); |
| 518 } | 518 } |
| 519 CGdiplusExt::~CGdiplusExt() | 519 CGdiplusExt::~CGdiplusExt() |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 size_t bytes_out; | 1037 size_t bytes_out; |
| 1038 if (pcbRead != NULL) { | 1038 if (pcbRead != NULL) { |
| 1039 *pcbRead = 0; | 1039 *pcbRead = 0; |
| 1040 } | 1040 } |
| 1041 if (m_ReadPos == m_InterStream.GetLength()) { | 1041 if (m_ReadPos == m_InterStream.GetLength()) { |
| 1042 return HRESULT_FROM_WIN32(ERROR_END_OF_MEDIA); | 1042 return HRESULT_FROM_WIN32(ERROR_END_OF_MEDIA); |
| 1043 } | 1043 } |
| 1044 bytes_left = m_InterStream.GetLength() - m_ReadPos; | 1044 bytes_left = m_InterStream.GetLength() - m_ReadPos; |
| 1045 bytes_out = FX_MIN(cb, bytes_left); | 1045 bytes_out = FX_MIN(cb, bytes_left); |
| 1046 FXSYS_memcpy32(Output, m_InterStream.GetBuffer() + m_ReadPos, bytes_out)
; | 1046 FXSYS_memcpy32(Output, m_InterStream.GetBuffer() + m_ReadPos, bytes_out)
; |
| 1047 m_ReadPos += (FX_INT32)bytes_out; | 1047 m_ReadPos += (int32_t)bytes_out; |
| 1048 if (pcbRead != NULL) { | 1048 if (pcbRead != NULL) { |
| 1049 *pcbRead = (ULONG)bytes_out; | 1049 *pcbRead = (ULONG)bytes_out; |
| 1050 } | 1050 } |
| 1051 return S_OK; | 1051 return S_OK; |
| 1052 } | 1052 } |
| 1053 virtual HRESULT STDMETHODCALLTYPE Write(void const* Input, ULONG cb, ULONG*
pcbWritten) | 1053 virtual HRESULT STDMETHODCALLTYPE Write(void const* Input, ULONG cb, ULONG*
pcbWritten) |
| 1054 { | 1054 { |
| 1055 if (cb <= 0) { | 1055 if (cb <= 0) { |
| 1056 if (pcbWritten != NULL) { | 1056 if (pcbWritten != NULL) { |
| 1057 *pcbWritten = 0; | 1057 *pcbWritten = 0; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 for (int i = 0; i < height; i ++) { | 1245 for (int i = 0; i < height; i ++) { |
| 1246 FXSYS_memcpy32(pData + dest_pitch * i, pInfo->pScan0 + pInfo->Stride
* i, dest_pitch); | 1246 FXSYS_memcpy32(pData + dest_pitch * i, pInfo->pScan0 + pInfo->Stride
* i, dest_pitch); |
| 1247 } | 1247 } |
| 1248 } | 1248 } |
| 1249 CFX_DIBitmap* pDIBitmap = _FX_WindowsDIB_LoadFromBuf(pInfo->pbmi, pData, pIn
fo->pbmi->bmiHeader.biBitCount == 32); | 1249 CFX_DIBitmap* pDIBitmap = _FX_WindowsDIB_LoadFromBuf(pInfo->pbmi, pData, pIn
fo->pbmi->bmiHeader.biBitCount == 32); |
| 1250 FX_Free(pData); | 1250 FX_Free(pData); |
| 1251 FreeDIBitmap(pInfo); | 1251 FreeDIBitmap(pInfo); |
| 1252 return pDIBitmap; | 1252 return pDIBitmap; |
| 1253 } | 1253 } |
| 1254 #endif | 1254 #endif |
| OLD | NEW |