More lenient emoji check, remove unused variable

This commit is contained in:
Henrik Rydgård 2023-08-06 16:03:15 +02:00
parent 83dbc60d86
commit 5533d5ec57
3 changed files with 7 additions and 7 deletions

View File

@ -26,10 +26,11 @@ int u8_strlen(const char *s);
void u8_inc(const char *s, int *i);
void u8_dec(const char *s, int *i);
// ranges grabbed from https://stackoverflow.com/a/62898106, ignoring the two bogus ranges.
// there's probably more. Doesn't need to be perfect.
inline bool CodepointIsProbablyEmoji(uint32_t c) {
return (c >= 127744 && c <= 129782) || (c >= 126980 && c <= 127569);
// Original check was some ranges grabbed from https://stackoverflow.com/a/62898106.
// But let's just go with checking if outside the BMP, it's not a big deal if we accidentally
// switch to color when not needed if someone uses a weird glyph.
return c > 0xFFFF;
}
bool AnyEmojiInString(const char *s, size_t byteCount);

View File

@ -181,8 +181,8 @@ private:
HWND hWnd_;
ID3D11Device *device_;
ID3D11DeviceContext *context_;
ID3D11Device1 *device1_;
ID3D11DeviceContext *context_;
ID3D11DeviceContext1 *context1_;
ID3D11Texture2D *bbRenderTargetTex_ = nullptr; // NOT OWNED

View File

@ -181,10 +181,9 @@ bool D3D11Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) {
GetRes(hWnd_, width, height);
// Obtain DXGI factory from device (since we used nullptr for pAdapter above)
IDXGIFactory1* dxgiFactory = nullptr;
IDXGIFactory1 *dxgiFactory = nullptr;
IDXGIDevice *dxgiDevice = nullptr;
IDXGIDevice1* dxgiDevice1 = nullptr;
IDXGIAdapter* adapter = nullptr;
IDXGIAdapter *adapter = nullptr;
hr = device_->QueryInterface(__uuidof(IDXGIDevice), reinterpret_cast<void**>(&dxgiDevice));
if (SUCCEEDED(hr)) {
hr = dxgiDevice->GetAdapter(&adapter);