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

Side by Side Diff: core/fxge/win32/fx_win32_device.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/dwrite_int.h ('k') | core/fxge/win32/fx_win32_dib.cpp » ('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 #include <crtdbg.h> 10 #include <crtdbg.h>
(...skipping 25 matching lines...) Expand all
36 // IFX_SystemFontInfo 36 // IFX_SystemFontInfo
37 void Release() override; 37 void Release() override;
38 FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override; 38 FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override;
39 void* MapFont(int weight, 39 void* MapFont(int weight,
40 FX_BOOL bItalic, 40 FX_BOOL bItalic,
41 int charset, 41 int charset,
42 int pitch_family, 42 int pitch_family,
43 const FX_CHAR* face, 43 const FX_CHAR* face,
44 int& iExact) override; 44 int& iExact) override;
45 void* GetFont(const FX_CHAR* face) override { return NULL; } 45 void* GetFont(const FX_CHAR* face) override { return NULL; }
46 FX_DWORD GetFontData(void* hFont, 46 uint32_t GetFontData(void* hFont,
47 FX_DWORD table, 47 uint32_t table,
48 uint8_t* buffer, 48 uint8_t* buffer,
49 FX_DWORD size) override; 49 uint32_t size) override;
50 FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; 50 FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override;
51 FX_BOOL GetFontCharset(void* hFont, int& charset) override; 51 FX_BOOL GetFontCharset(void* hFont, int& charset) override;
52 void DeleteFont(void* hFont) override; 52 void DeleteFont(void* hFont) override;
53 53
54 FX_BOOL IsOpenTypeFromDiv(const LOGFONTA* plf); 54 FX_BOOL IsOpenTypeFromDiv(const LOGFONTA* plf);
55 FX_BOOL IsSupportFontFormDiv(const LOGFONTA* plf); 55 FX_BOOL IsSupportFontFormDiv(const LOGFONTA* plf);
56 void AddInstalledFont(const LOGFONTA* plf, FX_DWORD FontType); 56 void AddInstalledFont(const LOGFONTA* plf, uint32_t FontType);
57 void GetGBPreference(CFX_ByteString& face, int weight, int picth_family); 57 void GetGBPreference(CFX_ByteString& face, int weight, int picth_family);
58 void GetJapanesePreference(CFX_ByteString& face, 58 void GetJapanesePreference(CFX_ByteString& face,
59 int weight, 59 int weight,
60 int picth_family); 60 int picth_family);
61 CFX_ByteString FindFont(const CFX_ByteString& name); 61 CFX_ByteString FindFont(const CFX_ByteString& name);
62 HDC m_hDC; 62 HDC m_hDC;
63 CFX_FontMapper* m_pMapper; 63 CFX_FontMapper* m_pMapper;
64 CFX_ByteString m_LastFamily; 64 CFX_ByteString m_LastFamily;
65 CFX_ByteString m_KaiTi, m_FangSong; 65 CFX_ByteString m_KaiTi, m_FangSong;
66 }; 66 };
67 67
68 CFX_Win32FontInfo::CFX_Win32FontInfo() { 68 CFX_Win32FontInfo::CFX_Win32FontInfo() {
69 m_hDC = CreateCompatibleDC(NULL); 69 m_hDC = CreateCompatibleDC(NULL);
70 } 70 }
71 CFX_Win32FontInfo::~CFX_Win32FontInfo() { 71 CFX_Win32FontInfo::~CFX_Win32FontInfo() {
72 m_pMapper = NULL; 72 m_pMapper = NULL;
73 } 73 }
74 void CFX_Win32FontInfo::Release() { 74 void CFX_Win32FontInfo::Release() {
75 DeleteDC(m_hDC); 75 DeleteDC(m_hDC);
76 delete this; 76 delete this;
77 } 77 }
78 #define TT_MAKE_TAG(x1, x2, x3, x4) \ 78 #define TT_MAKE_TAG(x1, x2, x3, x4) \
79 (((FX_DWORD)x1 << 24) | ((FX_DWORD)x2 << 16) | ((FX_DWORD)x3 << 8) | \ 79 (((uint32_t)x1 << 24) | ((uint32_t)x2 << 16) | ((uint32_t)x3 << 8) | \
80 (FX_DWORD)x4) 80 (uint32_t)x4)
81 FX_BOOL CFX_Win32FontInfo::IsOpenTypeFromDiv(const LOGFONTA* plf) { 81 FX_BOOL CFX_Win32FontInfo::IsOpenTypeFromDiv(const LOGFONTA* plf) {
82 HFONT hFont = CreateFontIndirectA(plf); 82 HFONT hFont = CreateFontIndirectA(plf);
83 FX_BOOL ret = FALSE; 83 FX_BOOL ret = FALSE;
84 FX_DWORD font_size = GetFontData(hFont, 0, NULL, 0); 84 uint32_t font_size = GetFontData(hFont, 0, NULL, 0);
85 if (font_size != GDI_ERROR && font_size >= sizeof(FX_DWORD)) { 85 if (font_size != GDI_ERROR && font_size >= sizeof(uint32_t)) {
86 FX_DWORD lVersion = 0; 86 uint32_t lVersion = 0;
87 GetFontData(hFont, 0, (uint8_t*)(&lVersion), sizeof(FX_DWORD)); 87 GetFontData(hFont, 0, (uint8_t*)(&lVersion), sizeof(uint32_t));
88 lVersion = (((FX_DWORD)(uint8_t)(lVersion)) << 24) | 88 lVersion = (((uint32_t)(uint8_t)(lVersion)) << 24) |
89 ((FX_DWORD)((uint8_t)(lVersion >> 8))) << 16 | 89 ((uint32_t)((uint8_t)(lVersion >> 8))) << 16 |
90 ((FX_DWORD)((uint8_t)(lVersion >> 16))) << 8 | 90 ((uint32_t)((uint8_t)(lVersion >> 16))) << 8 |
91 ((uint8_t)(lVersion >> 24)); 91 ((uint8_t)(lVersion >> 24));
92 if (lVersion == TT_MAKE_TAG('O', 'T', 'T', 'O') || lVersion == 0x00010000 || 92 if (lVersion == TT_MAKE_TAG('O', 'T', 'T', 'O') || lVersion == 0x00010000 ||
93 lVersion == TT_MAKE_TAG('t', 't', 'c', 'f') || 93 lVersion == TT_MAKE_TAG('t', 't', 'c', 'f') ||
94 lVersion == TT_MAKE_TAG('t', 'r', 'u', 'e') || lVersion == 0x00020000) { 94 lVersion == TT_MAKE_TAG('t', 'r', 'u', 'e') || lVersion == 0x00020000) {
95 ret = TRUE; 95 ret = TRUE;
96 } 96 }
97 } 97 }
98 DeleteFont(hFont); 98 DeleteFont(hFont);
99 return ret; 99 return ret;
100 } 100 }
101 FX_BOOL CFX_Win32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) { 101 FX_BOOL CFX_Win32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) {
102 HFONT hFont = CreateFontIndirectA(plf); 102 HFONT hFont = CreateFontIndirectA(plf);
103 FX_BOOL ret = FALSE; 103 FX_BOOL ret = FALSE;
104 FX_DWORD font_size = GetFontData(hFont, 0, NULL, 0); 104 uint32_t font_size = GetFontData(hFont, 0, NULL, 0);
105 if (font_size != GDI_ERROR && font_size >= sizeof(FX_DWORD)) { 105 if (font_size != GDI_ERROR && font_size >= sizeof(uint32_t)) {
106 FX_DWORD lVersion = 0; 106 uint32_t lVersion = 0;
107 GetFontData(hFont, 0, (uint8_t*)(&lVersion), sizeof(FX_DWORD)); 107 GetFontData(hFont, 0, (uint8_t*)(&lVersion), sizeof(uint32_t));
108 lVersion = (((FX_DWORD)(uint8_t)(lVersion)) << 24) | 108 lVersion = (((uint32_t)(uint8_t)(lVersion)) << 24) |
109 ((FX_DWORD)((uint8_t)(lVersion >> 8))) << 16 | 109 ((uint32_t)((uint8_t)(lVersion >> 8))) << 16 |
110 ((FX_DWORD)((uint8_t)(lVersion >> 16))) << 8 | 110 ((uint32_t)((uint8_t)(lVersion >> 16))) << 8 |
111 ((uint8_t)(lVersion >> 24)); 111 ((uint8_t)(lVersion >> 24));
112 if (lVersion == TT_MAKE_TAG('O', 'T', 'T', 'O') || lVersion == 0x00010000 || 112 if (lVersion == TT_MAKE_TAG('O', 'T', 'T', 'O') || lVersion == 0x00010000 ||
113 lVersion == TT_MAKE_TAG('t', 't', 'c', 'f') || 113 lVersion == TT_MAKE_TAG('t', 't', 'c', 'f') ||
114 lVersion == TT_MAKE_TAG('t', 'r', 'u', 'e') || lVersion == 0x00020000) { 114 lVersion == TT_MAKE_TAG('t', 'r', 'u', 'e') || lVersion == 0x00020000) {
115 ret = TRUE; 115 ret = TRUE;
116 } else if ((lVersion & 0xFFFF0000) == TT_MAKE_TAG(0x80, 0x01, 0x00, 0x00) || 116 } else if ((lVersion & 0xFFFF0000) == TT_MAKE_TAG(0x80, 0x01, 0x00, 0x00) ||
117 (lVersion & 0xFFFF0000) == TT_MAKE_TAG('%', '!', 0, 0)) { 117 (lVersion & 0xFFFF0000) == TT_MAKE_TAG('%', '!', 0, 0)) {
118 ret = TRUE; 118 ret = TRUE;
119 } 119 }
120 } 120 }
121 DeleteFont(hFont); 121 DeleteFont(hFont);
122 return ret; 122 return ret;
123 } 123 }
124 void CFX_Win32FontInfo::AddInstalledFont(const LOGFONTA* plf, 124 void CFX_Win32FontInfo::AddInstalledFont(const LOGFONTA* plf,
125 FX_DWORD FontType) { 125 uint32_t FontType) {
126 CFX_ByteString name(plf->lfFaceName); 126 CFX_ByteString name(plf->lfFaceName);
127 if (name[0] == '@') { 127 if (name[0] == '@') {
128 return; 128 return;
129 } 129 }
130 if (name == m_LastFamily) { 130 if (name == m_LastFamily) {
131 m_pMapper->AddInstalledFont(name, plf->lfCharSet); 131 m_pMapper->AddInstalledFont(name, plf->lfCharSet);
132 return; 132 return;
133 } 133 }
134 if (!(FontType & TRUETYPE_FONTTYPE) && !(FontType & DEVICE_FONTTYPE)) { 134 if (!(FontType & TRUETYPE_FONTTYPE) && !(FontType & DEVICE_FONTTYPE)) {
135 return; 135 return;
136 } 136 }
137 if (!(FontType & TRUETYPE_FONTTYPE)) { 137 if (!(FontType & TRUETYPE_FONTTYPE)) {
138 if (!IsSupportFontFormDiv(plf)) { 138 if (!IsSupportFontFormDiv(plf)) {
139 return; 139 return;
140 } 140 }
141 } 141 }
142 m_pMapper->AddInstalledFont(name, plf->lfCharSet); 142 m_pMapper->AddInstalledFont(name, plf->lfCharSet);
143 m_LastFamily = name; 143 m_LastFamily = name;
144 } 144 }
145 static int CALLBACK FontEnumProc(const LOGFONTA* plf, 145 static int CALLBACK FontEnumProc(const LOGFONTA* plf,
146 const TEXTMETRICA* lpntme, 146 const TEXTMETRICA* lpntme,
147 FX_DWORD FontType, 147 uint32_t FontType,
148 LPARAM lParam) { 148 LPARAM lParam) {
149 CFX_Win32FontInfo* pFontInfo = (CFX_Win32FontInfo*)lParam; 149 CFX_Win32FontInfo* pFontInfo = (CFX_Win32FontInfo*)lParam;
150 if (pFontInfo->m_pMapper->GetFontEnumerator()) { 150 if (pFontInfo->m_pMapper->GetFontEnumerator()) {
151 pFontInfo->m_pMapper->GetFontEnumerator()->HitFont(); 151 pFontInfo->m_pMapper->GetFontEnumerator()->HitFont();
152 } 152 }
153 pFontInfo->AddInstalledFont(plf, FontType); 153 pFontInfo->AddInstalledFont(plf, FontType);
154 return 1; 154 return 1;
155 } 155 }
156 FX_BOOL CFX_Win32FontInfo::EnumFontList(CFX_FontMapper* pMapper) { 156 FX_BOOL CFX_Win32FontInfo::EnumFontList(CFX_FontMapper* pMapper) {
157 m_pMapper = pMapper; 157 m_pMapper = pMapper;
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 } 399 }
400 break; 400 break;
401 } 401 }
402 hFont = ::CreateFontA(-10, 0, 0, 0, weight, bItalic, 0, 0, charset, 402 hFont = ::CreateFontA(-10, 0, 0, 0, weight, bItalic, 0, 0, charset,
403 OUT_TT_ONLY_PRECIS, 0, 0, subst_pitch_family, face); 403 OUT_TT_ONLY_PRECIS, 0, 0, subst_pitch_family, face);
404 return hFont; 404 return hFont;
405 } 405 }
406 void CFX_Win32FontInfo::DeleteFont(void* hFont) { 406 void CFX_Win32FontInfo::DeleteFont(void* hFont) {
407 ::DeleteObject(hFont); 407 ::DeleteObject(hFont);
408 } 408 }
409 FX_DWORD CFX_Win32FontInfo::GetFontData(void* hFont, 409 uint32_t CFX_Win32FontInfo::GetFontData(void* hFont,
410 FX_DWORD table, 410 uint32_t table,
411 uint8_t* buffer, 411 uint8_t* buffer,
412 FX_DWORD size) { 412 uint32_t size) {
413 HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont); 413 HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont);
414 table = FXDWORD_GET_MSBFIRST(reinterpret_cast<uint8_t*>(&table)); 414 table = FXDWORD_GET_MSBFIRST(reinterpret_cast<uint8_t*>(&table));
415 size = ::GetFontData(m_hDC, table, 0, buffer, size); 415 size = ::GetFontData(m_hDC, table, 0, buffer, size);
416 ::SelectObject(m_hDC, hOldFont); 416 ::SelectObject(m_hDC, hOldFont);
417 if (size == GDI_ERROR) { 417 if (size == GDI_ERROR) {
418 return 0; 418 return 0;
419 } 419 }
420 return size; 420 return size;
421 } 421 }
422 FX_BOOL CFX_Win32FontInfo::GetFaceName(void* hFont, CFX_ByteString& name) { 422 FX_BOOL CFX_Win32FontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 delete pBitmap; 574 delete pBitmap;
575 } 575 }
576 } 576 }
577 return TRUE; 577 return TRUE;
578 } 578 }
579 FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1, 579 FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1,
580 int dest_left, 580 int dest_left,
581 int dest_top, 581 int dest_top,
582 int dest_width, 582 int dest_width,
583 int dest_height, 583 int dest_height,
584 FX_DWORD flags, 584 uint32_t flags,
585 void* pIccTransform) { 585 void* pIccTransform) {
586 CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; 586 CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1;
587 if (!pBitmap || dest_width == 0 || dest_height == 0) { 587 if (!pBitmap || dest_width == 0 || dest_height == 0) {
588 return FALSE; 588 return FALSE;
589 } 589 }
590 if ((pBitmap->IsCmykImage() || pIccTransform) && 590 if ((pBitmap->IsCmykImage() || pIccTransform) &&
591 !pBitmap->ConvertFormat(FXDIB_Rgb, pIccTransform)) { 591 !pBitmap->ConvertFormat(FXDIB_Rgb, pIccTransform)) {
592 return FALSE; 592 return FALSE;
593 } 593 }
594 CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); 594 CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
(...skipping 22 matching lines...) Expand all
617 if (del) { 617 if (del) {
618 delete pToStrechBitmap; 618 delete pToStrechBitmap;
619 } 619 }
620 return TRUE; 620 return TRUE;
621 } 621 }
622 FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(const CFX_DIBitmap* pBitmap1, 622 FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(const CFX_DIBitmap* pBitmap1,
623 int dest_left, 623 int dest_left,
624 int dest_top, 624 int dest_top,
625 int dest_width, 625 int dest_width,
626 int dest_height, 626 int dest_height,
627 FX_DWORD bitmap_color, 627 uint32_t bitmap_color,
628 FX_DWORD flags, 628 uint32_t flags,
629 int alpha_flag, 629 int alpha_flag,
630 void* pIccTransform) { 630 void* pIccTransform) {
631 CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; 631 CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1;
632 if (!pBitmap || dest_width == 0 || dest_height == 0) { 632 if (!pBitmap || dest_width == 0 || dest_height == 0) {
633 return FALSE; 633 return FALSE;
634 } 634 }
635 _Color2Argb(bitmap_color, bitmap_color, alpha_flag | (1 << 24), 635 _Color2Argb(bitmap_color, bitmap_color, alpha_flag | (1 << 24),
636 pIccTransform); 636 pIccTransform);
637 int width = pBitmap->GetWidth(), height = pBitmap->GetHeight(); 637 int width = pBitmap->GetWidth(), height = pBitmap->GetHeight();
638 struct { 638 struct {
639 BITMAPINFOHEADER bmiHeader; 639 BITMAPINFOHEADER bmiHeader;
640 FX_DWORD bmiColors[2]; 640 uint32_t bmiColors[2];
641 } bmi; 641 } bmi;
642 FXSYS_memset(&bmi.bmiHeader, 0, sizeof(BITMAPINFOHEADER)); 642 FXSYS_memset(&bmi.bmiHeader, 0, sizeof(BITMAPINFOHEADER));
643 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); 643 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
644 bmi.bmiHeader.biBitCount = 1; 644 bmi.bmiHeader.biBitCount = 1;
645 bmi.bmiHeader.biCompression = BI_RGB; 645 bmi.bmiHeader.biCompression = BI_RGB;
646 bmi.bmiHeader.biHeight = -height; 646 bmi.bmiHeader.biHeight = -height;
647 bmi.bmiHeader.biPlanes = 1; 647 bmi.bmiHeader.biPlanes = 1;
648 bmi.bmiHeader.biWidth = width; 648 bmi.bmiHeader.biWidth = width;
649 if (m_nBitsPerPixel != 1) { 649 if (m_nBitsPerPixel != 1) {
650 SetStretchBltMode(m_hDC, HALFTONE); 650 SetStretchBltMode(m_hDC, HALFTONE);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 } 684 }
685 FX_BOOL CGdiDeviceDriver::GetClipBox(FX_RECT* pRect) { 685 FX_BOOL CGdiDeviceDriver::GetClipBox(FX_RECT* pRect) {
686 return ::GetClipBox(m_hDC, (RECT*)pRect); 686 return ::GetClipBox(m_hDC, (RECT*)pRect);
687 } 687 }
688 FX_BOOL CGdiDeviceDriver::SetClipRgn(void* hRgn) { 688 FX_BOOL CGdiDeviceDriver::SetClipRgn(void* hRgn) {
689 ::SelectClipRgn(m_hDC, (HRGN)hRgn); 689 ::SelectClipRgn(m_hDC, (HRGN)hRgn);
690 return TRUE; 690 return TRUE;
691 } 691 }
692 static HPEN _CreatePen(const CFX_GraphStateData* pGraphState, 692 static HPEN _CreatePen(const CFX_GraphStateData* pGraphState,
693 const CFX_Matrix* pMatrix, 693 const CFX_Matrix* pMatrix,
694 FX_DWORD argb) { 694 uint32_t argb) {
695 FX_FLOAT width; 695 FX_FLOAT width;
696 FX_FLOAT scale = 1.f; 696 FX_FLOAT scale = 1.f;
697 if (pMatrix) 697 if (pMatrix)
698 scale = FXSYS_fabs(pMatrix->a) > FXSYS_fabs(pMatrix->b) 698 scale = FXSYS_fabs(pMatrix->a) > FXSYS_fabs(pMatrix->b)
699 ? FXSYS_fabs(pMatrix->a) 699 ? FXSYS_fabs(pMatrix->a)
700 : FXSYS_fabs(pMatrix->b); 700 : FXSYS_fabs(pMatrix->b);
701 if (pGraphState) { 701 if (pGraphState) {
702 width = scale * pGraphState->m_LineWidth; 702 width = scale * pGraphState->m_LineWidth;
703 } else { 703 } else {
704 width = 1.0f; 704 width = 1.0f;
705 } 705 }
706 FX_DWORD PenStyle = PS_GEOMETRIC; 706 uint32_t PenStyle = PS_GEOMETRIC;
707 if (width < 1) { 707 if (width < 1) {
708 width = 1; 708 width = 1;
709 } 709 }
710 if (pGraphState->m_DashCount) { 710 if (pGraphState->m_DashCount) {
711 PenStyle |= PS_USERSTYLE; 711 PenStyle |= PS_USERSTYLE;
712 } else { 712 } else {
713 PenStyle |= PS_SOLID; 713 PenStyle |= PS_SOLID;
714 } 714 }
715 switch (pGraphState->m_LineCap) { 715 switch (pGraphState->m_LineCap) {
716 case 0: 716 case 0:
(...skipping 17 matching lines...) Expand all
734 PenStyle |= PS_JOIN_BEVEL; 734 PenStyle |= PS_JOIN_BEVEL;
735 break; 735 break;
736 } 736 }
737 int a; 737 int a;
738 FX_COLORREF rgb; 738 FX_COLORREF rgb;
739 ArgbDecode(argb, a, rgb); 739 ArgbDecode(argb, a, rgb);
740 LOGBRUSH lb; 740 LOGBRUSH lb;
741 lb.lbColor = rgb; 741 lb.lbColor = rgb;
742 lb.lbStyle = BS_SOLID; 742 lb.lbStyle = BS_SOLID;
743 lb.lbHatch = 0; 743 lb.lbHatch = 0;
744 FX_DWORD* pDash = NULL; 744 uint32_t* pDash = NULL;
745 if (pGraphState->m_DashCount) { 745 if (pGraphState->m_DashCount) {
746 pDash = FX_Alloc(FX_DWORD, pGraphState->m_DashCount); 746 pDash = FX_Alloc(uint32_t, pGraphState->m_DashCount);
747 for (int i = 0; i < pGraphState->m_DashCount; i++) { 747 for (int i = 0; i < pGraphState->m_DashCount; i++) {
748 pDash[i] = FXSYS_round( 748 pDash[i] = FXSYS_round(
749 pMatrix ? pMatrix->TransformDistance(pGraphState->m_DashArray[i]) 749 pMatrix ? pMatrix->TransformDistance(pGraphState->m_DashArray[i])
750 : pGraphState->m_DashArray[i]); 750 : pGraphState->m_DashArray[i]);
751 if (pDash[i] < 1) { 751 if (pDash[i] < 1) {
752 pDash[i] = 1; 752 pDash[i] = 1;
753 } 753 }
754 } 754 }
755 } 755 }
756 HPEN hPen = ExtCreatePen(PenStyle, (DWORD)FXSYS_ceil(width), &lb, 756 HPEN hPen = ExtCreatePen(PenStyle, (DWORD)FXSYS_ceil(width), &lb,
757 pGraphState->m_DashCount, (const DWORD*)pDash); 757 pGraphState->m_DashCount, (const DWORD*)pDash);
758 FX_Free(pDash); 758 FX_Free(pDash);
759 return hPen; 759 return hPen;
760 } 760 }
761 static HBRUSH _CreateBrush(FX_DWORD argb) { 761 static HBRUSH _CreateBrush(uint32_t argb) {
762 int a; 762 int a;
763 FX_COLORREF rgb; 763 FX_COLORREF rgb;
764 ArgbDecode(argb, a, rgb); 764 ArgbDecode(argb, a, rgb);
765 return CreateSolidBrush(rgb); 765 return CreateSolidBrush(rgb);
766 } 766 }
767 static void _SetPathToDC(HDC hDC, 767 static void _SetPathToDC(HDC hDC,
768 const CFX_PathData* pPathData, 768 const CFX_PathData* pPathData,
769 const CFX_Matrix* pMatrix) { 769 const CFX_Matrix* pMatrix) {
770 BeginPath(hDC); 770 BeginPath(hDC);
771 int nPoints = pPathData->GetPointCount(); 771 int nPoints = pPathData->GetPointCount();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 MoveToEx(m_hDC, FXSYS_round(x1), FXSYS_round(y1), NULL); 844 MoveToEx(m_hDC, FXSYS_round(x1), FXSYS_round(y1), NULL);
845 LineTo(m_hDC, FXSYS_round(x2), FXSYS_round(y2)); 845 LineTo(m_hDC, FXSYS_round(x2), FXSYS_round(y2));
846 } 846 }
847 static FX_BOOL _MatrixNoScaled(const CFX_Matrix* pMatrix) { 847 static FX_BOOL _MatrixNoScaled(const CFX_Matrix* pMatrix) {
848 return pMatrix->GetA() == 1.0f && pMatrix->GetB() == 0 && 848 return pMatrix->GetA() == 1.0f && pMatrix->GetB() == 0 &&
849 pMatrix->GetC() == 0 && pMatrix->GetD() == 1.0f; 849 pMatrix->GetC() == 0 && pMatrix->GetD() == 1.0f;
850 } 850 }
851 FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, 851 FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData,
852 const CFX_Matrix* pMatrix, 852 const CFX_Matrix* pMatrix,
853 const CFX_GraphStateData* pGraphState, 853 const CFX_GraphStateData* pGraphState,
854 FX_DWORD fill_color, 854 uint32_t fill_color,
855 FX_DWORD stroke_color, 855 uint32_t stroke_color,
856 int fill_mode, 856 int fill_mode,
857 int alpha_flag, 857 int alpha_flag,
858 void* pIccTransform, 858 void* pIccTransform,
859 int blend_type) { 859 int blend_type) {
860 if (blend_type != FXDIB_BLEND_NORMAL) { 860 if (blend_type != FXDIB_BLEND_NORMAL) {
861 return FALSE; 861 return FALSE;
862 } 862 }
863 _Color2Argb(fill_color, fill_color, alpha_flag | (1 << 24), pIccTransform); 863 _Color2Argb(fill_color, fill_color, alpha_flag | (1 << 24), pIccTransform);
864 _Color2Argb(stroke_color, stroke_color, alpha_flag, pIccTransform); 864 _Color2Argb(stroke_color, stroke_color, alpha_flag, pIccTransform);
865 CWin32Platform* pPlatform = 865 CWin32Platform* pPlatform =
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 hPen = (HPEN)SelectObject(m_hDC, hPen); 954 hPen = (HPEN)SelectObject(m_hDC, hPen);
955 DeleteObject(hPen); 955 DeleteObject(hPen);
956 } 956 }
957 if (hBrush) { 957 if (hBrush) {
958 hBrush = (HBRUSH)SelectObject(m_hDC, hBrush); 958 hBrush = (HBRUSH)SelectObject(m_hDC, hBrush);
959 DeleteObject(hBrush); 959 DeleteObject(hBrush);
960 } 960 }
961 return TRUE; 961 return TRUE;
962 } 962 }
963 FX_BOOL CGdiDeviceDriver::FillRect(const FX_RECT* pRect, 963 FX_BOOL CGdiDeviceDriver::FillRect(const FX_RECT* pRect,
964 FX_DWORD fill_color, 964 uint32_t fill_color,
965 int alpha_flag, 965 int alpha_flag,
966 void* pIccTransform, 966 void* pIccTransform,
967 int blend_type) { 967 int blend_type) {
968 if (blend_type != FXDIB_BLEND_NORMAL) { 968 if (blend_type != FXDIB_BLEND_NORMAL) {
969 return FALSE; 969 return FALSE;
970 } 970 }
971 _Color2Argb(fill_color, fill_color, alpha_flag | (1 << 24), pIccTransform); 971 _Color2Argb(fill_color, fill_color, alpha_flag | (1 << 24), pIccTransform);
972 int alpha; 972 int alpha;
973 FX_COLORREF rgb; 973 FX_COLORREF rgb;
974 ArgbDecode(fill_color, alpha, rgb); 974 ArgbDecode(fill_color, alpha, rgb);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 SetPolyFillMode(m_hDC, WINDING); 1010 SetPolyFillMode(m_hDC, WINDING);
1011 FX_BOOL ret = SelectClipPath(m_hDC, RGN_AND); 1011 FX_BOOL ret = SelectClipPath(m_hDC, RGN_AND);
1012 hPen = (HPEN)SelectObject(m_hDC, hPen); 1012 hPen = (HPEN)SelectObject(m_hDC, hPen);
1013 DeleteObject(hPen); 1013 DeleteObject(hPen);
1014 return ret; 1014 return ret;
1015 } 1015 }
1016 FX_BOOL CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, 1016 FX_BOOL CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
1017 FX_FLOAT y1, 1017 FX_FLOAT y1,
1018 FX_FLOAT x2, 1018 FX_FLOAT x2,
1019 FX_FLOAT y2, 1019 FX_FLOAT y2,
1020 FX_DWORD color, 1020 uint32_t color,
1021 int alpha_flag, 1021 int alpha_flag,
1022 void* pIccTransform, 1022 void* pIccTransform,
1023 int blend_type) { 1023 int blend_type) {
1024 if (blend_type != FXDIB_BLEND_NORMAL) { 1024 if (blend_type != FXDIB_BLEND_NORMAL) {
1025 return FALSE; 1025 return FALSE;
1026 } 1026 }
1027 _Color2Argb(color, color, alpha_flag | (1 << 24), pIccTransform); 1027 _Color2Argb(color, color, alpha_flag | (1 << 24), pIccTransform);
1028 int a; 1028 int a;
1029 FX_COLORREF rgb; 1029 FX_COLORREF rgb;
1030 ArgbDecode(color, a, rgb); 1030 ArgbDecode(color, a, rgb);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 } 1091 }
1092 } 1092 }
1093 if (pBitmap->HasAlpha() && ret) { 1093 if (pBitmap->HasAlpha() && ret) {
1094 pBitmap->LoadChannel(FXDIB_Alpha, 0xff); 1094 pBitmap->LoadChannel(FXDIB_Alpha, 0xff);
1095 } 1095 }
1096 DeleteObject(hbmp); 1096 DeleteObject(hbmp);
1097 DeleteObject(hDCMemory); 1097 DeleteObject(hDCMemory);
1098 return ret; 1098 return ret;
1099 } 1099 }
1100 FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, 1100 FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource,
1101 FX_DWORD color, 1101 uint32_t color,
1102 const FX_RECT* pSrcRect, 1102 const FX_RECT* pSrcRect,
1103 int left, 1103 int left,
1104 int top, 1104 int top,
1105 int blend_type, 1105 int blend_type,
1106 int alpha_flag, 1106 int alpha_flag,
1107 void* pIccTransform) { 1107 void* pIccTransform) {
1108 ASSERT(blend_type == FXDIB_BLEND_NORMAL); 1108 ASSERT(blend_type == FXDIB_BLEND_NORMAL);
1109 if (pSource->IsAlphaMask()) { 1109 if (pSource->IsAlphaMask()) {
1110 int width = pSource->GetWidth(), height = pSource->GetHeight(); 1110 int width = pSource->GetWidth(), height = pSource->GetHeight();
1111 int alpha = FXGETFLAG_COLORTYPE(alpha_flag) 1111 int alpha = FXGETFLAG_COLORTYPE(alpha_flag)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 NULL); 1145 NULL);
1146 } 1146 }
1147 CFX_DIBExtractor temp(pSource); 1147 CFX_DIBExtractor temp(pSource);
1148 CFX_DIBitmap* pBitmap = temp; 1148 CFX_DIBitmap* pBitmap = temp;
1149 if (pBitmap) { 1149 if (pBitmap) {
1150 return GDI_SetDIBits(pBitmap, pSrcRect, left, top, pIccTransform); 1150 return GDI_SetDIBits(pBitmap, pSrcRect, left, top, pIccTransform);
1151 } 1151 }
1152 return FALSE; 1152 return FALSE;
1153 } 1153 }
1154 FX_BOOL CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource, 1154 FX_BOOL CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource,
1155 FX_DWORD color, 1155 uint32_t color,
1156 int dest_left, 1156 int dest_left,
1157 int dest_top, 1157 int dest_top,
1158 int dest_width, 1158 int dest_width,
1159 int dest_height, 1159 int dest_height,
1160 const FX_RECT* pClipRect, 1160 const FX_RECT* pClipRect,
1161 int render_flags, 1161 int render_flags,
1162 int alpha_flag, 1162 int alpha_flag,
1163 void* pIccTransform, 1163 void* pIccTransform,
1164 int blend_type) { 1164 int blend_type) {
1165 FX_RECT bitmap_clip = *pClipRect; 1165 FX_RECT bitmap_clip = *pClipRect;
(...skipping 10 matching lines...) Expand all
1176 return TRUE; 1176 return TRUE;
1177 } 1177 }
1178 FX_RECT src_rect(0, 0, pStretched->GetWidth(), pStretched->GetHeight()); 1178 FX_RECT src_rect(0, 0, pStretched->GetWidth(), pStretched->GetHeight());
1179 FX_BOOL ret = 1179 FX_BOOL ret =
1180 SetDIBits(pStretched, color, &src_rect, pClipRect->left, pClipRect->top, 1180 SetDIBits(pStretched, color, &src_rect, pClipRect->left, pClipRect->top,
1181 FXDIB_BLEND_NORMAL, alpha_flag, pIccTransform); 1181 FXDIB_BLEND_NORMAL, alpha_flag, pIccTransform);
1182 delete pStretched; 1182 delete pStretched;
1183 return ret; 1183 return ret;
1184 } 1184 }
1185 FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, 1185 FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource,
1186 FX_DWORD color, 1186 uint32_t color,
1187 int dest_left, 1187 int dest_left,
1188 int dest_top, 1188 int dest_top,
1189 int dest_width, 1189 int dest_width,
1190 int dest_height, 1190 int dest_height,
1191 const FX_RECT* pClipRect, 1191 const FX_RECT* pClipRect,
1192 FX_DWORD flags, 1192 uint32_t flags,
1193 int alpha_flag, 1193 int alpha_flag,
1194 void* pIccTransform, 1194 void* pIccTransform,
1195 int blend_type) { 1195 int blend_type) {
1196 ASSERT(pSource && pClipRect); 1196 ASSERT(pSource && pClipRect);
1197 if (flags || dest_width > 10000 || dest_width < -10000 || 1197 if (flags || dest_width > 10000 || dest_width < -10000 ||
1198 dest_height > 10000 || dest_height < -10000) { 1198 dest_height > 10000 || dest_height < -10000) {
1199 return UseFoxitStretchEngine(pSource, color, dest_left, dest_top, 1199 return UseFoxitStretchEngine(pSource, color, dest_left, dest_top,
1200 dest_width, dest_height, pClipRect, flags, 1200 dest_width, dest_height, pClipRect, flags,
1201 alpha_flag, pIccTransform, blend_type); 1201 alpha_flag, pIccTransform, blend_type);
1202 } 1202 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 } 1258 }
1259 return FALSE; 1259 return FALSE;
1260 } 1260 }
1261 #define GET_PS_FEATURESETTING 4121 1261 #define GET_PS_FEATURESETTING 4121
1262 #define FEATURESETTING_PSLEVEL 2 1262 #define FEATURESETTING_PSLEVEL 2
1263 int GetPSLevel(HDC hDC) { 1263 int GetPSLevel(HDC hDC) {
1264 int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY); 1264 int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY);
1265 if (device_type != DT_RASPRINTER) { 1265 if (device_type != DT_RASPRINTER) {
1266 return 0; 1266 return 0;
1267 } 1267 }
1268 FX_DWORD esc = GET_PS_FEATURESETTING; 1268 uint32_t esc = GET_PS_FEATURESETTING;
1269 if (ExtEscape(hDC, QUERYESCSUPPORT, sizeof esc, (char*)&esc, 0, NULL)) { 1269 if (ExtEscape(hDC, QUERYESCSUPPORT, sizeof esc, (char*)&esc, 0, NULL)) {
1270 int param = FEATURESETTING_PSLEVEL; 1270 int param = FEATURESETTING_PSLEVEL;
1271 if (ExtEscape(hDC, GET_PS_FEATURESETTING, sizeof(int), (char*)&param, 1271 if (ExtEscape(hDC, GET_PS_FEATURESETTING, sizeof(int), (char*)&param,
1272 sizeof(int), (char*)&param) > 0) { 1272 sizeof(int), (char*)&param) > 0) {
1273 return param; 1273 return param;
1274 } 1274 }
1275 } 1275 }
1276 esc = POSTSCRIPT_IDENTIFY; 1276 esc = POSTSCRIPT_IDENTIFY;
1277 if (ExtEscape(hDC, QUERYESCSUPPORT, sizeof esc, (char*)&esc, 0, NULL) == 0) { 1277 if (ExtEscape(hDC, QUERYESCSUPPORT, sizeof esc, (char*)&esc, 0, NULL) == 0) {
1278 esc = POSTSCRIPT_DATA; 1278 esc = POSTSCRIPT_DATA;
1279 if (ExtEscape(hDC, QUERYESCSUPPORT, sizeof esc, (char*)&esc, 0, NULL)) { 1279 if (ExtEscape(hDC, QUERYESCSUPPORT, sizeof esc, (char*)&esc, 0, NULL)) {
1280 return 2; 1280 return 2;
1281 } 1281 }
1282 return 0; 1282 return 0;
1283 } 1283 }
1284 esc = PSIDENT_GDICENTRIC; 1284 esc = PSIDENT_GDICENTRIC;
1285 if (ExtEscape(hDC, POSTSCRIPT_IDENTIFY, sizeof(FX_DWORD), (char*)&esc, 0, 1285 if (ExtEscape(hDC, POSTSCRIPT_IDENTIFY, sizeof(uint32_t), (char*)&esc, 0,
1286 NULL) <= 0) { 1286 NULL) <= 0) {
1287 return 2; 1287 return 2;
1288 } 1288 }
1289 esc = GET_PS_FEATURESETTING; 1289 esc = GET_PS_FEATURESETTING;
1290 if (ExtEscape(hDC, QUERYESCSUPPORT, sizeof esc, (char*)&esc, 0, NULL)) { 1290 if (ExtEscape(hDC, QUERYESCSUPPORT, sizeof esc, (char*)&esc, 0, NULL)) {
1291 int param = FEATURESETTING_PSLEVEL; 1291 int param = FEATURESETTING_PSLEVEL;
1292 if (ExtEscape(hDC, GET_PS_FEATURESETTING, sizeof(int), (char*)&param, 1292 if (ExtEscape(hDC, GET_PS_FEATURESETTING, sizeof(int), (char*)&param,
1293 sizeof(int), (char*)&param) > 0) { 1293 sizeof(int), (char*)&param) > 0) {
1294 return param; 1294 return param;
1295 } 1295 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 SelectObject(m_hDC, m_hOldBitmap); 1363 SelectObject(m_hDC, m_hOldBitmap);
1364 DeleteDC(m_hDC); 1364 DeleteDC(m_hDC);
1365 } 1365 }
1366 if (m_hBitmap) { 1366 if (m_hBitmap) {
1367 DeleteObject(m_hBitmap); 1367 DeleteObject(m_hBitmap);
1368 } 1368 }
1369 delete GetBitmap(); 1369 delete GetBitmap();
1370 } 1370 }
1371 1371
1372 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ 1372 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
OLDNEW
« no previous file with comments | « core/fxge/win32/dwrite_int.h ('k') | core/fxge/win32/fx_win32_dib.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698