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_ | 8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ |
9 #include "../../../include/fxge/fx_ge_win32.h" | 9 #include "../../../include/fxge/fx_ge_win32.h" |
10 #include <crtdbg.h> | 10 #include <crtdbg.h> |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 if (pBitmap != pBitmap1) { | 508 if (pBitmap != pBitmap1) { |
509 delete pBitmap; | 509 delete pBitmap; |
510 } | 510 } |
511 } | 511 } |
512 return TRUE; | 512 return TRUE; |
513 } | 513 } |
514 FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1, int de
st_left, int dest_top, | 514 FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1, int de
st_left, int dest_top, |
515 int dest_width, int dest_height, FX_DWORD flags, void* pIccTransform) | 515 int dest_width, int dest_height, FX_DWORD flags, void* pIccTransform) |
516 { | 516 { |
517 CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; | 517 CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; |
518 if (pBitmap == NULL) { | 518 if (pBitmap == NULL || dest_width == 0 || dest_height == 0) { |
519 return FALSE; | 519 return FALSE; |
520 } | 520 } |
521 if ((pBitmap->IsCmykImage() || pIccTransform) && | 521 if ((pBitmap->IsCmykImage() || pIccTransform) && |
522 !pBitmap->ConvertFormat(FXDIB_Rgb, pIccTransform)) { | 522 !pBitmap->ConvertFormat(FXDIB_Rgb, pIccTransform)) { |
523 return FALSE; | 523 return FALSE; |
524 } | 524 } |
525 CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); | 525 CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); |
526 if ((FX_INT64)abs(dest_width) * abs(dest_height) < (FX_INT64)pBitmap1->GetWi
dth() * pBitmap1->GetHeight() * 4 || | 526 if ((FX_INT64)abs(dest_width) * abs(dest_height) < (FX_INT64)pBitmap1->GetWi
dth() * pBitmap1->GetHeight() * 4 || |
527 (flags & FXDIB_INTERPOL) || (flags & FXDIB_BICUBIC_INTERPOL)) { | 527 (flags & FXDIB_INTERPOL) || (flags & FXDIB_BICUBIC_INTERPOL)) { |
528 SetStretchBltMode(m_hDC, HALFTONE); | 528 SetStretchBltMode(m_hDC, HALFTONE); |
(...skipping 13 matching lines...) Expand all Loading... |
542 if (del) { | 542 if (del) { |
543 delete pToStrechBitmap; | 543 delete pToStrechBitmap; |
544 } | 544 } |
545 return TRUE; | 545 return TRUE; |
546 } | 546 } |
547 FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(const CFX_DIBitmap* pBitmap1, int d
est_left, int dest_top, | 547 FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(const CFX_DIBitmap* pBitmap1, int d
est_left, int dest_top, |
548 int dest_width, int dest_height, FX_DWORD bitmap_color, FX_DWORD flags, | 548 int dest_width, int dest_height, FX_DWORD bitmap_color, FX_DWORD flags, |
549 int alpha_flag, void* pIccTransform) | 549 int alpha_flag, void* pIccTransform) |
550 { | 550 { |
551 CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; | 551 CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; |
552 if (pBitmap == NULL) { | 552 if (pBitmap == NULL || dest_width == 0 || dest_height == 0) { |
553 return FALSE; | 553 return FALSE; |
554 } | 554 } |
555 _Color2Argb(bitmap_color, bitmap_color, alpha_flag | (1 << 24), pIccTransfor
m); | 555 _Color2Argb(bitmap_color, bitmap_color, alpha_flag | (1 << 24), pIccTransfor
m); |
556 int width = pBitmap->GetWidth(), height = pBitmap->GetHeight(); | 556 int width = pBitmap->GetWidth(), height = pBitmap->GetHeight(); |
557 struct { | 557 struct { |
558 BITMAPINFOHEADER bmiHeader; | 558 BITMAPINFOHEADER bmiHeader; |
559 FX_DWORD bmiColors[2]; | 559 FX_DWORD bmiColors[2]; |
560 } bmi; | 560 } bmi; |
561 FXSYS_memset32(&bmi.bmiHeader, 0, sizeof (BITMAPINFOHEADER)); | 561 FXSYS_memset32(&bmi.bmiHeader, 0, sizeof (BITMAPINFOHEADER)); |
562 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); | 562 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 if (m_hDC) { | 1191 if (m_hDC) { |
1192 SelectObject(m_hDC, m_hOldBitmap); | 1192 SelectObject(m_hDC, m_hOldBitmap); |
1193 DeleteDC(m_hDC); | 1193 DeleteDC(m_hDC); |
1194 } | 1194 } |
1195 if (m_hBitmap) { | 1195 if (m_hBitmap) { |
1196 DeleteObject(m_hBitmap); | 1196 DeleteObject(m_hBitmap); |
1197 } | 1197 } |
1198 delete GetBitmap(); | 1198 delete GetBitmap(); |
1199 } | 1199 } |
1200 #endif | 1200 #endif |
OLD | NEW |