| 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 "core/fxge/include/fx_ge.h" | 7 #include "core/fxge/include/fx_ge.h" |
| 8 | 8 |
| 9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ | 9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 top - pSrcRect->top, pSource->GetWidth(), | 79 top - pSrcRect->top, pSource->GetWidth(), |
| 80 pSource->GetHeight(), &clip_rect, 0, | 80 pSource->GetHeight(), &clip_rect, 0, |
| 81 FXDIB_BLEND_NORMAL); | 81 FXDIB_BLEND_NORMAL); |
| 82 } | 82 } |
| 83 ASSERT(pSource && !pSource->IsAlphaMask() && pSrcRect); | 83 ASSERT(pSource && !pSource->IsAlphaMask() && pSrcRect); |
| 84 ASSERT(blend_type == FXDIB_BLEND_NORMAL); | 84 ASSERT(blend_type == FXDIB_BLEND_NORMAL); |
| 85 if (pSource->HasAlpha()) | 85 if (pSource->HasAlpha()) |
| 86 return FALSE; | 86 return FALSE; |
| 87 | 87 |
| 88 CFX_DIBExtractor temp(pSource); | 88 CFX_DIBExtractor temp(pSource); |
| 89 CFX_DIBitmap* pBitmap = temp; | 89 CFX_DIBitmap* pBitmap = temp.GetBitmap(); |
| 90 if (!pBitmap) | 90 if (!pBitmap) |
| 91 return FALSE; | 91 return FALSE; |
| 92 | 92 |
| 93 return GDI_SetDIBits(pBitmap, pSrcRect, left, top); | 93 return GDI_SetDIBits(pBitmap, pSrcRect, left, top); |
| 94 } | 94 } |
| 95 | 95 |
| 96 FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource, | 96 FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource, |
| 97 uint32_t color, | 97 uint32_t color, |
| 98 int dest_left, | 98 int dest_left, |
| 99 int dest_top, | 99 int dest_top, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 117 dest_left += dest_width; | 117 dest_left += dest_width; |
| 118 if (dest_height < 0) | 118 if (dest_height < 0) |
| 119 dest_top += dest_height; | 119 dest_top += dest_height; |
| 120 | 120 |
| 121 return GDI_StretchBitMask(pFlipped.get(), dest_left, dest_top, | 121 return GDI_StretchBitMask(pFlipped.get(), dest_left, dest_top, |
| 122 abs(dest_width), abs(dest_height), color, | 122 abs(dest_width), abs(dest_height), color, |
| 123 flags); | 123 flags); |
| 124 } | 124 } |
| 125 | 125 |
| 126 CFX_DIBExtractor temp(pSource); | 126 CFX_DIBExtractor temp(pSource); |
| 127 CFX_DIBitmap* pBitmap = temp; | 127 CFX_DIBitmap* pBitmap = temp.GetBitmap(); |
| 128 if (!pBitmap) | 128 if (!pBitmap) |
| 129 return FALSE; | 129 return FALSE; |
| 130 return GDI_StretchBitMask(pBitmap, dest_left, dest_top, dest_width, | 130 return GDI_StretchBitMask(pBitmap, dest_left, dest_top, dest_width, |
| 131 dest_height, color, flags); | 131 dest_height, color, flags); |
| 132 } | 132 } |
| 133 | 133 |
| 134 if (pSource->HasAlpha()) | 134 if (pSource->HasAlpha()) |
| 135 return FALSE; | 135 return FALSE; |
| 136 | 136 |
| 137 if (dest_width < 0 || dest_height < 0) { | 137 if (dest_width < 0 || dest_height < 0) { |
| 138 std::unique_ptr<CFX_DIBitmap> pFlipped( | 138 std::unique_ptr<CFX_DIBitmap> pFlipped( |
| 139 pSource->FlipImage(dest_width < 0, dest_height < 0)); | 139 pSource->FlipImage(dest_width < 0, dest_height < 0)); |
| 140 if (!pFlipped) | 140 if (!pFlipped) |
| 141 return FALSE; | 141 return FALSE; |
| 142 | 142 |
| 143 if (dest_width < 0) | 143 if (dest_width < 0) |
| 144 dest_left += dest_width; | 144 dest_left += dest_width; |
| 145 if (dest_height < 0) | 145 if (dest_height < 0) |
| 146 dest_top += dest_height; | 146 dest_top += dest_height; |
| 147 | 147 |
| 148 return GDI_StretchDIBits(pFlipped.get(), dest_left, dest_top, | 148 return GDI_StretchDIBits(pFlipped.get(), dest_left, dest_top, |
| 149 abs(dest_width), abs(dest_height), flags); | 149 abs(dest_width), abs(dest_height), flags); |
| 150 } | 150 } |
| 151 | 151 |
| 152 CFX_DIBExtractor temp(pSource); | 152 CFX_DIBExtractor temp(pSource); |
| 153 CFX_DIBitmap* pBitmap = temp; | 153 CFX_DIBitmap* pBitmap = temp.GetBitmap(); |
| 154 if (!pBitmap) | 154 if (!pBitmap) |
| 155 return FALSE; | 155 return FALSE; |
| 156 return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, | 156 return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, |
| 157 dest_height, flags); | 157 dest_height, flags); |
| 158 } | 158 } |
| 159 | 159 |
| 160 FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, | 160 FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, |
| 161 int bitmap_alpha, | 161 int bitmap_alpha, |
| 162 uint32_t color, | 162 uint32_t color, |
| 163 const CFX_Matrix* pMatrix, | 163 const CFX_Matrix* pMatrix, |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 // Try to get the font and draw again. | 309 // Try to get the font and draw again. |
| 310 g_pdfium_typeface_accessible_func(&lf, wsText.c_str(), nChars); | 310 g_pdfium_typeface_accessible_func(&lf, wsText.c_str(), nChars); |
| 311 return ExtTextOutW(m_hDC, 0, 0, ETO_GLYPH_INDEX, nullptr, wsText.c_str(), | 311 return ExtTextOutW(m_hDC, 0, 0, ETO_GLYPH_INDEX, nullptr, wsText.c_str(), |
| 312 nChars, nullptr); | 312 nChars, nullptr); |
| 313 #else | 313 #else |
| 314 return FALSE; | 314 return FALSE; |
| 315 #endif | 315 #endif |
| 316 } | 316 } |
| 317 | 317 |
| 318 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ | 318 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ |
| OLD | NEW |