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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 { | 516 { |
517 CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; | 517 CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; |
518 if (pBitmap == NULL) { | 518 if (pBitmap == NULL) { |
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 (abs(dest_width) * abs(dest_height) < pBitmap1->GetWidth() * pBitmap1->Ge
tHeight() * 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); |
529 } else { | 529 } else { |
530 SetStretchBltMode(m_hDC, COLORONCOLOR); | 530 SetStretchBltMode(m_hDC, COLORONCOLOR); |
531 } | 531 } |
532 CFX_DIBitmap* pToStrechBitmap = pBitmap; | 532 CFX_DIBitmap* pToStrechBitmap = pBitmap; |
533 bool del = false; | 533 bool del = false; |
534 if (m_DeviceClass == FXDC_PRINTER && (pBitmap->GetWidth() * pBitmap->GetHeig
ht() > abs(dest_width) * abs(dest_height))) { | 534 if (m_DeviceClass == FXDC_PRINTER && ((FX_INT64)pBitmap->GetWidth() * pBitma
p->GetHeight() > (FX_INT64)abs(dest_width) * abs(dest_height))) { |
535 pToStrechBitmap = pBitmap->StretchTo(dest_width, dest_height); | 535 pToStrechBitmap = pBitmap->StretchTo(dest_width, dest_height); |
536 del = true; | 536 del = true; |
537 } | 537 } |
538 CFX_ByteString toStrechBitmapInfo = CFX_WindowsDIB::GetBitmapInfo(pToStrechB
itmap); | 538 CFX_ByteString toStrechBitmapInfo = CFX_WindowsDIB::GetBitmapInfo(pToStrechB
itmap); |
539 ::StretchDIBits(m_hDC, dest_left, dest_top, dest_width, dest_height, | 539 ::StretchDIBits(m_hDC, dest_left, dest_top, dest_width, dest_height, |
540 0, 0, pToStrechBitmap->GetWidth(), pToStrechBitmap->GetHeigh
t(), pToStrechBitmap->GetBuffer(), | 540 0, 0, pToStrechBitmap->GetWidth(), pToStrechBitmap->GetHeigh
t(), pToStrechBitmap->GetBuffer(), |
541 (BITMAPINFO*)(FX_LPCSTR)toStrechBitmapInfo, DIB_RGB_COLORS,
SRCCOPY); | 541 (BITMAPINFO*)(FX_LPCSTR)toStrechBitmapInfo, DIB_RGB_COLORS,
SRCCOPY); |
542 if (del) { | 542 if (del) { |
543 delete pToStrechBitmap; | 543 delete pToStrechBitmap; |
544 } | 544 } |
(...skipping 646 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 |