1
0
Fork 0

drm_hwcomposer: Add Rect utility type

This change refactors the IRect and FRect types into a single
templated type Rect<T>, which allows the implementation to be
shared across both variants. This change also adds convenience
getters for the rect widths and heights, and updates callsites
accordingly.

Change-Id: I38509631d57706266186a7b7fa21bd43c0860890
This commit is contained in:
Andrew Wolfers 2025-09-09 13:57:40 +00:00
parent 9255d0d10b
commit 2261f81762
4 changed files with 34 additions and 35 deletions

View file

@ -173,8 +173,7 @@ uint32_t Backend::CalcPixOps(const std::vector<const HwcLayer*>& layers,
const auto* layer = layers[z_order];
const auto& df = layer->GetLayerData().pi.display_frame;
if (df.i_rect.has_value()) {
pixops += (df.i_rect->right - df.i_rect->left) *
(df.i_rect->bottom - df.i_rect->top);
pixops += df.i_rect->Width() * df.i_rect->Height();
} else {
// nullopt frame rect means whole display.
pixops += whole_display;