| 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 "../../../include/fxge/fx_ge_win32.h" | 9 #include "../../../include/fxge/fx_ge_win32.h" |
| 10 #include <crtdbg.h> | 10 #include <crtdbg.h> |
| 11 #include "../agg/include/fxfx_agg_clip_liang_barsky.h" | 11 #include "../agg/include/fxfx_agg_clip_liang_barsky.h" |
| 12 #include "dwrite_int.h" | 12 #include "dwrite_int.h" |
| 13 #include "win32_int.h" | 13 #include "win32_int.h" |
| 14 #include "../ge/text_int.h" | 14 #include "../ge/text_int.h" |
| 15 #include "../dib/dib_int.h" | 15 #include "../dib/dib_int.h" |
| 16 #include "../agg/include/fx_agg_driver.h" | 16 #include "../agg/include/fx_agg_driver.h" |
| 17 #include "../../../include/fxge/fx_freetype.h" | 17 #include "../../../include/fxge/fx_freetype.h" |
| 18 #include "../../../include/fxcodec/fx_codec.h" | 18 #include "../../../include/fxcodec/fx_codec.h" |
| 19 class CWin32FontInfo final : public IFX_SystemFontInfo | 19 class CWin32FontInfo final : public IFX_SystemFontInfo |
| 20 { | 20 { |
| 21 public: | 21 public: |
| 22 CWin32FontInfo(); | 22 CWin32FontInfo(); |
| 23 ~CWin32FontInfo(); | 23 ~CWin32FontInfo(); |
| 24 virtual void Release(); | 24 virtual void Release(); |
| 25 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); | 25 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); |
| 26 virtual void*» » MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, FX_LPCSTR face, FX_BOOL& bExact); | 26 virtual void*» » MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact); |
| 27 virtual void*» » GetFont(FX_LPCSTR face) | 27 virtual void*» » GetFont(const FX_CHAR* face) |
| 28 { | 28 { |
| 29 return NULL; | 29 return NULL; |
| 30 } | 30 } |
| 31 virtual FX_DWORD» GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffe
r, FX_DWORD size); | 31 virtual FX_DWORD» GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer
, FX_DWORD size); |
| 32 virtual void DeleteFont(void* hFont); | 32 virtual void DeleteFont(void* hFont); |
| 33 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); | 33 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); |
| 34 virtual FX_BOOL GetFontCharset(void* hFont, int& charset); | 34 virtual FX_BOOL GetFontCharset(void* hFont, int& charset); |
| 35 FX_BOOL IsOpenTypeFromDiv(const LOGFONTA *plf); | 35 FX_BOOL IsOpenTypeFromDiv(const LOGFONTA *plf); |
| 36 FX_BOOL IsSupportFontFormDiv(const LOGFONTA* plf
); | 36 FX_BOOL IsSupportFontFormDiv(const LOGFONTA* plf
); |
| 37 void AddInstalledFont(const LOGFONTA *plf, FX
_DWORD FontType); | 37 void AddInstalledFont(const LOGFONTA *plf, FX
_DWORD FontType); |
| 38 void GetGBPreference(CFX_ByteString& face, in
t weight, int picth_family); | 38 void GetGBPreference(CFX_ByteString& face, in
t weight, int picth_family); |
| 39 void GetJapanesePreference(CFX_ByteString& fa
ce, int weight, int picth_family); | 39 void GetJapanesePreference(CFX_ByteString& fa
ce, int weight, int picth_family); |
| 40 CFX_ByteString FindFont(const CFX_ByteString& name); | 40 CFX_ByteString FindFont(const CFX_ByteString& name); |
| 41 HDC m_hDC; | 41 HDC m_hDC; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 lf.lfCharSet = DEFAULT_CHARSET; | 145 lf.lfCharSet = DEFAULT_CHARSET; |
| 146 lf.lfFaceName[0] = 0; | 146 lf.lfFaceName[0] = 0; |
| 147 lf.lfPitchAndFamily = 0; | 147 lf.lfPitchAndFamily = 0; |
| 148 EnumFontFamiliesExA(m_hDC, &lf, (FONTENUMPROCA)FontEnumProc, (uintptr_t)this
, 0); | 148 EnumFontFamiliesExA(m_hDC, &lf, (FONTENUMPROCA)FontEnumProc, (uintptr_t)this
, 0); |
| 149 if (pMapper->GetFontEnumerator()) { | 149 if (pMapper->GetFontEnumerator()) { |
| 150 pMapper->GetFontEnumerator()->Finish(); | 150 pMapper->GetFontEnumerator()->Finish(); |
| 151 } | 151 } |
| 152 return TRUE; | 152 return TRUE; |
| 153 } | 153 } |
| 154 static const struct { | 154 static const struct { |
| 155 FX_LPCSTR» m_pFaceName; | 155 const FX_CHAR*» m_pFaceName; |
| 156 FX_LPCSTR» m_pVariantName; | 156 const FX_CHAR*» m_pVariantName; |
| 157 } | 157 } |
| 158 VariantNames[] = { | 158 VariantNames[] = { |
| 159 {"DFKai-SB", "\x19\x6A\x77\x69\xD4\x9A"}, | 159 {"DFKai-SB", "\x19\x6A\x77\x69\xD4\x9A"}, |
| 160 }; | 160 }; |
| 161 static const struct { | 161 static const struct { |
| 162 FX_LPCSTR» m_pName; | 162 const FX_CHAR*» m_pName; |
| 163 FX_LPCSTR» m_pWinName; | 163 const FX_CHAR*» m_pWinName; |
| 164 FX_BOOL m_bBold; | 164 FX_BOOL m_bBold; |
| 165 FX_BOOL m_bItalic; | 165 FX_BOOL m_bItalic; |
| 166 } | 166 } |
| 167 Base14Substs[] = { | 167 Base14Substs[] = { |
| 168 {"Courier", "Courier New", FALSE, FALSE}, | 168 {"Courier", "Courier New", FALSE, FALSE}, |
| 169 {"Courier-Bold", "Courier New", TRUE, FALSE}, | 169 {"Courier-Bold", "Courier New", TRUE, FALSE}, |
| 170 {"Courier-BoldOblique", "Courier New", TRUE, TRUE}, | 170 {"Courier-BoldOblique", "Courier New", TRUE, TRUE}, |
| 171 {"Courier-Oblique", "Courier New", FALSE, TRUE}, | 171 {"Courier-Oblique", "Courier New", FALSE, TRUE}, |
| 172 {"Helvetica", "Arial", FALSE, FALSE}, | 172 {"Helvetica", "Arial", FALSE, FALSE}, |
| 173 {"Helvetica-Bold", "Arial", TRUE, FALSE}, | 173 {"Helvetica-Bold", "Arial", TRUE, FALSE}, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 190 if (thisname.Mid(1, name.GetLength()) == name) { | 190 if (thisname.Mid(1, name.GetLength()) == name) { |
| 191 return m_pMapper->m_InstalledTTFonts[i + 1]; | 191 return m_pMapper->m_InstalledTTFonts[i + 1]; |
| 192 } | 192 } |
| 193 } else if (thisname.Left(name.GetLength()) == name) { | 193 } else if (thisname.Left(name.GetLength()) == name) { |
| 194 return m_pMapper->m_InstalledTTFonts[i]; | 194 return m_pMapper->m_InstalledTTFonts[i]; |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 return CFX_ByteString(); | 197 return CFX_ByteString(); |
| 198 } | 198 } |
| 199 struct _FontNameMap { | 199 struct _FontNameMap { |
| 200 FX_LPCSTR» m_pSubFontName; | 200 const FX_CHAR*» m_pSubFontName; |
| 201 FX_LPCSTR» m_pSrcFontName; | 201 const FX_CHAR*» m_pSrcFontName; |
| 202 }; | 202 }; |
| 203 const _FontNameMap g_JpFontNameMap[] = { | 203 const _FontNameMap g_JpFontNameMap[] = { |
| 204 {"MS Mincho", "Heiseimin-W3"}, | 204 {"MS Mincho", "Heiseimin-W3"}, |
| 205 {"MS Gothic", "Jun101-Light"}, | 205 {"MS Gothic", "Jun101-Light"}, |
| 206 }; | 206 }; |
| 207 extern "C" { | 207 extern "C" { |
| 208 static int compareString(const void* key, const void* element) | 208 static int compareString(const void* key, const void* element) |
| 209 { | 209 { |
| 210 return FXSYS_stricmp((FX_LPCSTR)key, ((_FontNameMap*)element)->m_pSrcFon
tName); | 210 return FXSYS_stricmp((const FX_CHAR*)key, ((_FontNameMap*)element)->m_pS
rcFontName); |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 FX_BOOL _GetSubFontName(CFX_ByteString& name) | 213 FX_BOOL _GetSubFontName(CFX_ByteString& name) |
| 214 { | 214 { |
| 215 int size = sizeof g_JpFontNameMap; | 215 int size = sizeof g_JpFontNameMap; |
| 216 void* pFontnameMap = (void*)g_JpFontNameMap; | 216 void* pFontnameMap = (void*)g_JpFontNameMap; |
| 217 _FontNameMap* found = (_FontNameMap*)FXSYS_bsearch(name.c_str(), pFontnameMa
p, | 217 _FontNameMap* found = (_FontNameMap*)FXSYS_bsearch(name.c_str(), pFontnameMa
p, |
| 218 size / sizeof (_FontNameMap), sizeof (_FontNameMap), c
ompareString); | 218 size / sizeof (_FontNameMap), sizeof (_FontNameMap), c
ompareString); |
| 219 if (found == NULL) { | 219 if (found == NULL) { |
| 220 return FALSE; | 220 return FALSE; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } | 275 } |
| 276 if (_GetSubFontName(face)) { | 276 if (_GetSubFontName(face)) { |
| 277 return; | 277 return; |
| 278 } | 278 } |
| 279 if (!(picth_family & FF_ROMAN) && weight > 400) { | 279 if (!(picth_family & FF_ROMAN) && weight > 400) { |
| 280 face = "MS PGothic"; | 280 face = "MS PGothic"; |
| 281 } else { | 281 } else { |
| 282 face = "MS PMincho"; | 282 face = "MS PMincho"; |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 void* CWin32FontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitc
h_family, FX_LPCSTR cstr_face, FX_BOOL& bExact) | 285 void* CWin32FontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitc
h_family, const FX_CHAR* cstr_face, FX_BOOL& bExact) |
| 286 { | 286 { |
| 287 CFX_ByteString face = cstr_face; | 287 CFX_ByteString face = cstr_face; |
| 288 int iBaseFont; | 288 int iBaseFont; |
| 289 for (iBaseFont = 0; iBaseFont < 12; iBaseFont ++) | 289 for (iBaseFont = 0; iBaseFont < 12; iBaseFont ++) |
| 290 if (face == CFX_ByteStringC(Base14Substs[iBaseFont].m_pName)) { | 290 if (face == CFX_ByteStringC(Base14Substs[iBaseFont].m_pName)) { |
| 291 face = Base14Substs[iBaseFont].m_pWinName; | 291 face = Base14Substs[iBaseFont].m_pWinName; |
| 292 weight = Base14Substs[iBaseFont].m_bBold ? FW_BOLD : FW_NORMAL; | 292 weight = Base14Substs[iBaseFont].m_bBold ? FW_BOLD : FW_NORMAL; |
| 293 bItalic = Base14Substs[iBaseFont].m_bItalic; | 293 bItalic = Base14Substs[iBaseFont].m_bItalic; |
| 294 bExact = TRUE; | 294 bExact = TRUE; |
| 295 break; | 295 break; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 break; | 352 break; |
| 353 } | 353 } |
| 354 hFont = ::CreateFontA(-10, 0, 0, 0, weight, bItalic, 0, 0, charset, OUT_TT_O
NLY_PRECIS, | 354 hFont = ::CreateFontA(-10, 0, 0, 0, weight, bItalic, 0, 0, charset, OUT_TT_O
NLY_PRECIS, |
| 355 0, 0, subst_pitch_family, face); | 355 0, 0, subst_pitch_family, face); |
| 356 return hFont; | 356 return hFont; |
| 357 } | 357 } |
| 358 void CWin32FontInfo::DeleteFont(void* hFont) | 358 void CWin32FontInfo::DeleteFont(void* hFont) |
| 359 { | 359 { |
| 360 ::DeleteObject(hFont); | 360 ::DeleteObject(hFont); |
| 361 } | 361 } |
| 362 FX_DWORD CWin32FontInfo::GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buff
er, FX_DWORD size) | 362 FX_DWORD CWin32FontInfo::GetFontData(void* hFont, FX_DWORD table, uint8_t* buffe
r, FX_DWORD size) |
| 363 { | 363 { |
| 364 HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont); | 364 HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont); |
| 365 table = FXDWORD_FROM_MSBFIRST(table); | 365 table = FXDWORD_FROM_MSBFIRST(table); |
| 366 size = ::GetFontData(m_hDC, table, 0, buffer, size); | 366 size = ::GetFontData(m_hDC, table, 0, buffer, size); |
| 367 ::SelectObject(m_hDC, hOldFont); | 367 ::SelectObject(m_hDC, hOldFont); |
| 368 if (size == GDI_ERROR) { | 368 if (size == GDI_ERROR) { |
| 369 return 0; | 369 return 0; |
| 370 } | 370 } |
| 371 return size; | 371 return size; |
| 372 } | 372 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 return m_Width; | 449 return m_Width; |
| 450 case FXDC_PIXEL_HEIGHT: | 450 case FXDC_PIXEL_HEIGHT: |
| 451 return m_Height; | 451 return m_Height; |
| 452 case FXDC_BITS_PIXEL: | 452 case FXDC_BITS_PIXEL: |
| 453 return m_nBitsPerPixel; | 453 return m_nBitsPerPixel; |
| 454 case FXDC_RENDER_CAPS: | 454 case FXDC_RENDER_CAPS: |
| 455 return m_RenderCaps; | 455 return m_RenderCaps; |
| 456 } | 456 } |
| 457 return 0; | 457 return 0; |
| 458 } | 458 } |
| 459 FX_LPVOID CGdiDeviceDriver::GetClipRgn() | 459 void* CGdiDeviceDriver::GetClipRgn() |
| 460 { | 460 { |
| 461 HRGN hClipRgn = CreateRectRgn(0, 0, 1, 1); | 461 HRGN hClipRgn = CreateRectRgn(0, 0, 1, 1); |
| 462 if (::GetClipRgn(m_hDC, hClipRgn) == 0) { | 462 if (::GetClipRgn(m_hDC, hClipRgn) == 0) { |
| 463 DeleteObject(hClipRgn); | 463 DeleteObject(hClipRgn); |
| 464 hClipRgn = NULL; | 464 hClipRgn = NULL; |
| 465 } | 465 } |
| 466 return (FX_LPVOID)hClipRgn; | 466 return (void*)hClipRgn; |
| 467 } | 467 } |
| 468 FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(const CFX_DIBitmap* pBitmap1, const FX_R
ECT* pSrcRect, int left, int top, void* pIccTransform) | 468 FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(const CFX_DIBitmap* pBitmap1, const FX_R
ECT* pSrcRect, int left, int top, void* pIccTransform) |
| 469 { | 469 { |
| 470 if (m_DeviceClass == FXDC_PRINTER) { | 470 if (m_DeviceClass == FXDC_PRINTER) { |
| 471 CFX_DIBitmap* pBitmap = pBitmap1->FlipImage(FALSE, TRUE); | 471 CFX_DIBitmap* pBitmap = pBitmap1->FlipImage(FALSE, TRUE); |
| 472 if (pBitmap == NULL) { | 472 if (pBitmap == NULL) { |
| 473 return FALSE; | 473 return FALSE; |
| 474 } | 474 } |
| 475 if ((pBitmap->IsCmykImage() || pIccTransform) && | 475 if ((pBitmap->IsCmykImage() || pIccTransform) && |
| 476 !pBitmap->ConvertFormat(FXDIB_Rgb, pIccTransform)) { | 476 !pBitmap->ConvertFormat(FXDIB_Rgb, pIccTransform)) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 | 590 |
| 591 SelectObject(m_hDC, hOld); | 591 SelectObject(m_hDC, hOld); |
| 592 DeleteObject(hPattern); | 592 DeleteObject(hPattern); |
| 593 | 593 |
| 594 return TRUE; | 594 return TRUE; |
| 595 } | 595 } |
| 596 BOOL CGdiDeviceDriver::GetClipBox(FX_RECT* pRect) | 596 BOOL CGdiDeviceDriver::GetClipBox(FX_RECT* pRect) |
| 597 { | 597 { |
| 598 return ::GetClipBox(m_hDC, (RECT*)pRect); | 598 return ::GetClipBox(m_hDC, (RECT*)pRect); |
| 599 } | 599 } |
| 600 FX_BOOL CGdiDeviceDriver::SetClipRgn(FX_LPVOID hRgn) | 600 FX_BOOL CGdiDeviceDriver::SetClipRgn(void* hRgn) |
| 601 { | 601 { |
| 602 ::SelectClipRgn(m_hDC, (HRGN)hRgn); | 602 ::SelectClipRgn(m_hDC, (HRGN)hRgn); |
| 603 return TRUE; | 603 return TRUE; |
| 604 } | 604 } |
| 605 static HPEN _CreatePen(const CFX_GraphStateData* pGraphState, const CFX_AffineMa
trix* pMatrix, FX_DWORD argb) | 605 static HPEN _CreatePen(const CFX_GraphStateData* pGraphState, const CFX_AffineMa
trix* pMatrix, FX_DWORD argb) |
| 606 { | 606 { |
| 607 FX_FLOAT width; | 607 FX_FLOAT width; |
| 608 FX_FLOAT scale = 1.f; | 608 FX_FLOAT scale = 1.f; |
| 609 if (pMatrix) | 609 if (pMatrix) |
| 610 scale = FXSYS_fabs(pMatrix->a) > FXSYS_fabs(pMatrix->b) ? | 610 scale = FXSYS_fabs(pMatrix->a) > FXSYS_fabs(pMatrix->b) ? |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 return TRUE; | 920 return TRUE; |
| 921 } | 921 } |
| 922 HPEN hPen = CreatePen(PS_SOLID, 1, rgb); | 922 HPEN hPen = CreatePen(PS_SOLID, 1, rgb); |
| 923 hPen = (HPEN)SelectObject(m_hDC, hPen); | 923 hPen = (HPEN)SelectObject(m_hDC, hPen); |
| 924 MoveToEx(m_hDC, FXSYS_round(x1), FXSYS_round(y1), NULL); | 924 MoveToEx(m_hDC, FXSYS_round(x1), FXSYS_round(y1), NULL); |
| 925 LineTo(m_hDC, FXSYS_round(x2), FXSYS_round(y2)); | 925 LineTo(m_hDC, FXSYS_round(x2), FXSYS_round(y2)); |
| 926 hPen = (HPEN)SelectObject(m_hDC, hPen); | 926 hPen = (HPEN)SelectObject(m_hDC, hPen); |
| 927 DeleteObject(hPen); | 927 DeleteObject(hPen); |
| 928 return TRUE; | 928 return TRUE; |
| 929 } | 929 } |
| 930 FX_BOOL CGdiDeviceDriver::DeleteDeviceRgn(FX_LPVOID pRgn) | 930 FX_BOOL CGdiDeviceDriver::DeleteDeviceRgn(void* pRgn) |
| 931 { | 931 { |
| 932 DeleteObject((HGDIOBJ)pRgn); | 932 DeleteObject((HGDIOBJ)pRgn); |
| 933 return TRUE; | 933 return TRUE; |
| 934 } | 934 } |
| 935 CGdiDisplayDriver::CGdiDisplayDriver(HDC hDC) : CGdiDeviceDriver(hDC, FXDC_DISPL
AY) | 935 CGdiDisplayDriver::CGdiDisplayDriver(HDC hDC) : CGdiDeviceDriver(hDC, FXDC_DISPL
AY) |
| 936 { | 936 { |
| 937 CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatfor
mData(); | 937 CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatfor
mData(); |
| 938 if (pPlatform->m_GdiplusExt.IsAvailable()) { | 938 if (pPlatform->m_GdiplusExt.IsAvailable()) { |
| 939 m_RenderCaps |= FXRC_ALPHA_PATH | FXRC_ALPHA_IMAGE; | 939 m_RenderCaps |= FXRC_ALPHA_PATH | FXRC_ALPHA_IMAGE; |
| 940 } | 940 } |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 } | 1169 } |
| 1170 CFX_WinBitmapDevice::CFX_WinBitmapDevice(int width, int height, FXDIB_Format for
mat) | 1170 CFX_WinBitmapDevice::CFX_WinBitmapDevice(int width, int height, FXDIB_Format for
mat) |
| 1171 { | 1171 { |
| 1172 BITMAPINFOHEADER bmih; | 1172 BITMAPINFOHEADER bmih; |
| 1173 FXSYS_memset32(&bmih, 0, sizeof (BITMAPINFOHEADER)); | 1173 FXSYS_memset32(&bmih, 0, sizeof (BITMAPINFOHEADER)); |
| 1174 bmih.biSize = sizeof(BITMAPINFOHEADER); | 1174 bmih.biSize = sizeof(BITMAPINFOHEADER); |
| 1175 bmih.biBitCount = format & 0xff; | 1175 bmih.biBitCount = format & 0xff; |
| 1176 bmih.biHeight = -height; | 1176 bmih.biHeight = -height; |
| 1177 bmih.biPlanes = 1; | 1177 bmih.biPlanes = 1; |
| 1178 bmih.biWidth = width; | 1178 bmih.biWidth = width; |
| 1179 FX_LPBYTE pBuffer; | 1179 uint8_t* pBuffer; |
| 1180 m_hBitmap = CreateDIBSection(NULL, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, (FX_L
PVOID*)&pBuffer, NULL, 0); | 1180 m_hBitmap = CreateDIBSection(NULL, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, (void
**)&pBuffer, NULL, 0); |
| 1181 if (m_hBitmap == NULL) { | 1181 if (m_hBitmap == NULL) { |
| 1182 return; | 1182 return; |
| 1183 } | 1183 } |
| 1184 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; | 1184 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; |
| 1185 pBitmap->Create(width, height, format, pBuffer); | 1185 pBitmap->Create(width, height, format, pBuffer); |
| 1186 SetBitmap(pBitmap); | 1186 SetBitmap(pBitmap); |
| 1187 m_hDC = ::CreateCompatibleDC(NULL); | 1187 m_hDC = ::CreateCompatibleDC(NULL); |
| 1188 m_hOldBitmap = (HBITMAP)SelectObject(m_hDC, m_hBitmap); | 1188 m_hOldBitmap = (HBITMAP)SelectObject(m_hDC, m_hBitmap); |
| 1189 IFX_RenderDeviceDriver* pDriver = new CGdiDisplayDriver(m_hDC); | 1189 IFX_RenderDeviceDriver* pDriver = new CGdiDisplayDriver(m_hDC); |
| 1190 SetDeviceDriver(pDriver); | 1190 SetDeviceDriver(pDriver); |
| 1191 } | 1191 } |
| 1192 CFX_WinBitmapDevice::~CFX_WinBitmapDevice() | 1192 CFX_WinBitmapDevice::~CFX_WinBitmapDevice() |
| 1193 { | 1193 { |
| 1194 if (m_hDC) { | 1194 if (m_hDC) { |
| 1195 SelectObject(m_hDC, m_hOldBitmap); | 1195 SelectObject(m_hDC, m_hOldBitmap); |
| 1196 DeleteDC(m_hDC); | 1196 DeleteDC(m_hDC); |
| 1197 } | 1197 } |
| 1198 if (m_hBitmap) { | 1198 if (m_hBitmap) { |
| 1199 DeleteObject(m_hBitmap); | 1199 DeleteObject(m_hBitmap); |
| 1200 } | 1200 } |
| 1201 delete GetBitmap(); | 1201 delete GetBitmap(); |
| 1202 } | 1202 } |
| 1203 #endif | 1203 #endif |
| OLD | NEW |