Skip to content

Commit

Permalink
directvt#571 WIP: Avoid dwrite's unnecessary copying on target resize
Browse files Browse the repository at this point in the history
  • Loading branch information
o-sdn-o committed Apr 19, 2024
1 parent 6659c6f commit 1309904
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/netxs/desktopio/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,14 @@ namespace netxs::gui
{
if (area.size != size)
{
auto hr = surf->Resize(area.size.x, area.size.y);
auto undo = surf;
auto hr = conf.pGdiInterop->CreateBitmapRenderTarget(NULL, area.size.x, area.size.y, &surf); // ET(auto hr = surf->Resize(area.size.x, area.size.y)); // Unnecessary copying.
if (hr == S_OK)
{
//wipe = faux;
hdc = surf->GetMemoryDC();
wipe = faux;
size = area.size;
undo->Release();
}
else log("bitmap resizing error: ", utf::to_hex(hr));
}
Expand Down Expand Up @@ -540,7 +543,7 @@ namespace netxs::gui
{
layers[shadow].area.coor += coor_delta;
layers[client].area.coor += coor_delta;
inner_rect.coor += coor_delta;
inner_rect.coor += coor_delta;
//todo unify
layers[header].area = rect{ inner_rect.coor, { inner_rect.size.x, -cell_size.y * ((header_para.size().x + grid_size.x - 1)/ grid_size.x) }}.normalize_itself() + shadow_dent;
layers[footer].area = rect{{ inner_rect.coor.x, inner_rect.coor.y + inner_rect.size.y }, { inner_rect.size.x, cell_size.y * ((footer_para.size().x + grid_size.x - 1)/ grid_size.x) }} + shadow_dent;
Expand All @@ -553,7 +556,7 @@ namespace netxs::gui
{
layers[client].area.size += size_delta;
layers[shadow].area.size += size_delta;
inner_rect.size += size_delta;
inner_rect.size += size_delta;
//todo unify
layers[header].area = rect{ inner_rect.coor, { inner_rect.size.x, -cell_size.y * ((header_para.size().x + grid_size.x - 1)/ grid_size.x) }}.normalize_itself() + shadow_dent;
layers[footer].area = rect{{ inner_rect.coor.x, inner_rect.coor.y + inner_rect.size.y }, { inner_rect.size.x, cell_size.y * ((footer_para.size().x + grid_size.x - 1)/ grid_size.x) }} + shadow_dent;
Expand Down

0 comments on commit 1309904

Please sign in to comment.