Separate a big function call to several functions

This commit is contained in:
ivan100sic 2020-11-11 17:57:24 +01:00
parent d50ae7489e
commit f2469415d2

View File

@ -66,6 +66,7 @@ D2D1_RECT_F ZoneWindowDrawing::ConvertRect(RECT rect)
ZoneWindowDrawing::ZoneWindowDrawing(HWND window)
{
HRESULT hr;
m_window = window;
m_renderTarget = nullptr;
m_shouldRender = false;
@ -78,19 +79,25 @@ ZoneWindowDrawing::ZoneWindowDrawing(HWND window)
// Create a Direct2D render target
// We should always use the DPI value of 96 since we're running in DPI aware mode
GetD2DFactory()->CreateHwndRenderTarget(
D2D1::RenderTargetProperties(
D2D1_RENDER_TARGET_TYPE_DEFAULT,
D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED),
96.f,
96.f),
D2D1::HwndRenderTargetProperties(
window,
D2D1::SizeU(
m_clientRect.right - m_clientRect.left,
m_clientRect.bottom - m_clientRect.top)),
auto renderTargetProperties = D2D1::RenderTargetProperties(
D2D1_RENDER_TARGET_TYPE_DEFAULT,
D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED),
96.f,
96.f);
auto renderTargetSize = D2D1::SizeU(m_clientRect.right - m_clientRect.left, m_clientRect.bottom - m_clientRect.top);
auto hwndRenderTargetProperties = D2D1::HwndRenderTargetProperties(window, renderTargetSize);
hr = GetD2DFactory()->CreateHwndRenderTarget(
renderTargetProperties,
hwndRenderTargetProperties,
&m_renderTarget);
if (!SUCCEEDED(hr))
{
return;
}
m_renderThread = std::thread([this]() {
while (!m_abortThread)
{