| 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 } | 342 } |
| 343 return pStretched; | 343 return pStretched; |
| 344 } | 344 } |
| 345 static void OutputImageMask(GpGraphics* pGraphics, BOOL bMonoDevice, const CFX_D
IBitmap* pBitmap, int dest_left, int dest_top, | 345 static void OutputImageMask(GpGraphics* pGraphics, BOOL bMonoDevice, const CFX_D
IBitmap* pBitmap, int dest_left, int dest_top, |
| 346 int dest_width, int dest_height, FX_ARGB argb, const
FX_RECT* pClipRect) | 346 int dest_width, int dest_height, FX_ARGB argb, const
FX_RECT* pClipRect) |
| 347 { | 347 { |
| 348 ASSERT(pBitmap->GetBPP() == 1); | 348 ASSERT(pBitmap->GetBPP() == 1); |
| 349 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 349 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 350 int src_width = pBitmap->GetWidth(), src_height = pBitmap->GetHeight(); | 350 int src_width = pBitmap->GetWidth(), src_height = pBitmap->GetHeight(); |
| 351 int src_pitch = pBitmap->GetPitch(); | 351 int src_pitch = pBitmap->GetPitch(); |
| 352 FX_LPBYTE scan0 = pBitmap->GetBuffer(); | 352 uint8_t* scan0 = pBitmap->GetBuffer(); |
| 353 if (src_width == 1 && src_height == 1) { | 353 if (src_width == 1 && src_height == 1) { |
| 354 if ((scan0[0] & 0x80) == 0) { | 354 if ((scan0[0] & 0x80) == 0) { |
| 355 return; | 355 return; |
| 356 } | 356 } |
| 357 GpSolidFill* solidBrush; | 357 GpSolidFill* solidBrush; |
| 358 CallFunc(GdipCreateSolidFill)((ARGB)argb, &solidBrush); | 358 CallFunc(GdipCreateSolidFill)((ARGB)argb, &solidBrush); |
| 359 if (dest_width < 0) { | 359 if (dest_width < 0) { |
| 360 dest_width = -dest_width; | 360 dest_width = -dest_width; |
| 361 dest_left -= dest_width; | 361 dest_left -= dest_width; |
| 362 } | 362 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 FX_RECT new_rect(0, 0, src_width, src_height); | 423 FX_RECT new_rect(0, 0, src_width, src_height); |
| 424 CFX_DIBitmap* pCloned = pBitmap->Clone(pSrcRect); | 424 CFX_DIBitmap* pCloned = pBitmap->Clone(pSrcRect); |
| 425 if (!pCloned) { | 425 if (!pCloned) { |
| 426 return; | 426 return; |
| 427 } | 427 } |
| 428 OutputImage(pGraphics, pCloned, &new_rect, dest_left, dest_top, dest_wid
th, dest_height); | 428 OutputImage(pGraphics, pCloned, &new_rect, dest_left, dest_top, dest_wid
th, dest_height); |
| 429 delete pCloned; | 429 delete pCloned; |
| 430 return; | 430 return; |
| 431 } | 431 } |
| 432 int src_pitch = pBitmap->GetPitch(); | 432 int src_pitch = pBitmap->GetPitch(); |
| 433 FX_LPBYTE scan0 = pBitmap->GetBuffer() + pSrcRect->top * src_pitch + pBitmap
->GetBPP() * pSrcRect->left / 8; | 433 uint8_t* scan0 = pBitmap->GetBuffer() + pSrcRect->top * src_pitch + pBitmap-
>GetBPP() * pSrcRect->left / 8; |
| 434 GpBitmap* bitmap = NULL; | 434 GpBitmap* bitmap = NULL; |
| 435 switch (pBitmap->GetFormat()) { | 435 switch (pBitmap->GetFormat()) { |
| 436 case FXDIB_Argb: | 436 case FXDIB_Argb: |
| 437 CallFunc(GdipCreateBitmapFromScan0)(src_width, src_height, src_pitch
, | 437 CallFunc(GdipCreateBitmapFromScan0)(src_width, src_height, src_pitch
, |
| 438 PixelFormat32bppARGB, scan0, &bi
tmap); | 438 PixelFormat32bppARGB, scan0, &bi
tmap); |
| 439 break; | 439 break; |
| 440 case FXDIB_Rgb32: | 440 case FXDIB_Rgb32: |
| 441 CallFunc(GdipCreateBitmapFromScan0)(src_width, src_height, src_pitch
, | 441 CallFunc(GdipCreateBitmapFromScan0)(src_width, src_height, src_pitch
, |
| 442 PixelFormat32bppRGB, scan0, &bit
map); | 442 PixelFormat32bppRGB, scan0, &bit
map); |
| 443 break; | 443 break; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 } | 562 } |
| 563 FX_BOOL CGdiplusExt::GdipCreateFromImage(void* bitmap, void** graphics) | 563 FX_BOOL CGdiplusExt::GdipCreateFromImage(void* bitmap, void** graphics) |
| 564 { | 564 { |
| 565 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 565 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 566 GpStatus status = CallFunc(GdipGetImageGraphicsContext)((GpBitmap*)bitmap, (
GpGraphics**)graphics); | 566 GpStatus status = CallFunc(GdipGetImageGraphicsContext)((GpBitmap*)bitmap, (
GpGraphics**)graphics); |
| 567 if (status == Ok) { | 567 if (status == Ok) { |
| 568 return TRUE; | 568 return TRUE; |
| 569 } | 569 } |
| 570 return FALSE; | 570 return FALSE; |
| 571 } | 571 } |
| 572 FX_BOOL CGdiplusExt::GdipCreateFontFamilyFromName(FX_LPCWSTR name, void* pFontCo
llection, void**pFamily) | 572 FX_BOOL CGdiplusExt::GdipCreateFontFamilyFromName(const FX_WCHAR* name, void* pF
ontCollection, void**pFamily) |
| 573 { | 573 { |
| 574 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 574 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 575 GpStatus status = CallFunc(GdipCreateFontFamilyFromName)((GDIPCONST WCHAR *)
name, (GpFontCollection*)pFontCollection, (GpFontFamily**)pFamily); | 575 GpStatus status = CallFunc(GdipCreateFontFamilyFromName)((GDIPCONST WCHAR *)
name, (GpFontCollection*)pFontCollection, (GpFontFamily**)pFamily); |
| 576 if (status == Ok) { | 576 if (status == Ok) { |
| 577 return TRUE; | 577 return TRUE; |
| 578 } | 578 } |
| 579 return FALSE; | 579 return FALSE; |
| 580 } | 580 } |
| 581 FX_BOOL CGdiplusExt::GdipCreateFontFromFamily(void* pFamily, FX_FLOAT font_size,
int fontstyle, int flag, void** pFont) | 581 FX_BOOL CGdiplusExt::GdipCreateFontFromFamily(void* pFamily, FX_FLOAT font_size,
int fontstyle, int flag, void** pFont) |
| 582 { | 582 { |
| (...skipping 662 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 |