gles2: Apply output transformations for damage

This commit is contained in:
Victor Brekenfeld 2022-01-14 22:01:07 +01:00 committed by Victoria Brekenfeld
parent 050c648bff
commit f76311227b
1 changed files with 11 additions and 5 deletions

View File

@ -1295,13 +1295,19 @@ impl Frame for Gles2Frame {
let rect_constrained_loc = rect
.loc
.constrain(Rectangle::from_extemities((0f64, 0f64), dest.size.to_point()));
let rect_clamped_size = rect.size.clamp((0f64, 0f64), dest.size);
let rect_clamped_size = rect.size.clamp(
(0f64, 0f64),
(dest.size.to_point() - rect_constrained_loc).to_size(),
);
let rect = Rectangle::from_loc_and_size(rect_constrained_loc, rect_clamped_size);
let rect_transformed = self.transformation().transform_rect_in(rect, &dest.size);
[
(rect_constrained_loc.x / dest.size.w) as f32,
(rect_constrained_loc.y / dest.size.h) as f32,
(rect_clamped_size.w / dest.size.w) as f32,
(rect_clamped_size.h / dest.size.h) as f32,
(rect_transformed.loc.x / dest.size.w) as f32,
(rect_transformed.loc.y / dest.size.h) as f32,
(rect_transformed.size.w / dest.size.w) as f32,
(rect_transformed.size.h / dest.size.h) as f32,
]
})
.flatten()