mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
Separate a big function call to several functions
This commit is contained in:
@@ -66,6 +66,7 @@ D2D1_RECT_F ZoneWindowDrawing::ConvertRect(RECT rect)
|
|||||||
|
|
||||||
ZoneWindowDrawing::ZoneWindowDrawing(HWND window)
|
ZoneWindowDrawing::ZoneWindowDrawing(HWND window)
|
||||||
{
|
{
|
||||||
|
HRESULT hr;
|
||||||
m_window = window;
|
m_window = window;
|
||||||
m_renderTarget = nullptr;
|
m_renderTarget = nullptr;
|
||||||
m_shouldRender = false;
|
m_shouldRender = false;
|
||||||
@@ -78,19 +79,25 @@ ZoneWindowDrawing::ZoneWindowDrawing(HWND window)
|
|||||||
|
|
||||||
// Create a Direct2D render target
|
// Create a Direct2D render target
|
||||||
// We should always use the DPI value of 96 since we're running in DPI aware mode
|
// We should always use the DPI value of 96 since we're running in DPI aware mode
|
||||||
GetD2DFactory()->CreateHwndRenderTarget(
|
auto renderTargetProperties = D2D1::RenderTargetProperties(
|
||||||
D2D1::RenderTargetProperties(
|
D2D1_RENDER_TARGET_TYPE_DEFAULT,
|
||||||
D2D1_RENDER_TARGET_TYPE_DEFAULT,
|
D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED),
|
||||||
D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED),
|
96.f,
|
||||||
96.f,
|
96.f);
|
||||||
96.f),
|
|
||||||
D2D1::HwndRenderTargetProperties(
|
auto renderTargetSize = D2D1::SizeU(m_clientRect.right - m_clientRect.left, m_clientRect.bottom - m_clientRect.top);
|
||||||
window,
|
auto hwndRenderTargetProperties = D2D1::HwndRenderTargetProperties(window, renderTargetSize);
|
||||||
D2D1::SizeU(
|
|
||||||
m_clientRect.right - m_clientRect.left,
|
hr = GetD2DFactory()->CreateHwndRenderTarget(
|
||||||
m_clientRect.bottom - m_clientRect.top)),
|
renderTargetProperties,
|
||||||
|
hwndRenderTargetProperties,
|
||||||
&m_renderTarget);
|
&m_renderTarget);
|
||||||
|
|
||||||
|
if (!SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_renderThread = std::thread([this]() {
|
m_renderThread = std::thread([this]() {
|
||||||
while (!m_abortThread)
|
while (!m_abortThread)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user