Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: core/fxge/win32/fx_win32_print.cpp

Issue 1832173003: Remove FX_DWORD from core/ and delete definition (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fxge/win32/fx_win32_gdipext.cpp ('k') | core/fxge/win32/win32_int.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/include/fxge/fx_ge.h" 7 #include "core/include/fxge/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 16 matching lines...) Expand all
27 int CGdiPrinterDriver::GetDeviceCaps(int caps_id) { 27 int CGdiPrinterDriver::GetDeviceCaps(int caps_id) {
28 if (caps_id == FXDC_HORZ_SIZE) { 28 if (caps_id == FXDC_HORZ_SIZE) {
29 return m_HorzSize; 29 return m_HorzSize;
30 } 30 }
31 if (caps_id == FXDC_VERT_SIZE) { 31 if (caps_id == FXDC_VERT_SIZE) {
32 return m_VertSize; 32 return m_VertSize;
33 } 33 }
34 return CGdiDeviceDriver::GetDeviceCaps(caps_id); 34 return CGdiDeviceDriver::GetDeviceCaps(caps_id);
35 } 35 }
36 FX_BOOL CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource, 36 FX_BOOL CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource,
37 FX_DWORD color, 37 uint32_t color,
38 const FX_RECT* pSrcRect, 38 const FX_RECT* pSrcRect,
39 int left, 39 int left,
40 int top, 40 int top,
41 int blend_type, 41 int blend_type,
42 int alpha_flag, 42 int alpha_flag,
43 void* pIccTransform) { 43 void* pIccTransform) {
44 if (pSource->IsAlphaMask()) { 44 if (pSource->IsAlphaMask()) {
45 FX_RECT clip_rect(left, top, left + pSrcRect->Width(), 45 FX_RECT clip_rect(left, top, left + pSrcRect->Width(),
46 top + pSrcRect->Height()); 46 top + pSrcRect->Height());
47 return StretchDIBits(pSource, color, left - pSrcRect->left, 47 return StretchDIBits(pSource, color, left - pSrcRect->left,
48 top - pSrcRect->top, pSource->GetWidth(), 48 top - pSrcRect->top, pSource->GetWidth(),
49 pSource->GetHeight(), &clip_rect, 0, alpha_flag, 49 pSource->GetHeight(), &clip_rect, 0, alpha_flag,
50 pIccTransform, FXDIB_BLEND_NORMAL); 50 pIccTransform, FXDIB_BLEND_NORMAL);
51 } 51 }
52 ASSERT(pSource && !pSource->IsAlphaMask() && pSrcRect); 52 ASSERT(pSource && !pSource->IsAlphaMask() && pSrcRect);
53 ASSERT(blend_type == FXDIB_BLEND_NORMAL); 53 ASSERT(blend_type == FXDIB_BLEND_NORMAL);
54 if (pSource->HasAlpha()) { 54 if (pSource->HasAlpha()) {
55 return FALSE; 55 return FALSE;
56 } 56 }
57 CFX_DIBExtractor temp(pSource); 57 CFX_DIBExtractor temp(pSource);
58 CFX_DIBitmap* pBitmap = temp; 58 CFX_DIBitmap* pBitmap = temp;
59 if (!pBitmap) { 59 if (!pBitmap) {
60 return FALSE; 60 return FALSE;
61 } 61 }
62 return GDI_SetDIBits(pBitmap, pSrcRect, left, top, pIccTransform); 62 return GDI_SetDIBits(pBitmap, pSrcRect, left, top, pIccTransform);
63 } 63 }
64 FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource, 64 FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
65 FX_DWORD color, 65 uint32_t color,
66 int dest_left, 66 int dest_left,
67 int dest_top, 67 int dest_top,
68 int dest_width, 68 int dest_width,
69 int dest_height, 69 int dest_height,
70 const FX_RECT* pClipRect, 70 const FX_RECT* pClipRect,
71 FX_DWORD flags, 71 uint32_t flags,
72 int alpha_flag, 72 int alpha_flag,
73 void* pIccTransform, 73 void* pIccTransform,
74 int blend_type) { 74 int blend_type) {
75 if (pSource->IsAlphaMask()) { 75 if (pSource->IsAlphaMask()) {
76 int alpha = FXGETFLAG_COLORTYPE(alpha_flag) 76 int alpha = FXGETFLAG_COLORTYPE(alpha_flag)
77 ? FXGETFLAG_ALPHA_FILL(alpha_flag) 77 ? FXGETFLAG_ALPHA_FILL(alpha_flag)
78 : FXARGB_A(color); 78 : FXARGB_A(color);
79 if (pSource->GetBPP() != 1 || alpha != 255 || !m_bSupportROP) { 79 if (pSource->GetBPP() != 1 || alpha != 255 || !m_bSupportROP) {
80 return FALSE; 80 return FALSE;
81 } 81 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 ASSERT(pSrc->GetFormat() == FXDIB_1bppRgb || 140 ASSERT(pSrc->GetFormat() == FXDIB_1bppRgb ||
141 pSrc->GetFormat() == FXDIB_1bppMask || 141 pSrc->GetFormat() == FXDIB_1bppMask ||
142 pSrc->GetFormat() == FXDIB_1bppCmyk); 142 pSrc->GetFormat() == FXDIB_1bppCmyk);
143 CFX_DIBExtractor src_bitmap(pSrc); 143 CFX_DIBExtractor src_bitmap(pSrc);
144 CFX_DIBitmap* pSrcBitmap = src_bitmap; 144 CFX_DIBitmap* pSrcBitmap = src_bitmap;
145 if (!pSrcBitmap) { 145 if (!pSrcBitmap) {
146 return NULL; 146 return NULL;
147 } 147 }
148 int src_width = pSrcBitmap->GetWidth(), src_height = pSrcBitmap->GetHeight(); 148 int src_width = pSrcBitmap->GetWidth(), src_height = pSrcBitmap->GetHeight();
149 uint8_t* src_buf = pSrcBitmap->GetBuffer(); 149 uint8_t* src_buf = pSrcBitmap->GetBuffer();
150 FX_DWORD src_pitch = pSrcBitmap->GetPitch(); 150 uint32_t src_pitch = pSrcBitmap->GetPitch();
151 FX_FLOAT dest_area = pDestMatrix->GetUnitArea(); 151 FX_FLOAT dest_area = pDestMatrix->GetUnitArea();
152 FX_FLOAT area_scale = ((FX_FLOAT)(src_width * src_height)) / dest_area; 152 FX_FLOAT area_scale = ((FX_FLOAT)(src_width * src_height)) / dest_area;
153 FX_FLOAT size_scale = FXSYS_sqrt(area_scale); 153 FX_FLOAT size_scale = FXSYS_sqrt(area_scale);
154 CFX_Matrix adjusted_matrix(*pDestMatrix); 154 CFX_Matrix adjusted_matrix(*pDestMatrix);
155 adjusted_matrix.Scale(size_scale, size_scale); 155 adjusted_matrix.Scale(size_scale, size_scale);
156 CFX_FloatRect result_rect_f = adjusted_matrix.GetUnitRect(); 156 CFX_FloatRect result_rect_f = adjusted_matrix.GetUnitRect();
157 FX_RECT result_rect = result_rect_f.GetOutterRect(); 157 FX_RECT result_rect = result_rect_f.GetOutterRect();
158 CFX_Matrix src2result; 158 CFX_Matrix src2result;
159 src2result.e = adjusted_matrix.c + adjusted_matrix.e; 159 src2result.e = adjusted_matrix.c + adjusted_matrix.e;
160 src2result.f = adjusted_matrix.d + adjusted_matrix.f; 160 src2result.f = adjusted_matrix.d + adjusted_matrix.f;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 } 215 }
216 } 216 }
217 } 217 }
218 if (pSrcBitmap != src_bitmap) { 218 if (pSrcBitmap != src_bitmap) {
219 delete pSrcBitmap; 219 delete pSrcBitmap;
220 } 220 }
221 return pTempBitmap; 221 return pTempBitmap;
222 } 222 }
223 FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, 223 FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource,
224 int bitmap_alpha, 224 int bitmap_alpha,
225 FX_DWORD color, 225 uint32_t color,
226 const CFX_Matrix* pMatrix, 226 const CFX_Matrix* pMatrix,
227 FX_DWORD render_flags, 227 uint32_t render_flags,
228 void*& handle, 228 void*& handle,
229 int alpha_flag, 229 int alpha_flag,
230 void* pIccTransform, 230 void* pIccTransform,
231 int blend_type) { 231 int blend_type) {
232 if (bitmap_alpha < 255 || pSource->HasAlpha() || 232 if (bitmap_alpha < 255 || pSource->HasAlpha() ||
233 (pSource->IsAlphaMask() && (pSource->GetBPP() != 1 || !m_bSupportROP))) { 233 (pSource->IsAlphaMask() && (pSource->GetBPP() != 1 || !m_bSupportROP))) {
234 return FALSE; 234 return FALSE;
235 } 235 }
236 CFX_FloatRect unit_rect = pMatrix->GetUnitRect(); 236 CFX_FloatRect unit_rect = pMatrix->GetUnitRect();
237 FX_RECT full_rect = unit_rect.GetOutterRect(); 237 FX_RECT full_rect = unit_rect.GetOutterRect();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 HRGN hRgn = ::CreateRectRgn(0, 0, 1, 1); 323 HRGN hRgn = ::CreateRectRgn(0, 0, 1, 1);
324 int ret = ::GetClipRgn(hDC, hRgn); 324 int ret = ::GetClipRgn(hDC, hRgn);
325 if (ret == 1) { 325 if (ret == 1) {
326 ret = ::GetRegionData(hRgn, 0, NULL); 326 ret = ::GetRegionData(hRgn, 0, NULL);
327 if (ret) { 327 if (ret) {
328 RGNDATA* pData = (RGNDATA*)FX_Alloc(uint8_t, ret); 328 RGNDATA* pData = (RGNDATA*)FX_Alloc(uint8_t, ret);
329 ret = ::GetRegionData(hRgn, ret, pData); 329 ret = ::GetRegionData(hRgn, ret, pData);
330 if (ret) { 330 if (ret) {
331 CFX_PathData path; 331 CFX_PathData path;
332 path.AllocPointCount(pData->rdh.nCount * 5); 332 path.AllocPointCount(pData->rdh.nCount * 5);
333 for (FX_DWORD i = 0; i < pData->rdh.nCount; i++) { 333 for (uint32_t i = 0; i < pData->rdh.nCount; i++) {
334 RECT* pRect = (RECT*)(pData->Buffer + pData->rdh.nRgnSize * i); 334 RECT* pRect = (RECT*)(pData->Buffer + pData->rdh.nRgnSize * i);
335 path.AppendRect((FX_FLOAT)pRect->left, (FX_FLOAT)pRect->bottom, 335 path.AppendRect((FX_FLOAT)pRect->left, (FX_FLOAT)pRect->bottom,
336 (FX_FLOAT)pRect->right, (FX_FLOAT)pRect->top); 336 (FX_FLOAT)pRect->right, (FX_FLOAT)pRect->top);
337 } 337 }
338 m_PSRenderer.SetClip_PathFill(&path, NULL, FXFILL_WINDING); 338 m_PSRenderer.SetClip_PathFill(&path, NULL, FXFILL_WINDING);
339 } 339 }
340 FX_Free(pData); 340 FX_Free(pData);
341 } 341 }
342 } 342 }
343 ::DeleteObject(hRgn); 343 ::DeleteObject(hRgn);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 } 401 }
402 return m_PSRenderer.DrawPath(pPathData, pObject2Device, pGraphState, 402 return m_PSRenderer.DrawPath(pPathData, pObject2Device, pGraphState,
403 fill_color, stroke_color, fill_mode & 3, 403 fill_color, stroke_color, fill_mode & 3,
404 alpha_flag, pIccTransform); 404 alpha_flag, pIccTransform);
405 } 405 }
406 FX_BOOL CPSPrinterDriver::GetClipBox(FX_RECT* pRect) { 406 FX_BOOL CPSPrinterDriver::GetClipBox(FX_RECT* pRect) {
407 *pRect = m_PSRenderer.GetClipBox(); 407 *pRect = m_PSRenderer.GetClipBox();
408 return TRUE; 408 return TRUE;
409 } 409 }
410 FX_BOOL CPSPrinterDriver::SetDIBits(const CFX_DIBSource* pBitmap, 410 FX_BOOL CPSPrinterDriver::SetDIBits(const CFX_DIBSource* pBitmap,
411 FX_DWORD color, 411 uint32_t color,
412 const FX_RECT* pSrcRect, 412 const FX_RECT* pSrcRect,
413 int left, 413 int left,
414 int top, 414 int top,
415 int blend_type, 415 int blend_type,
416 int alpha_flag, 416 int alpha_flag,
417 void* pIccTransform) { 417 void* pIccTransform) {
418 if (blend_type != FXDIB_BLEND_NORMAL) { 418 if (blend_type != FXDIB_BLEND_NORMAL) {
419 return FALSE; 419 return FALSE;
420 } 420 }
421 return m_PSRenderer.SetDIBits(pBitmap, color, left, top, alpha_flag, 421 return m_PSRenderer.SetDIBits(pBitmap, color, left, top, alpha_flag,
422 pIccTransform); 422 pIccTransform);
423 } 423 }
424 FX_BOOL CPSPrinterDriver::StretchDIBits(const CFX_DIBSource* pBitmap, 424 FX_BOOL CPSPrinterDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
425 FX_DWORD color, 425 uint32_t color,
426 int dest_left, 426 int dest_left,
427 int dest_top, 427 int dest_top,
428 int dest_width, 428 int dest_width,
429 int dest_height, 429 int dest_height,
430 const FX_RECT* pClipRect, 430 const FX_RECT* pClipRect,
431 FX_DWORD flags, 431 uint32_t flags,
432 int alpha_flag, 432 int alpha_flag,
433 void* pIccTransform, 433 void* pIccTransform,
434 int blend_type) { 434 int blend_type) {
435 if (blend_type != FXDIB_BLEND_NORMAL) { 435 if (blend_type != FXDIB_BLEND_NORMAL) {
436 return FALSE; 436 return FALSE;
437 } 437 }
438 return m_PSRenderer.StretchDIBits(pBitmap, color, dest_left, dest_top, 438 return m_PSRenderer.StretchDIBits(pBitmap, color, dest_left, dest_top,
439 dest_width, dest_height, flags, alpha_flag, 439 dest_width, dest_height, flags, alpha_flag,
440 pIccTransform); 440 pIccTransform);
441 } 441 }
442 FX_BOOL CPSPrinterDriver::StartDIBits(const CFX_DIBSource* pBitmap, 442 FX_BOOL CPSPrinterDriver::StartDIBits(const CFX_DIBSource* pBitmap,
443 int bitmap_alpha, 443 int bitmap_alpha,
444 FX_DWORD color, 444 uint32_t color,
445 const CFX_Matrix* pMatrix, 445 const CFX_Matrix* pMatrix,
446 FX_DWORD render_flags, 446 uint32_t render_flags,
447 void*& handle, 447 void*& handle,
448 int alpha_flag, 448 int alpha_flag,
449 void* pIccTransform, 449 void* pIccTransform,
450 int blend_type) { 450 int blend_type) {
451 if (blend_type != FXDIB_BLEND_NORMAL) { 451 if (blend_type != FXDIB_BLEND_NORMAL) {
452 return FALSE; 452 return FALSE;
453 } 453 }
454 if (bitmap_alpha < 255) { 454 if (bitmap_alpha < 255) {
455 return FALSE; 455 return FALSE;
456 } 456 }
457 handle = NULL; 457 handle = NULL;
458 return m_PSRenderer.DrawDIBits(pBitmap, color, pMatrix, render_flags, 458 return m_PSRenderer.DrawDIBits(pBitmap, color, pMatrix, render_flags,
459 alpha_flag, pIccTransform); 459 alpha_flag, pIccTransform);
460 } 460 }
461 FX_BOOL CPSPrinterDriver::DrawDeviceText(int nChars, 461 FX_BOOL CPSPrinterDriver::DrawDeviceText(int nChars,
462 const FXTEXT_CHARPOS* pCharPos, 462 const FXTEXT_CHARPOS* pCharPos,
463 CFX_Font* pFont, 463 CFX_Font* pFont,
464 CFX_FontCache* pCache, 464 CFX_FontCache* pCache,
465 const CFX_Matrix* pObject2Device, 465 const CFX_Matrix* pObject2Device,
466 FX_FLOAT font_size, 466 FX_FLOAT font_size,
467 FX_DWORD color, 467 uint32_t color,
468 int alpha_flag, 468 int alpha_flag,
469 void* pIccTransform) { 469 void* pIccTransform) {
470 return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device, 470 return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device,
471 font_size, color, alpha_flag, pIccTransform); 471 font_size, color, alpha_flag, pIccTransform);
472 } 472 }
473 #endif 473 #endif
OLDNEW
« no previous file with comments | « core/fxge/win32/fx_win32_gdipext.cpp ('k') | core/fxge/win32/win32_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698