Fix flip_rect calculation (#32174)

This commit is contained in:
Ngo Iok Ui (Wu Yu Wei) 2024-04-29 17:01:31 +09:00 committed by GitHub
parent 74897c3851
commit a1f8c19355
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -249,7 +249,10 @@ impl EmbedderCoordinates {
/// This should be used when drawing directly to the framebuffer with OpenGL commands.
pub fn flip_rect(&self, rect: &DeviceIntRect) -> DeviceIntRect {
let mut result = *rect;
result.min.y = self.framebuffer.height - result.min.y - result.size().height;
let min_y = self.framebuffer.height - result.max.y;
let max_y = self.framebuffer.height - result.min.y;
result.min.y = min_y;
result.max.y = max_y;
result
}