aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl/libui
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-09-19 20:48:18 +0200
committerStapleButter <thetotalworm@gmail.com>2017-09-19 20:48:18 +0200
commitdbefaf0ad3a0a68f7e85c8ec1c6a4d39cacbd94b (patch)
tree2a5d83675e022eeab579b68f227e330684e220c2 /src/libui_sdl/libui
parentdefe46e37edeedf04697034190548dbc2af56202 (diff)
Windows: fix colors. use fallback if hardware render mode doesn't work.
Diffstat (limited to 'src/libui_sdl/libui')
-rw-r--r--src/libui_sdl/libui/windows/draw.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/libui_sdl/libui/windows/draw.cpp b/src/libui_sdl/libui/windows/draw.cpp
index c28af0c..11ee048 100644
--- a/src/libui_sdl/libui/windows/draw.cpp
+++ b/src/libui_sdl/libui/windows/draw.cpp
@@ -63,7 +63,16 @@ ID2D1HwndRenderTarget *makeHWNDRenderTarget(HWND hwnd)
&hprops,
&rt);
if (hr != S_OK)
- logHRESULT(L"error creating HWND render target", hr);
+ {
+ props.type = D2D1_RENDER_TARGET_TYPE_DEFAULT;
+ hr = d2dfactory->CreateHwndRenderTarget(
+ &props,
+ &hprops,
+ &rt);
+ if (hr != S_OK)
+ logHRESULT(L"error creating HWND render target", hr);
+ }
+
return rt;
}
@@ -523,9 +532,7 @@ uiDrawBitmap* uiDrawNewBitmap(uiDrawContext* c, int width, int height)
D2D1_BITMAP_PROPERTIES bp2 = D2D1::BitmapProperties();
bp2.dpiX = 0;
bp2.dpiY = 0;
- bp2.pixelFormat = D2D1::PixelFormat(DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_IGNORE);
- //bp2.pixelFormat = D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE);
- // TODO: fallback: convert to BGRA if needed (RGBA only works in hardware mode)
+ bp2.pixelFormat = D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE);
c->rt->BeginDraw();