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" |
11 #include "win32_int.h" | 11 #include "win32_int.h" |
12 #include "../../../include/fxge/fx_freetype.h" | 12 #include "../../../include/fxge/fx_freetype.h" |
13 #include "../ge/text_int.h" | 13 #include "../ge/text_int.h" |
14 #include "../dib/dib_int.h" | 14 #include "../dib/dib_int.h" |
15 #define SIZETHRESHOLD 1000 | 15 #define SIZETHRESHOLD 1000 |
16 #define OUTPUTPSLEN 4096 | 16 #define OUTPUTPSLEN 4096 |
17 CGdiPrinterDriver::CGdiPrinterDriver(HDC hDC) : CGdiDeviceDriver(hDC, FXDC_PRINT
ER) | 17 CGdiPrinterDriver::CGdiPrinterDriver(HDC hDC) : CGdiDeviceDriver(hDC, FXDC_PRINT
ER) |
18 { | 18 { |
19 m_HorzSize = ::GetDeviceCaps(m_hDC, HORZSIZE); | 19 m_HorzSize = ::GetDeviceCaps(m_hDC, HORZSIZE); |
20 m_VertSize = ::GetDeviceCaps(m_hDC, VERTSIZE); | 20 m_VertSize = ::GetDeviceCaps(m_hDC, VERTSIZE); |
21 m_bSupportROP = TRUE; | 21 m_bSupportROP = true; |
22 } | 22 } |
23 int CGdiPrinterDriver::GetDeviceCaps(int caps_id) | 23 int CGdiPrinterDriver::GetDeviceCaps(int caps_id) |
24 { | 24 { |
25 if (caps_id == FXDC_HORZ_SIZE) { | 25 if (caps_id == FXDC_HORZ_SIZE) { |
26 return m_HorzSize; | 26 return m_HorzSize; |
27 } | 27 } |
28 if (caps_id == FXDC_VERT_SIZE) { | 28 if (caps_id == FXDC_VERT_SIZE) { |
29 return m_VertSize; | 29 return m_VertSize; |
30 } | 30 } |
31 return CGdiDeviceDriver::GetDeviceCaps(caps_id); | 31 return CGdiDeviceDriver::GetDeviceCaps(caps_id); |
32 } | 32 } |
33 FX_BOOL CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD colo
r, const FX_RECT* pSrcRect, int left, int top, int blend_type, | 33 bool CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD color,
const FX_RECT* pSrcRect, int left, int top, int blend_type, |
34 int alpha_flag, void* pIccTransform) | 34 int alpha_flag, void* pIccTransform) |
35 { | 35 { |
36 if (pSource->IsAlphaMask()) { | 36 if (pSource->IsAlphaMask()) { |
37 FX_RECT clip_rect(left, top, left + pSrcRect->Width(), top + pSrcRect->H
eight()); | 37 FX_RECT clip_rect(left, top, left + pSrcRect->Width(), top + pSrcRect->H
eight()); |
38 return StretchDIBits(pSource, color, left - pSrcRect->left, top - pSrcRe
ct->top, pSource->GetWidth(), pSource->GetHeight(), | 38 return StretchDIBits(pSource, color, left - pSrcRect->left, top - pSrcRe
ct->top, pSource->GetWidth(), pSource->GetHeight(), |
39 &clip_rect, 0, alpha_flag, pIccTransform, FXDIB_BLE
ND_NORMAL); | 39 &clip_rect, 0, alpha_flag, pIccTransform, FXDIB_BLE
ND_NORMAL); |
40 } | 40 } |
41 ASSERT(pSource != NULL && !pSource->IsAlphaMask() && pSrcRect != NULL); | 41 ASSERT(pSource != NULL && !pSource->IsAlphaMask() && pSrcRect != NULL); |
42 ASSERT(blend_type == FXDIB_BLEND_NORMAL); | 42 ASSERT(blend_type == FXDIB_BLEND_NORMAL); |
43 if (pSource->HasAlpha()) { | 43 if (pSource->HasAlpha()) { |
44 return FALSE; | 44 return false; |
45 } | 45 } |
46 CFX_DIBExtractor temp(pSource); | 46 CFX_DIBExtractor temp(pSource); |
47 CFX_DIBitmap* pBitmap = temp; | 47 CFX_DIBitmap* pBitmap = temp; |
48 if (pBitmap == NULL) { | 48 if (pBitmap == NULL) { |
49 return FALSE; | 49 return false; |
50 } | 50 } |
51 return GDI_SetDIBits(pBitmap, pSrcRect, left, top, pIccTransform); | 51 return GDI_SetDIBits(pBitmap, pSrcRect, left, top, pIccTransform); |
52 } | 52 } |
53 FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD
color, int dest_left, int dest_top, | 53 bool CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD col
or, int dest_left, int dest_top, |
54 int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flag
s, | 54 int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flag
s, |
55 int alpha_flag, void* pIccTransform, int blend_type) | 55 int alpha_flag, void* pIccTransform, int blend_type) |
56 { | 56 { |
57 if (pSource->IsAlphaMask()) { | 57 if (pSource->IsAlphaMask()) { |
58 int alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_FILL(alpha
_flag) : FXARGB_A(color); | 58 int alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_FILL(alpha
_flag) : FXARGB_A(color); |
59 if (pSource->GetBPP() != 1 || alpha != 255 || !m_bSupportROP) { | 59 if (pSource->GetBPP() != 1 || alpha != 255 || !m_bSupportROP) { |
60 return FALSE; | 60 return false; |
61 } | 61 } |
62 if (dest_width < 0 || dest_height < 0) { | 62 if (dest_width < 0 || dest_height < 0) { |
63 CFX_DIBitmap* pFlipped = pSource->FlipImage(dest_width < 0, dest_hei
ght < 0); | 63 CFX_DIBitmap* pFlipped = pSource->FlipImage(dest_width < 0, dest_hei
ght < 0); |
64 if (pFlipped == NULL) { | 64 if (pFlipped == NULL) { |
65 return FALSE; | 65 return false; |
66 } | 66 } |
67 if (dest_width < 0) { | 67 if (dest_width < 0) { |
68 dest_left += dest_width; | 68 dest_left += dest_width; |
69 } | 69 } |
70 if (dest_height < 0) { | 70 if (dest_height < 0) { |
71 dest_top += dest_height; | 71 dest_top += dest_height; |
72 } | 72 } |
73 FX_BOOL ret = GDI_StretchBitMask(pFlipped, dest_left, dest_top, abs(
dest_width), abs(dest_height), color, flags, alpha_flag, pIccTransform); | 73 bool ret = GDI_StretchBitMask(pFlipped, dest_left, dest_top, abs(des
t_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 } | 83 } |
84 if (pSource->HasAlpha()) { | 84 if (pSource->HasAlpha()) { |
85 return FALSE; | 85 return false; |
86 } | 86 } |
87 if (dest_width < 0 || dest_height < 0) { | 87 if (dest_width < 0 || dest_height < 0) { |
88 CFX_DIBitmap* pFlipped = pSource->FlipImage(dest_width < 0, dest_height
< 0); | 88 CFX_DIBitmap* pFlipped = pSource->FlipImage(dest_width < 0, dest_height
< 0); |
89 if (pFlipped == NULL) { | 89 if (pFlipped == NULL) { |
90 return FALSE; | 90 return false; |
91 } | 91 } |
92 if (dest_width < 0) { | 92 if (dest_width < 0) { |
93 dest_left += dest_width; | 93 dest_left += dest_width; |
94 } | 94 } |
95 if (dest_height < 0) { | 95 if (dest_height < 0) { |
96 dest_top += dest_height; | 96 dest_top += dest_height; |
97 } | 97 } |
98 FX_BOOL ret = GDI_StretchDIBits(pFlipped, dest_left, dest_top, abs(dest_
width), abs(dest_height), flags, pIccTransform); | 98 bool ret = GDI_StretchDIBits(pFlipped, dest_left, dest_top, abs(dest_wid
th), abs(dest_height), flags, pIccTransform); |
99 delete pFlipped; | 99 delete pFlipped; |
100 return ret; | 100 return ret; |
101 } | 101 } |
102 CFX_DIBExtractor temp(pSource); | 102 CFX_DIBExtractor temp(pSource); |
103 CFX_DIBitmap* pBitmap = temp; | 103 CFX_DIBitmap* pBitmap = temp; |
104 if (pBitmap == NULL) { | 104 if (pBitmap == NULL) { |
105 return FALSE; | 105 return false; |
106 } | 106 } |
107 return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_heig
ht, flags, pIccTransform); | 107 return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_heig
ht, flags, pIccTransform); |
108 } | 108 } |
109 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) |
110 { | 110 { |
111 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); |
112 CFX_FloatRect unit_rect = pDestMatrix->GetUnitRect(); | 112 CFX_FloatRect unit_rect = pDestMatrix->GetUnitRect(); |
113 FX_RECT full_rect = unit_rect.GetOutterRect(); | 113 FX_RECT full_rect = unit_rect.GetOutterRect(); |
114 int full_left = full_rect.left; | 114 int full_left = full_rect.left; |
115 int full_top = full_rect.top; | 115 int full_top = full_rect.top; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 dest_scan[dest_x / 8] &= ~(1 << (7 - dest_x % 8)); | 183 dest_scan[dest_x / 8] &= ~(1 << (7 - dest_x % 8)); |
184 } | 184 } |
185 } | 185 } |
186 } | 186 } |
187 if (pSrcBitmap != src_bitmap) { | 187 if (pSrcBitmap != src_bitmap) { |
188 delete pSrcBitmap; | 188 delete pSrcBitmap; |
189 } | 189 } |
190 return pTempBitmap; | 190 return pTempBitmap; |
191 } | 191 } |
192 FX_BOOL»CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_
alpha, FX_DWORD color, | 192 bool» CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_
alpha, FX_DWORD color, |
193 const CFX_AffineMatrix* pMatrix, FX_DWORD
render_flags, void*& handle, | 193 const CFX_AffineMatrix* pMatrix, FX_DWORD
render_flags, void*& handle, |
194 int alpha_flag, void* pIccTransform, int
blend_type) | 194 int alpha_flag, void* pIccTransform, int
blend_type) |
195 { | 195 { |
196 if (bitmap_alpha < 255 || pSource->HasAlpha() || (pSource->IsAlphaMask() &&
(pSource->GetBPP() != 1 || !m_bSupportROP))) { | 196 if (bitmap_alpha < 255 || pSource->HasAlpha() || (pSource->IsAlphaMask() &&
(pSource->GetBPP() != 1 || !m_bSupportROP))) { |
197 return FALSE; | 197 return false; |
198 } | 198 } |
199 CFX_FloatRect unit_rect = pMatrix->GetUnitRect(); | 199 CFX_FloatRect unit_rect = pMatrix->GetUnitRect(); |
200 FX_RECT full_rect = unit_rect.GetOutterRect(); | 200 FX_RECT full_rect = unit_rect.GetOutterRect(); |
201 if (FXSYS_fabs(pMatrix->b) < 0.5f && pMatrix->a != 0 && FXSYS_fabs(pMatrix->
c) < 0.5f && pMatrix->d != 0) { | 201 if (FXSYS_fabs(pMatrix->b) < 0.5f && pMatrix->a != 0 && FXSYS_fabs(pMatrix->
c) < 0.5f && pMatrix->d != 0) { |
202 FX_BOOL bFlipX = pMatrix->a < 0; | 202 bool bFlipX = pMatrix->a < 0; |
203 FX_BOOL bFlipY = pMatrix->d > 0; | 203 bool bFlipY = pMatrix->d > 0; |
204 return StretchDIBits(pSource, color, bFlipX ? full_rect.right : full_rec
t.left, bFlipY ? full_rect.bottom : full_rect.top, | 204 return StretchDIBits(pSource, color, bFlipX ? full_rect.right : full_rec
t.left, bFlipY ? full_rect.bottom : full_rect.top, |
205 bFlipX ? -full_rect.Width() : full_rect.Width(), bF
lipY ? -full_rect.Height() : full_rect.Height(), NULL, 0, | 205 bFlipX ? -full_rect.Width() : full_rect.Width(), bF
lipY ? -full_rect.Height() : full_rect.Height(), NULL, 0, |
206 alpha_flag, pIccTransform, blend_type); | 206 alpha_flag, pIccTransform, blend_type); |
207 } | 207 } |
208 if (FXSYS_fabs(pMatrix->a) < 0.5f && FXSYS_fabs(pMatrix->d) < 0.5f) { | 208 if (FXSYS_fabs(pMatrix->a) < 0.5f && FXSYS_fabs(pMatrix->d) < 0.5f) { |
209 CFX_DIBitmap* pTransformed = pSource->SwapXY(pMatrix->c > 0, pMatrix->b
< 0); | 209 CFX_DIBitmap* pTransformed = pSource->SwapXY(pMatrix->c > 0, pMatrix->b
< 0); |
210 if (pTransformed == NULL) { | 210 if (pTransformed == NULL) { |
211 return FALSE; | 211 return false; |
212 } | 212 } |
213 FX_BOOL ret = StretchDIBits(pTransformed, color, full_rect.left, full_re
ct.top, full_rect.Width(), full_rect.Height(), NULL, 0, | 213 bool ret = StretchDIBits(pTransformed, color, full_rect.left, full_rect.
top, full_rect.Width(), full_rect.Height(), NULL, 0, |
214 alpha_flag, pIccTransform, blend_type); | 214 alpha_flag, pIccTransform, blend_type); |
215 delete pTransformed; | 215 delete pTransformed; |
216 return ret; | 216 return ret; |
217 } | 217 } |
218 if (pSource->GetBPP() == 1) { | 218 if (pSource->GetBPP() == 1) { |
219 CFX_DIBitmap* pTransformed = Transform1bppBitmap(pSource, pMatrix); | 219 CFX_DIBitmap* pTransformed = Transform1bppBitmap(pSource, pMatrix); |
220 if (pIccTransform == NULL) { | 220 if (pIccTransform == NULL) { |
221 return FALSE; | 221 return false; |
222 } | 222 } |
223 SaveState(); | 223 SaveState(); |
224 CFX_PathData path; | 224 CFX_PathData path; |
225 path.AppendRect(0, 0, 1.0f, 1.0f); | 225 path.AppendRect(0, 0, 1.0f, 1.0f); |
226 SetClip_PathFill(&path, pMatrix, WINDING); | 226 SetClip_PathFill(&path, pMatrix, WINDING); |
227 FX_BOOL ret = StretchDIBits(pTransformed, color, full_rect.left, full_re
ct.top, full_rect.Width(), full_rect.Height(), NULL, 0, | 227 bool ret = StretchDIBits(pTransformed, color, full_rect.left, full_rect.
top, full_rect.Width(), full_rect.Height(), NULL, 0, |
228 alpha_flag, pIccTransform, blend_type); | 228 alpha_flag, pIccTransform, blend_type); |
229 RestoreState(); | 229 RestoreState(); |
230 delete pTransformed; | 230 delete pTransformed; |
231 handle = NULL; | 231 handle = NULL; |
232 return ret; | 232 return ret; |
233 } | 233 } |
234 return FALSE; | 234 return false; |
235 } | 235 } |
236 CPSOutput::CPSOutput(HDC hDC) | 236 CPSOutput::CPSOutput(HDC hDC) |
237 { | 237 { |
238 m_hDC = hDC; | 238 m_hDC = hDC; |
239 m_pBuf = NULL; | 239 m_pBuf = NULL; |
240 } | 240 } |
241 CPSOutput::~CPSOutput() | 241 CPSOutput::~CPSOutput() |
242 { | 242 { |
243 if (m_pBuf) { | 243 if (m_pBuf) { |
244 FX_Free(m_pBuf); | 244 FX_Free(m_pBuf); |
(...skipping 14 matching lines...) Expand all Loading... |
259 *(FX_WORD*)m_pBuf = send_len; | 259 *(FX_WORD*)m_pBuf = send_len; |
260 FXSYS_memcpy(m_pBuf + 2, string + sent_len, send_len); | 260 FXSYS_memcpy(m_pBuf + 2, string + sent_len, send_len); |
261 int ret = ExtEscape(m_hDC, PASSTHROUGH, send_len + 2, m_pBuf, 0, NULL); | 261 int ret = ExtEscape(m_hDC, PASSTHROUGH, send_len + 2, m_pBuf, 0, NULL); |
262 sent_len += send_len; | 262 sent_len += send_len; |
263 len -= send_len; | 263 len -= send_len; |
264 } | 264 } |
265 } | 265 } |
266 CPSPrinterDriver::CPSPrinterDriver() | 266 CPSPrinterDriver::CPSPrinterDriver() |
267 { | 267 { |
268 m_pPSOutput = NULL; | 268 m_pPSOutput = NULL; |
269 m_bCmykOutput = FALSE; | 269 m_bCmykOutput = false; |
270 } | 270 } |
271 CPSPrinterDriver::~CPSPrinterDriver() | 271 CPSPrinterDriver::~CPSPrinterDriver() |
272 { | 272 { |
273 EndRendering(); | 273 EndRendering(); |
274 delete m_pPSOutput; | 274 delete m_pPSOutput; |
275 } | 275 } |
276 FX_BOOL CPSPrinterDriver::Init(HDC hDC, int pslevel, FX_BOOL bCmykOutput) | 276 bool CPSPrinterDriver::Init(HDC hDC, int pslevel, bool bCmykOutput) |
277 { | 277 { |
278 m_hDC = hDC; | 278 m_hDC = hDC; |
279 m_HorzSize = ::GetDeviceCaps(m_hDC, HORZSIZE); | 279 m_HorzSize = ::GetDeviceCaps(m_hDC, HORZSIZE); |
280 m_VertSize = ::GetDeviceCaps(m_hDC, VERTSIZE); | 280 m_VertSize = ::GetDeviceCaps(m_hDC, VERTSIZE); |
281 m_Width = ::GetDeviceCaps(m_hDC, HORZRES); | 281 m_Width = ::GetDeviceCaps(m_hDC, HORZRES); |
282 m_Height = ::GetDeviceCaps(m_hDC, VERTRES); | 282 m_Height = ::GetDeviceCaps(m_hDC, VERTRES); |
283 m_nBitsPerPixel = ::GetDeviceCaps(m_hDC, BITSPIXEL); | 283 m_nBitsPerPixel = ::GetDeviceCaps(m_hDC, BITSPIXEL); |
284 m_pPSOutput = new CPSOutput(hDC); | 284 m_pPSOutput = new CPSOutput(hDC); |
285 ((CPSOutput*)m_pPSOutput)->Init(); | 285 ((CPSOutput*)m_pPSOutput)->Init(); |
286 m_PSRenderer.Init(m_pPSOutput, pslevel, m_Width, m_Height, bCmykOutput); | 286 m_PSRenderer.Init(m_pPSOutput, pslevel, m_Width, m_Height, bCmykOutput); |
(...skipping 11 matching lines...) Expand all Loading... |
298 for (FX_DWORD i = 0; i < pData->rdh.nCount; i ++) { | 298 for (FX_DWORD i = 0; i < pData->rdh.nCount; i ++) { |
299 RECT* pRect = (RECT*)(pData->Buffer + pData->rdh.nRgnSize *
i); | 299 RECT* pRect = (RECT*)(pData->Buffer + pData->rdh.nRgnSize *
i); |
300 path.AppendRect((FX_FLOAT)pRect->left, (FX_FLOAT)pRect->bott
om, (FX_FLOAT)pRect->right, (FX_FLOAT)pRect->top); | 300 path.AppendRect((FX_FLOAT)pRect->left, (FX_FLOAT)pRect->bott
om, (FX_FLOAT)pRect->right, (FX_FLOAT)pRect->top); |
301 } | 301 } |
302 m_PSRenderer.SetClip_PathFill(&path, NULL, FXFILL_WINDING); | 302 m_PSRenderer.SetClip_PathFill(&path, NULL, FXFILL_WINDING); |
303 } | 303 } |
304 FX_Free(pData); | 304 FX_Free(pData); |
305 } | 305 } |
306 } | 306 } |
307 ::DeleteObject(hRgn); | 307 ::DeleteObject(hRgn); |
308 return TRUE; | 308 return true; |
309 } | 309 } |
310 int CPSPrinterDriver::GetDeviceCaps(int caps_id) | 310 int CPSPrinterDriver::GetDeviceCaps(int caps_id) |
311 { | 311 { |
312 switch (caps_id) { | 312 switch (caps_id) { |
313 case FXDC_DEVICE_CLASS: | 313 case FXDC_DEVICE_CLASS: |
314 return FXDC_PRINTER; | 314 return FXDC_PRINTER; |
315 case FXDC_PIXEL_WIDTH: | 315 case FXDC_PIXEL_WIDTH: |
316 return m_Width; | 316 return m_Width; |
317 case FXDC_PIXEL_HEIGHT: | 317 case FXDC_PIXEL_HEIGHT: |
318 return m_Height; | 318 return m_Height; |
319 case FXDC_BITS_PIXEL: | 319 case FXDC_BITS_PIXEL: |
320 return m_nBitsPerPixel; | 320 return m_nBitsPerPixel; |
321 case FXDC_RENDER_CAPS: | 321 case FXDC_RENDER_CAPS: |
322 return m_bCmykOutput ? FXRC_BIT_MASK | FXRC_CMYK_OUTPUT : FXRC_BIT_M
ASK; | 322 return m_bCmykOutput ? FXRC_BIT_MASK | FXRC_CMYK_OUTPUT : FXRC_BIT_M
ASK; |
323 case FXDC_HORZ_SIZE: | 323 case FXDC_HORZ_SIZE: |
324 return m_HorzSize; | 324 return m_HorzSize; |
325 case FXDC_VERT_SIZE: | 325 case FXDC_VERT_SIZE: |
326 return m_VertSize; | 326 return m_VertSize; |
327 } | 327 } |
328 return 0; | 328 return 0; |
329 } | 329 } |
330 FX_BOOL CPSPrinterDriver::StartRendering() | 330 bool CPSPrinterDriver::StartRendering() |
331 { | 331 { |
332 return m_PSRenderer.StartRendering(); | 332 return m_PSRenderer.StartRendering(); |
333 } | 333 } |
334 void CPSPrinterDriver::EndRendering() | 334 void CPSPrinterDriver::EndRendering() |
335 { | 335 { |
336 m_PSRenderer.EndRendering(); | 336 m_PSRenderer.EndRendering(); |
337 } | 337 } |
338 void CPSPrinterDriver::SaveState() | 338 void CPSPrinterDriver::SaveState() |
339 { | 339 { |
340 m_PSRenderer.SaveState(); | 340 m_PSRenderer.SaveState(); |
341 } | 341 } |
342 void CPSPrinterDriver::RestoreState(FX_BOOL bKeepSaved) | 342 void CPSPrinterDriver::RestoreState(bool bKeepSaved) |
343 { | 343 { |
344 m_PSRenderer.RestoreState(bKeepSaved); | 344 m_PSRenderer.RestoreState(bKeepSaved); |
345 } | 345 } |
346 FX_BOOL»CPSPrinterDriver::SetClip_PathFill(const CFX_PathData* pPathData, const
CFX_AffineMatrix* pObject2Device, | 346 bool» CPSPrinterDriver::SetClip_PathFill(const CFX_PathData* pPathData, const
CFX_AffineMatrix* pObject2Device, |
347 int fill_mode) | 347 int fill_mode) |
348 { | 348 { |
349 m_PSRenderer.SetClip_PathFill(pPathData, pObject2Device, fill_mode); | 349 m_PSRenderer.SetClip_PathFill(pPathData, pObject2Device, fill_mode); |
350 return TRUE; | 350 return true; |
351 } | 351 } |
352 FX_BOOL»CPSPrinterDriver::SetClip_PathStroke(const CFX_PathData* pPathData, | 352 bool» CPSPrinterDriver::SetClip_PathStroke(const CFX_PathData* pPathData, |
353 const CFX_AffineMatrix* pObject2Device, | 353 const CFX_AffineMatrix* pObject2Device, |
354 const CFX_GraphStateData* pGraphState) | 354 const CFX_GraphStateData* pGraphState) |
355 { | 355 { |
356 m_PSRenderer.SetClip_PathStroke(pPathData, pObject2Device, pGraphState); | 356 m_PSRenderer.SetClip_PathStroke(pPathData, pObject2Device, pGraphState); |
357 return TRUE; | 357 return true; |
358 } | 358 } |
359 FX_BOOL»CPSPrinterDriver::DrawPath(const CFX_PathData* pPathData, | 359 bool» CPSPrinterDriver::DrawPath(const CFX_PathData* pPathData, |
360 const CFX_AffineMatrix* pObject2Device, | 360 const CFX_AffineMatrix* pObject2Device, |
361 const CFX_GraphStateData* pGraphState, FX_ARG
B fill_color, FX_ARGB stroke_color, | 361 const CFX_GraphStateData* pGraphState, FX_ARG
B fill_color, FX_ARGB stroke_color, |
362 int fill_mode, int alpha_flag, void* pIccTran
sform, int blend_type) | 362 int fill_mode, int alpha_flag, void* pIccTran
sform, int blend_type) |
363 { | 363 { |
364 if (blend_type != FXDIB_BLEND_NORMAL) { | 364 if (blend_type != FXDIB_BLEND_NORMAL) { |
365 return FALSE; | 365 return false; |
366 } | 366 } |
367 return m_PSRenderer.DrawPath(pPathData, pObject2Device, pGraphState, fill_co
lor, stroke_color, fill_mode & 3, alpha_flag, pIccTransform); | 367 return m_PSRenderer.DrawPath(pPathData, pObject2Device, pGraphState, fill_co
lor, stroke_color, fill_mode & 3, alpha_flag, pIccTransform); |
368 } | 368 } |
369 FX_BOOL CPSPrinterDriver::GetClipBox(FX_RECT* pRect) | 369 bool CPSPrinterDriver::GetClipBox(FX_RECT* pRect) |
370 { | 370 { |
371 *pRect = m_PSRenderer.GetClipBox(); | 371 *pRect = m_PSRenderer.GetClipBox(); |
372 return TRUE; | 372 return true; |
373 } | 373 } |
374 FX_BOOL CPSPrinterDriver::SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color
, const FX_RECT* pSrcRect, int left, int top, int blend_type, | 374 bool CPSPrinterDriver::SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, c
onst FX_RECT* pSrcRect, int left, int top, int blend_type, |
375 int alpha_flag, void* pIccTransform) | 375 int alpha_flag, void* pIccTransform) |
376 { | 376 { |
377 if (blend_type != FXDIB_BLEND_NORMAL) { | 377 if (blend_type != FXDIB_BLEND_NORMAL) { |
378 return FALSE; | 378 return false; |
379 } | 379 } |
380 return m_PSRenderer.SetDIBits(pBitmap, color, left, top, alpha_flag, pIccTra
nsform); | 380 return m_PSRenderer.SetDIBits(pBitmap, color, left, top, alpha_flag, pIccTra
nsform); |
381 } | 381 } |
382 FX_BOOL CPSPrinterDriver::StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD c
olor, int dest_left, int dest_top, | 382 bool CPSPrinterDriver::StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD colo
r, int dest_left, int dest_top, |
383 int dest_width, int dest_height, const F
X_RECT* pClipRect, FX_DWORD flags, | 383 int dest_width, int dest_height, const F
X_RECT* pClipRect, FX_DWORD flags, |
384 int alpha_flag, void* pIccTransform, int
blend_type) | 384 int alpha_flag, void* pIccTransform, int
blend_type) |
385 { | 385 { |
386 if (blend_type != FXDIB_BLEND_NORMAL) { | 386 if (blend_type != FXDIB_BLEND_NORMAL) { |
387 return FALSE; | 387 return false; |
388 } | 388 } |
389 return m_PSRenderer.StretchDIBits(pBitmap, color, dest_left, dest_top, dest_
width, dest_height, flags, alpha_flag, pIccTransform); | 389 return m_PSRenderer.StretchDIBits(pBitmap, color, dest_left, dest_top, dest_
width, dest_height, flags, alpha_flag, pIccTransform); |
390 } | 390 } |
391 FX_BOOL»CPSPrinterDriver::StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_a
lpha, FX_DWORD color, | 391 bool» CPSPrinterDriver::StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_a
lpha, FX_DWORD color, |
392 const CFX_AffineMatrix* pMatrix, FX_DWORD
render_flags, void*& handle, | 392 const CFX_AffineMatrix* pMatrix, FX_DWORD
render_flags, void*& handle, |
393 int alpha_flag, void* pIccTransform, int b
lend_type) | 393 int alpha_flag, void* pIccTransform, int b
lend_type) |
394 { | 394 { |
395 if (blend_type != FXDIB_BLEND_NORMAL) { | 395 if (blend_type != FXDIB_BLEND_NORMAL) { |
396 return FALSE; | 396 return false; |
397 } | 397 } |
398 if (bitmap_alpha < 255) { | 398 if (bitmap_alpha < 255) { |
399 return FALSE; | 399 return false; |
400 } | 400 } |
401 handle = NULL; | 401 handle = NULL; |
402 return m_PSRenderer.DrawDIBits(pBitmap, color, pMatrix, render_flags, alpha_
flag, pIccTransform); | 402 return m_PSRenderer.DrawDIBits(pBitmap, color, pMatrix, render_flags, alpha_
flag, pIccTransform); |
403 } | 403 } |
404 FX_BOOL»CPSPrinterDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pChar
Pos, CFX_Font* pFont, | 404 bool» CPSPrinterDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pChar
Pos, CFX_Font* pFont, |
405 CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT
font_size, FX_DWORD color, | 405 CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT
font_size, FX_DWORD color, |
406 int alpha_flag, void* pIccTransform) | 406 int alpha_flag, void* pIccTransform) |
407 { | 407 { |
408 return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device
, font_size, color, alpha_flag, pIccTransform); | 408 return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device
, font_size, color, alpha_flag, pIccTransform); |
409 } | 409 } |
410 #endif | 410 #endif |
OLD | NEW |