diff options
Diffstat (limited to 'core/fxge/win32')
-rw-r--r-- | core/fxge/win32/cfx_psrenderer.cpp | 4 | ||||
-rw-r--r-- | core/fxge/win32/cfx_windowsdib.h | 3 | ||||
-rw-r--r-- | core/fxge/win32/cpsoutput.cpp | 2 | ||||
-rw-r--r-- | core/fxge/win32/cpsoutput.h | 2 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_device.cpp | 52 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_dib.cpp | 12 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_gdipext.cpp | 2 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_print.cpp | 8 |
8 files changed, 41 insertions, 44 deletions
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index c02058d1dd..5586d9f921 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp @@ -669,9 +669,9 @@ bool CFX_PSRenderer::DrawText(int nChars, last_fontnum = ps_fontnum; } buf << pCharPos[i].m_Origin.x << " " << pCharPos[i].m_Origin.y << " m"; - CFX_ByteString hex; + ByteString hex; hex.Format("<%02X>", ps_glyphindex); - buf << hex.AsStringC() << "Tj\n"; + buf << hex.AsStringView() << "Tj\n"; } buf << "Q\n"; m_pStream->WriteBlock(buf.str().c_str(), buf.tellp()); diff --git a/core/fxge/win32/cfx_windowsdib.h b/core/fxge/win32/cfx_windowsdib.h index 3ecbb5835d..28f152acfa 100644 --- a/core/fxge/win32/cfx_windowsdib.h +++ b/core/fxge/win32/cfx_windowsdib.h @@ -33,8 +33,7 @@ class CFX_WindowsDIB : public CFX_DIBitmap { ~CFX_WindowsDIB() override; - static CFX_ByteString GetBitmapInfo( - const CFX_RetainPtr<CFX_DIBitmap>& pBitmap); + static ByteString GetBitmapInfo(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap); static HBITMAP GetDDBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, HDC hDC); diff --git a/core/fxge/win32/cpsoutput.cpp b/core/fxge/win32/cpsoutput.cpp index 1af6dbdced..83f2fc09c6 100644 --- a/core/fxge/win32/cpsoutput.cpp +++ b/core/fxge/win32/cpsoutput.cpp @@ -31,6 +31,6 @@ bool CPSOutput::WriteBlock(const void* str, size_t len) { return true; } -bool CPSOutput::WriteString(const CFX_ByteStringC& str) { +bool CPSOutput::WriteString(const ByteStringView& str) { return WriteBlock(str.unterminated_c_str(), str.GetLength()); } diff --git a/core/fxge/win32/cpsoutput.h b/core/fxge/win32/cpsoutput.h index 42ad109a80..d140de95f4 100644 --- a/core/fxge/win32/cpsoutput.h +++ b/core/fxge/win32/cpsoutput.h @@ -19,7 +19,7 @@ class CPSOutput : public IFX_WriteStream { // IFX_Writestream bool WriteBlock(const void* str, size_t len) override; - bool WriteString(const CFX_ByteStringC& str) override; + bool WriteString(const ByteStringView& str) override; private: HDC m_hDC; diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index 9c8da591c6..bb7bf6fea1 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -73,7 +73,7 @@ const FontNameMap g_JpFontNameMap[] = { {"MS Gothic", "Jun101-Light"}, }; -bool GetSubFontName(CFX_ByteString* name) { +bool GetSubFontName(ByteString* name) { for (size_t i = 0; i < FX_ArraySize(g_JpFontNameMap); ++i) { if (!FXSYS_stricmp(name->c_str(), g_JpFontNameMap[i].m_pSrcFontName)) { *name = g_JpFontNameMap[i].m_pSubFontName; @@ -349,23 +349,21 @@ class CFX_Win32FontInfo final : public IFX_SystemFontInfo { uint32_t table, uint8_t* buffer, uint32_t size) override; - bool GetFaceName(void* hFont, CFX_ByteString* name) override; + bool GetFaceName(void* hFont, ByteString* name) override; bool GetFontCharset(void* hFont, int* charset) override; void DeleteFont(void* hFont) override; bool IsOpenTypeFromDiv(const LOGFONTA* plf); bool IsSupportFontFormDiv(const LOGFONTA* plf); void AddInstalledFont(const LOGFONTA* plf, uint32_t FontType); - void GetGBPreference(CFX_ByteString& face, int weight, int picth_family); - void GetJapanesePreference(CFX_ByteString& face, - int weight, - int picth_family); - CFX_ByteString FindFont(const CFX_ByteString& name); + void GetGBPreference(ByteString& face, int weight, int picth_family); + void GetJapanesePreference(ByteString& face, int weight, int picth_family); + ByteString FindFont(const ByteString& name); HDC m_hDC; CFX_UnownedPtr<CFX_FontMapper> m_pMapper; - CFX_ByteString m_LastFamily; - CFX_ByteString m_KaiTi, m_FangSong; + ByteString m_LastFamily; + ByteString m_KaiTi, m_FangSong; }; int CALLBACK FontEnumProc(const LOGFONTA* plf, @@ -429,7 +427,7 @@ bool CFX_Win32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) { void CFX_Win32FontInfo::AddInstalledFont(const LOGFONTA* plf, uint32_t FontType) { - CFX_ByteString name(plf->lfFaceName); + ByteString name(plf->lfFaceName); if (name.GetLength() > 0 && name[0] == '@') return; @@ -458,21 +456,21 @@ bool CFX_Win32FontInfo::EnumFontList(CFX_FontMapper* pMapper) { return true; } -CFX_ByteString CFX_Win32FontInfo::FindFont(const CFX_ByteString& name) { +ByteString CFX_Win32FontInfo::FindFont(const ByteString& name) { if (!m_pMapper) return name; for (size_t i = 0; i < m_pMapper->m_InstalledTTFonts.size(); ++i) { - CFX_ByteString thisname = m_pMapper->m_InstalledTTFonts[i]; + ByteString thisname = m_pMapper->m_InstalledTTFonts[i]; if (thisname.Left(name.GetLength()) == name) return m_pMapper->m_InstalledTTFonts[i]; } for (size_t i = 0; i < m_pMapper->m_LocalizedTTFonts.size(); ++i) { - CFX_ByteString thisname = m_pMapper->m_LocalizedTTFonts[i].first; + ByteString thisname = m_pMapper->m_LocalizedTTFonts[i].first; if (thisname.Left(name.GetLength()) == name) return m_pMapper->m_LocalizedTTFonts[i].second; } - return CFX_ByteString(); + return ByteString(); } void* CFX_Win32FallbackFontInfo::MapFont(int weight, @@ -500,7 +498,7 @@ void* CFX_Win32FallbackFontInfo::MapFont(int weight, return FindFont(weight, bItalic, charset, pitch_family, cstr_face, !bCJK); } -void CFX_Win32FontInfo::GetGBPreference(CFX_ByteString& face, +void CFX_Win32FontInfo::GetGBPreference(ByteString& face, int weight, int picth_family) { if (face.Contains("KaiTi") || face.Contains("\xbf\xac")) { @@ -530,7 +528,7 @@ void CFX_Win32FontInfo::GetGBPreference(CFX_ByteString& face, } } -void CFX_Win32FontInfo::GetJapanesePreference(CFX_ByteString& face, +void CFX_Win32FontInfo::GetJapanesePreference(ByteString& face, int weight, int picth_family) { if (face.Contains("Gothic") || @@ -573,10 +571,10 @@ void* CFX_Win32FontInfo::MapFont(int weight, int pitch_family, const char* cstr_face, int& iExact) { - CFX_ByteString face = cstr_face; + ByteString face = cstr_face; int iBaseFont; for (iBaseFont = 0; iBaseFont < 12; iBaseFont++) - if (face == CFX_ByteStringC(g_Base14Substs[iBaseFont].m_pName)) { + if (face == ByteStringView(g_Base14Substs[iBaseFont].m_pName)) { face = g_Base14Substs[iBaseFont].m_pWinName; weight = g_Base14Substs[iBaseFont].m_bBold ? FW_BOLD : FW_NORMAL; bItalic = g_Base14Substs[iBaseFont].m_bItalic; @@ -607,15 +605,15 @@ void* CFX_Win32FontInfo::MapFont(int weight, if (face.EqualNoCase(facebuf)) return hFont; - CFX_WideString wsFace = CFX_WideString::FromLocal(facebuf); + WideString wsFace = WideString::FromLocal(facebuf); for (size_t i = 0; i < FX_ArraySize(g_VariantNames); ++i) { if (face != g_VariantNames[i].m_pFaceName) continue; const unsigned short* pName = reinterpret_cast<const unsigned short*>( g_VariantNames[i].m_pVariantName); - FX_STRSIZE len = CFX_WideString::WStringLength(pName); - CFX_WideString wsName = CFX_WideString::FromUTF16LE(pName, len); + FX_STRSIZE len = WideString::WStringLength(pName); + WideString wsName = WideString::FromUTF16LE(pName, len); if (wsFace == wsName) return hFont; } @@ -665,7 +663,7 @@ uint32_t CFX_Win32FontInfo::GetFontData(void* hFont, return size; } -bool CFX_Win32FontInfo::GetFaceName(void* hFont, CFX_ByteString* name) { +bool CFX_Win32FontInfo::GetFaceName(void* hFont, ByteString* name) { char facebuf[100]; HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont); int ret = ::GetTextFaceA(m_hDC, 100, facebuf); @@ -702,7 +700,7 @@ std::unique_ptr<IFX_SystemFontInfo> IFX_SystemFontInfo::CreateDefault( CHAR windows_path[MAX_PATH] = {}; DWORD path_len = ::GetWindowsDirectoryA(windows_path, MAX_PATH); if (path_len > 0 && path_len < MAX_PATH) { - CFX_ByteString fonts_path(windows_path); + ByteString fonts_path(windows_path); fonts_path += "\\Fonts"; pInfoFallback->AddPath(fonts_path); } @@ -799,7 +797,7 @@ bool CGdiDeviceDriver::GDI_SetDIBits( int width = pSrcRect->Width(), height = pSrcRect->Height(); LPBYTE pBuffer = pBitmap->GetBuffer(); - CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); + ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); ((BITMAPINFOHEADER*)info.c_str())->biHeight *= -1; FX_RECT dst_rect(0, 0, width, height); dst_rect.Intersect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight()); @@ -817,7 +815,7 @@ bool CGdiDeviceDriver::GDI_SetDIBits( } int width = pSrcRect->Width(), height = pSrcRect->Height(); LPBYTE pBuffer = pBitmap->GetBuffer(); - CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); + ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); ::SetDIBitsToDevice(m_hDC, left, top, width, height, pSrcRect->left, pBitmap->GetHeight() - pSrcRect->bottom, 0, pBitmap->GetHeight(), pBuffer, @@ -840,7 +838,7 @@ bool CGdiDeviceDriver::GDI_StretchDIBits( if (pBitmap->IsCmykImage() && !pBitmap->ConvertFormat(FXDIB_Rgb)) return false; - CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); + ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); if ((int64_t)abs(dest_width) * abs(dest_height) < (int64_t)pBitmap1->GetWidth() * pBitmap1->GetHeight() * 4 || (flags & FXDIB_INTERPOL) || (flags & FXDIB_BICUBIC_INTERPOL)) { @@ -854,7 +852,7 @@ bool CGdiDeviceDriver::GDI_StretchDIBits( (int64_t)abs(dest_width) * abs(dest_height))) { pToStrechBitmap = pBitmap->StretchTo(dest_width, dest_height, 0, nullptr); } - CFX_ByteString toStrechBitmapInfo = + ByteString toStrechBitmapInfo = CFX_WindowsDIB::GetBitmapInfo(pToStrechBitmap); ::StretchDIBits(m_hDC, dest_left, dest_top, dest_width, dest_height, 0, 0, pToStrechBitmap->GetWidth(), pToStrechBitmap->GetHeight(), diff --git a/core/fxge/win32/fx_win32_dib.cpp b/core/fxge/win32/fx_win32_dib.cpp index d1e5688ee1..c00543b169 100644 --- a/core/fxge/win32/fx_win32_dib.cpp +++ b/core/fxge/win32/fx_win32_dib.cpp @@ -11,9 +11,9 @@ #include "core/fxge/win32/cfx_windowsdib.h" #include "core/fxge/win32/win32_int.h" -CFX_ByteString CFX_WindowsDIB::GetBitmapInfo( +ByteString CFX_WindowsDIB::GetBitmapInfo( const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) { - CFX_ByteString result; + ByteString result; int len = sizeof(BITMAPINFOHEADER); if (pBitmap->GetBPP() == 1 || pBitmap->GetBPP() == 8) { len += sizeof(DWORD) * (int)(1 << pBitmap->GetBPP()); @@ -102,7 +102,7 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromBuf(BITMAPINFO* pbmi, HBITMAP CFX_WindowsDIB::GetDDBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, HDC hDC) { - CFX_ByteString info = GetBitmapInfo(pBitmap); + ByteString info = GetBitmapInfo(pBitmap); return CreateDIBitmap(hDC, (BITMAPINFOHEADER*)info.c_str(), CBM_INIT, pBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS); @@ -139,7 +139,7 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromFile( DeleteDC(hDC); return nullptr; } - CFX_ByteString info = GetBitmapInfo(pDIBitmap); + ByteString info = GetBitmapInfo(pDIBitmap); int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS); DeleteDC(hDC); @@ -149,7 +149,7 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromFile( } CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromFile(const char* filename) { - return LoadFromFile(CFX_WideString::FromLocal(filename).c_str()); + return LoadFromFile(WideString::FromLocal(filename).c_str()); } CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadDIBitmap( @@ -175,7 +175,7 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadDIBitmap( DeleteDC(hDC); return nullptr; } - CFX_ByteString info = GetBitmapInfo(pDIBitmap); + ByteString info = GetBitmapInfo(pDIBitmap); int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS); DeleteDC(hDC); diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp index 04788d6138..8161c5d333 100644 --- a/core/fxge/win32/fx_win32_gdipext.cpp +++ b/core/fxge/win32/fx_win32_gdipext.cpp @@ -682,7 +682,7 @@ CGdiplusExt::CGdiplusExt() { m_pGdiRemoveFontMemResourseEx = nullptr; } void CGdiplusExt::Load() { - CFX_ByteString strPlusPath = ""; + ByteString strPlusPath = ""; char buf[MAX_PATH]; GetSystemDirectoryA(buf, MAX_PATH); strPlusPath += buf; diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp index ecd7be57c7..fa2c8b7ef3 100644 --- a/core/fxge/win32/fx_win32_print.cpp +++ b/core/fxge/win32/fx_win32_print.cpp @@ -232,7 +232,7 @@ bool CGdiPrinterDriver::DrawDeviceText(int nChars, lf.lfItalic = pFont->IsItalic(); lf.lfCharSet = DEFAULT_CHARSET; - const CFX_WideString wsName = pFont->GetFaceName().UTF8Decode(); + const WideString wsName = pFont->GetFaceName().UTF8Decode(); size_t iNameLen = std::min(wsName.GetLength(), static_cast<size_t>(LF_FACESIZE - 1)); memcpy(lf.lfFaceName, wsName.c_str(), sizeof(lf.lfFaceName[0]) * iNameLen); @@ -288,7 +288,7 @@ bool CGdiPrinterDriver::DrawDeviceText(int nChars, SetBkMode(m_hDC, TRANSPARENT); // Text - CFX_WideString wsText; + WideString wsText; std::vector<INT> spacing(nChars); float fPreviousOriginX = 0; for (int i = 0; i < nChars; ++i) { @@ -609,7 +609,7 @@ bool CTextOnlyPrinterDriver::DrawDeviceText(int nChars, // errors below. Value chosen based on the title of https://crbug.com/18383 const double kScaleFactor = 10; - CFX_WideString wsText; + WideString wsText; int totalLength = nChars; // Detect new lines and add clrf characters (since this is Windows only). @@ -638,7 +638,7 @@ bool CTextOnlyPrinterDriver::DrawDeviceText(int nChars, wsText += charpos.m_Unicode; } size_t len = totalLength; - CFX_ByteString text = CFX_ByteString::FromUnicode(wsText); + ByteString text = ByteString::FromUnicode(wsText); while (len > 0) { char buffer[1026]; size_t send_len = std::min(len, static_cast<size_t>(1024)); |