Answer the question
In order to leave comments, you need to log in
Direct2d winapi why high gpu load on dwm.exe?
direct2d initialization
D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &factory);
DWriteCreateFactory(DWRITE_FACTORY_TYPE_ISOLATED, __uuidof(IDWriteFactory), reinterpret_cast<IUnknown **>(&wFactory));
DPIScale::Initialize(factory);
HWND hand = mWindowStatic->getWindowHandle();
factory->CreateHwndRenderTarget(D2D1::RenderTargetProperties(),D2D1::HwndRenderTargetProperties(hand, D2D1::SizeU(mWidth, mHeight)),&renderTarget);
renderTarget->SetDpi(96, 96);
WNDCLASSEXW windowClass = {0};
windowClass.cbSize = sizeof(WNDCLASSEX);
windowClass.hbrBackground = NULL;
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
windowClass.hInstance = NULL;
//windowClass.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1);
windowClass.lpfnWndProc = MessageRouter;
windowClass.lpszClassName = title.c_str();
windowClass.lpszMenuName = NULL;
windowClass.style = CS_HREDRAW | CS_VREDRAW;
RegisterClassExW(&windowClass);
int aElements[2] = {COLOR_ACTIVECAPTION, COLOR_ACTIVECAPTION};
windowHandle = CreateWindowExA(
WS_EX_WINDOWEDGE,
std::string(title.cbegin(),title.cend()).c_str(),
NULL,
WS_POPUP | WS_VISIBLE | WS_SIZEBOX,
posX,
posY,
width,
height,
NULL,
NULL,
NULL,
this);
renderTarget->BeginDraw();
//1 кадр рисую UI
//Все остальные кадры перерисовываю область 100x50px через PushAxisAlignedClip
renderTarget->PushAxisAlignedClip(rect,D2D1_ANTIALIAS_MODE_ALIASED);
renderTarget->PopAxisAlignedClip();
renderTarget->EndDraw();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question