| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 src2result.b = adjusted_matrix.b / pSrcBitmap->GetWidth(); | 163 src2result.b = adjusted_matrix.b / pSrcBitmap->GetWidth(); |
| 164 src2result.c = -adjusted_matrix.c / pSrcBitmap->GetHeight(); | 164 src2result.c = -adjusted_matrix.c / pSrcBitmap->GetHeight(); |
| 165 src2result.d = -adjusted_matrix.d / pSrcBitmap->GetHeight(); | 165 src2result.d = -adjusted_matrix.d / pSrcBitmap->GetHeight(); |
| 166 src2result.TranslateI(-result_rect.left, -result_rect.top); | 166 src2result.TranslateI(-result_rect.left, -result_rect.top); |
| 167 CFX_AffineMatrix result2src; | 167 CFX_AffineMatrix result2src; |
| 168 result2src.SetReverse(src2result); | 168 result2src.SetReverse(src2result); |
| 169 CPDF_FixedMatrix result2src_fix(result2src, 8); | 169 CPDF_FixedMatrix result2src_fix(result2src, 8); |
| 170 int result_width = result_rect.Width(); | 170 int result_width = result_rect.Width(); |
| 171 int result_height = result_rect.Height(); | 171 int result_height = result_rect.Height(); |
| 172 CFX_DIBitmap* pTempBitmap = new CFX_DIBitmap; | 172 CFX_DIBitmap* pTempBitmap = new CFX_DIBitmap; |
| 173 if (!pTempBitmap) { | |
| 174 if (pSrcBitmap != src_bitmap) { | |
| 175 delete pSrcBitmap; | |
| 176 } | |
| 177 return NULL; | |
| 178 } | |
| 179 if (!pTempBitmap->Create(result_width, result_height, pSrc->GetFormat())) { | 173 if (!pTempBitmap->Create(result_width, result_height, pSrc->GetFormat())) { |
| 180 delete pTempBitmap; | 174 delete pTempBitmap; |
| 181 if (pSrcBitmap != src_bitmap) { | 175 if (pSrcBitmap != src_bitmap) { |
| 182 delete pSrcBitmap; | 176 delete pSrcBitmap; |
| 183 } | 177 } |
| 184 return NULL; | 178 return NULL; |
| 185 } | 179 } |
| 186 pTempBitmap->CopyPalette(pSrc->GetPalette()); | 180 pTempBitmap->CopyPalette(pSrc->GetPalette()); |
| 187 uint8_t* dest_buf = pTempBitmap->GetBuffer(); | 181 uint8_t* dest_buf = pTempBitmap->GetBuffer(); |
| 188 int dest_pitch = pTempBitmap->GetPitch(); | 182 int dest_pitch = pTempBitmap->GetPitch(); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 delete m_pPSOutput; | 311 delete m_pPSOutput; |
| 318 } | 312 } |
| 319 FX_BOOL CPSPrinterDriver::Init(HDC hDC, int pslevel, FX_BOOL bCmykOutput) { | 313 FX_BOOL CPSPrinterDriver::Init(HDC hDC, int pslevel, FX_BOOL bCmykOutput) { |
| 320 m_hDC = hDC; | 314 m_hDC = hDC; |
| 321 m_HorzSize = ::GetDeviceCaps(m_hDC, HORZSIZE); | 315 m_HorzSize = ::GetDeviceCaps(m_hDC, HORZSIZE); |
| 322 m_VertSize = ::GetDeviceCaps(m_hDC, VERTSIZE); | 316 m_VertSize = ::GetDeviceCaps(m_hDC, VERTSIZE); |
| 323 m_Width = ::GetDeviceCaps(m_hDC, HORZRES); | 317 m_Width = ::GetDeviceCaps(m_hDC, HORZRES); |
| 324 m_Height = ::GetDeviceCaps(m_hDC, VERTRES); | 318 m_Height = ::GetDeviceCaps(m_hDC, VERTRES); |
| 325 m_nBitsPerPixel = ::GetDeviceCaps(m_hDC, BITSPIXEL); | 319 m_nBitsPerPixel = ::GetDeviceCaps(m_hDC, BITSPIXEL); |
| 326 m_pPSOutput = new CPSOutput(hDC); | 320 m_pPSOutput = new CPSOutput(hDC); |
| 327 if (!m_pPSOutput) { | |
| 328 return FALSE; | |
| 329 } | |
| 330 ((CPSOutput*)m_pPSOutput)->Init(); | 321 ((CPSOutput*)m_pPSOutput)->Init(); |
| 331 m_PSRenderer.Init(m_pPSOutput, pslevel, m_Width, m_Height, bCmykOutput); | 322 m_PSRenderer.Init(m_pPSOutput, pslevel, m_Width, m_Height, bCmykOutput); |
| 332 m_bCmykOutput = bCmykOutput; | 323 m_bCmykOutput = bCmykOutput; |
| 333 HRGN hRgn = ::CreateRectRgn(0, 0, 1, 1); | 324 HRGN hRgn = ::CreateRectRgn(0, 0, 1, 1); |
| 334 int ret = ::GetClipRgn(hDC, hRgn); | 325 int ret = ::GetClipRgn(hDC, hRgn); |
| 335 if (ret == 1) { | 326 if (ret == 1) { |
| 336 ret = ::GetRegionData(hRgn, 0, NULL); | 327 ret = ::GetRegionData(hRgn, 0, NULL); |
| 337 if (ret) { | 328 if (ret) { |
| 338 RGNDATA* pData = (RGNDATA*)FX_Alloc(uint8_t, ret); | 329 RGNDATA* pData = (RGNDATA*)FX_Alloc(uint8_t, ret); |
| 339 ret = ::GetRegionData(hRgn, ret, pData); | 330 ret = ::GetRegionData(hRgn, ret, pData); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 CFX_FontCache* pCache, | 466 CFX_FontCache* pCache, |
| 476 const CFX_AffineMatrix* pObject2Device, | 467 const CFX_AffineMatrix* pObject2Device, |
| 477 FX_FLOAT font_size, | 468 FX_FLOAT font_size, |
| 478 FX_DWORD color, | 469 FX_DWORD color, |
| 479 int alpha_flag, | 470 int alpha_flag, |
| 480 void* pIccTransform) { | 471 void* pIccTransform) { |
| 481 return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device, | 472 return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device, |
| 482 font_size, color, alpha_flag, pIccTransform); | 473 font_size, color, alpha_flag, pIccTransform); |
| 483 } | 474 } |
| 484 #endif | 475 #endif |
| OLD | NEW |