Skip to content

Commit fa6b066

Browse files
authored
AtlasEngine: Stop resizing buffers on scroll (#13100)
This regressed in ad2358d. We're interested in the size of the viewport only, but it can shift up/down during scrolling. In these situations we shouldn't resize our buffers of course. ## Validation Steps Performed * Scroll * Not setting `ApiInvalidations::Size` ✅
1 parent b699f92 commit fa6b066

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/renderer/atlas/AtlasEngine.api.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,15 @@ constexpr HRESULT vec2_narrow(U x, U y, AtlasEngine::vec2<T>& out) noexcept
174174

175175
[[nodiscard]] HRESULT AtlasEngine::UpdateViewport(const SMALL_RECT srNewViewport) noexcept
176176
{
177-
_api.cellCount.x = gsl::narrow_cast<u16>(srNewViewport.Right - srNewViewport.Left + 1);
178-
_api.cellCount.y = gsl::narrow_cast<u16>(srNewViewport.Bottom - srNewViewport.Top + 1);
179-
WI_SetFlag(_api.invalidations, ApiInvalidations::Size);
177+
const u16x2 cellCount{
178+
gsl::narrow_cast<u16>(srNewViewport.Right - srNewViewport.Left + 1),
179+
gsl::narrow_cast<u16>(srNewViewport.Bottom - srNewViewport.Top + 1),
180+
};
181+
if (_api.cellCount != cellCount)
182+
{
183+
_api.cellCount = cellCount;
184+
WI_SetFlag(_api.invalidations, ApiInvalidations::Size);
185+
}
180186
return S_OK;
181187
}
182188

0 commit comments

Comments
 (0)