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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, | 131 return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, |
132 dest_height, flags, pIccTransform); | 132 dest_height, flags, pIccTransform); |
133 } | 133 } |
134 static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, | 134 static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, |
135 const CFX_AffineMatrix* pDestMatrix) { | 135 const CFX_AffineMatrix* pDestMatrix) { |
136 ASSERT(pSrc->GetFormat() == FXDIB_1bppRgb || | 136 ASSERT(pSrc->GetFormat() == FXDIB_1bppRgb || |
137 pSrc->GetFormat() == FXDIB_1bppMask || | 137 pSrc->GetFormat() == FXDIB_1bppMask || |
138 pSrc->GetFormat() == FXDIB_1bppCmyk); | 138 pSrc->GetFormat() == FXDIB_1bppCmyk); |
139 CFX_FloatRect unit_rect = pDestMatrix->GetUnitRect(); | 139 CFX_FloatRect unit_rect = pDestMatrix->GetUnitRect(); |
140 FX_RECT full_rect = unit_rect.GetOutterRect(); | 140 FX_RECT full_rect = unit_rect.GetOutterRect(); |
141 int full_left = full_rect.left; | |
142 int full_top = full_rect.top; | |
143 CFX_DIBExtractor src_bitmap(pSrc); | 141 CFX_DIBExtractor src_bitmap(pSrc); |
144 CFX_DIBitmap* pSrcBitmap = src_bitmap; | 142 CFX_DIBitmap* pSrcBitmap = src_bitmap; |
145 if (pSrcBitmap == NULL) { | 143 if (pSrcBitmap == NULL) { |
146 return NULL; | 144 return NULL; |
147 } | 145 } |
148 int src_width = pSrcBitmap->GetWidth(), src_height = pSrcBitmap->GetHeight(); | 146 int src_width = pSrcBitmap->GetWidth(), src_height = pSrcBitmap->GetHeight(); |
149 uint8_t* src_buf = pSrcBitmap->GetBuffer(); | 147 uint8_t* src_buf = pSrcBitmap->GetBuffer(); |
150 FX_DWORD src_pitch = pSrcBitmap->GetPitch(); | 148 FX_DWORD src_pitch = pSrcBitmap->GetPitch(); |
151 FX_FLOAT dest_area = pDestMatrix->GetUnitArea(); | 149 FX_FLOAT dest_area = pDestMatrix->GetUnitArea(); |
152 FX_FLOAT area_scale = | 150 FX_FLOAT area_scale = |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 288 } |
291 void CPSOutput::OutputPS(const FX_CHAR* string, int len) { | 289 void CPSOutput::OutputPS(const FX_CHAR* string, int len) { |
292 if (len < 0) { | 290 if (len < 0) { |
293 len = (int)FXSYS_strlen(string); | 291 len = (int)FXSYS_strlen(string); |
294 } | 292 } |
295 int sent_len = 0; | 293 int sent_len = 0; |
296 while (len > 0) { | 294 while (len > 0) { |
297 int send_len = len > 1024 ? 1024 : len; | 295 int send_len = len > 1024 ? 1024 : len; |
298 *(FX_WORD*)m_pBuf = send_len; | 296 *(FX_WORD*)m_pBuf = send_len; |
299 FXSYS_memcpy(m_pBuf + 2, string + sent_len, send_len); | 297 FXSYS_memcpy(m_pBuf + 2, string + sent_len, send_len); |
300 int ret = ExtEscape(m_hDC, PASSTHROUGH, send_len + 2, m_pBuf, 0, NULL); | 298 ExtEscape(m_hDC, PASSTHROUGH, send_len + 2, m_pBuf, 0, NULL); |
301 sent_len += send_len; | 299 sent_len += send_len; |
302 len -= send_len; | 300 len -= send_len; |
303 } | 301 } |
304 } | 302 } |
305 CPSPrinterDriver::CPSPrinterDriver() { | 303 CPSPrinterDriver::CPSPrinterDriver() { |
306 m_pPSOutput = NULL; | 304 m_pPSOutput = NULL; |
307 m_bCmykOutput = FALSE; | 305 m_bCmykOutput = FALSE; |
308 } | 306 } |
309 CPSPrinterDriver::~CPSPrinterDriver() { | 307 CPSPrinterDriver::~CPSPrinterDriver() { |
310 EndRendering(); | 308 EndRendering(); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 CFX_FontCache* pCache, | 464 CFX_FontCache* pCache, |
467 const CFX_AffineMatrix* pObject2Device, | 465 const CFX_AffineMatrix* pObject2Device, |
468 FX_FLOAT font_size, | 466 FX_FLOAT font_size, |
469 FX_DWORD color, | 467 FX_DWORD color, |
470 int alpha_flag, | 468 int alpha_flag, |
471 void* pIccTransform) { | 469 void* pIccTransform) { |
472 return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device, | 470 return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device, |
473 font_size, color, alpha_flag, pIccTransform); | 471 font_size, color, alpha_flag, pIccTransform); |
474 } | 472 } |
475 #endif | 473 #endif |
OLD | NEW |