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 "../../../include/fxge/fx_ge_win32.h" | 10 #include "../../../include/fxge/fx_ge_win32.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 FX_BOOL ret = GDI_StretchBitMask(pFlipped, dest_left, dest_top, abs(
dest_width), abs(dest_height), color, flags, alpha_flag, pIccTransform); | 73 FX_BOOL ret = GDI_StretchBitMask(pFlipped, dest_left, dest_top, abs(
dest_width), abs(dest_height), color, flags, alpha_flag, pIccTransform); |
74 delete pFlipped; | 74 delete pFlipped; |
75 return ret; | 75 return ret; |
76 } | 76 } |
77 CFX_DIBExtractor temp(pSource); | 77 CFX_DIBExtractor temp(pSource); |
78 CFX_DIBitmap* pBitmap = temp; | 78 CFX_DIBitmap* pBitmap = temp; |
79 if (pBitmap == NULL) { | 79 if (pBitmap == NULL) { |
80 return FALSE; | 80 return FALSE; |
81 } | 81 } |
82 return GDI_StretchBitMask(pBitmap, dest_left, dest_top, dest_width, dest
_height, color, flags, alpha_flag, pIccTransform); | 82 return GDI_StretchBitMask(pBitmap, dest_left, dest_top, dest_width, dest
_height, color, flags, alpha_flag, pIccTransform); |
83 } else { | 83 } |
84 ASSERT(pSource != NULL); | 84 if (pSource->HasAlpha()) { |
85 if (pSource->HasAlpha()) { | 85 return FALSE; |
| 86 } |
| 87 if (dest_width < 0 || dest_height < 0) { |
| 88 CFX_DIBitmap* pFlipped = pSource->FlipImage(dest_width < 0, dest_height
< 0); |
| 89 if (pFlipped == NULL) { |
86 return FALSE; | 90 return FALSE; |
87 } | 91 } |
88 if (dest_width < 0 || dest_height < 0) { | 92 if (dest_width < 0) { |
89 CFX_DIBitmap* pFlipped = pSource->FlipImage(dest_width < 0, dest_hei
ght < 0); | 93 dest_left += dest_width; |
90 if (pFlipped == NULL) { | |
91 return FALSE; | |
92 } | |
93 if (dest_width < 0) { | |
94 dest_left += dest_width; | |
95 } | |
96 if (dest_height < 0) { | |
97 dest_top += dest_height; | |
98 } | |
99 FX_BOOL ret = GDI_StretchDIBits(pFlipped, dest_left, dest_top, abs(d
est_width), abs(dest_height), flags, pIccTransform); | |
100 delete pFlipped; | |
101 return ret; | |
102 } | 94 } |
103 CFX_DIBExtractor temp(pSource); | 95 if (dest_height < 0) { |
104 CFX_DIBitmap* pBitmap = temp; | 96 dest_top += dest_height; |
105 if (pBitmap == NULL) { | |
106 return FALSE; | |
107 } | 97 } |
108 return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_
height, flags, pIccTransform); | 98 FX_BOOL ret = GDI_StretchDIBits(pFlipped, dest_left, dest_top, abs(dest_
width), abs(dest_height), flags, pIccTransform); |
| 99 delete pFlipped; |
| 100 return ret; |
109 } | 101 } |
| 102 CFX_DIBExtractor temp(pSource); |
| 103 CFX_DIBitmap* pBitmap = temp; |
| 104 if (pBitmap == NULL) { |
| 105 return FALSE; |
| 106 } |
| 107 return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_heig
ht, flags, pIccTransform); |
110 } | 108 } |
111 static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, const CFX_Af
fineMatrix* pDestMatrix) | 109 static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, const CFX_Af
fineMatrix* pDestMatrix) |
112 { | 110 { |
113 ASSERT(pSrc->GetFormat() == FXDIB_1bppRgb || pSrc->GetFormat() == FXDIB_1bpp
Mask || pSrc->GetFormat() == FXDIB_1bppCmyk); | 111 ASSERT(pSrc->GetFormat() == FXDIB_1bppRgb || pSrc->GetFormat() == FXDIB_1bpp
Mask || pSrc->GetFormat() == FXDIB_1bppCmyk); |
114 CFX_FloatRect unit_rect = pDestMatrix->GetUnitRect(); | 112 CFX_FloatRect unit_rect = pDestMatrix->GetUnitRect(); |
115 FX_RECT full_rect = unit_rect.GetOutterRect(); | 113 FX_RECT full_rect = unit_rect.GetOutterRect(); |
116 int full_left = full_rect.left; | 114 int full_left = full_rect.left; |
117 int full_top = full_rect.top; | 115 int full_top = full_rect.top; |
118 CFX_DIBExtractor src_bitmap(pSrc); | 116 CFX_DIBExtractor src_bitmap(pSrc); |
119 CFX_DIBitmap* pSrcBitmap = src_bitmap; | 117 CFX_DIBitmap* pSrcBitmap = src_bitmap; |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 handle = NULL; | 410 handle = NULL; |
413 return m_PSRenderer.DrawDIBits(pBitmap, color, pMatrix, render_flags, alpha_
flag, pIccTransform); | 411 return m_PSRenderer.DrawDIBits(pBitmap, color, pMatrix, render_flags, alpha_
flag, pIccTransform); |
414 } | 412 } |
415 FX_BOOL CPSPrinterDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pChar
Pos, CFX_Font* pFont, | 413 FX_BOOL CPSPrinterDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pChar
Pos, CFX_Font* pFont, |
416 CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT
font_size, FX_DWORD color, | 414 CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT
font_size, FX_DWORD color, |
417 int alpha_flag, void* pIccTransform) | 415 int alpha_flag, void* pIccTransform) |
418 { | 416 { |
419 return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device
, font_size, color, alpha_flag, pIccTransform); | 417 return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device
, font_size, color, alpha_flag, pIccTransform); |
420 } | 418 } |
421 #endif | 419 #endif |
OLD | NEW |