Skip to content

Commit

Permalink
Respect rotation in partial refresh boundary checks
Browse files Browse the repository at this point in the history
When rotating the image and performing partial updates on it,
those partial updates partly never appeared or were cut off.
Since with rotating, var_screen_info.x/yres update accordingly,
those are now used for boundary checks instead.

Image of attempted partial updates:
https://transfer.cosmos-ink.net/T6zFn/20200805_183246_lq.jpg
  • Loading branch information
LinusCDE committed Aug 5, 2020
1 parent 91ed5af commit 254d008
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/framebuffer/refresh.rs
Expand Up @@ -79,8 +79,8 @@ impl<'a> framebuffer::FramebufferRefresh for core::Framebuffer<'a> {
let mut update_region = region.to_owned();

// No accounting for this, out of bounds, entirely ignored
if update_region.left >= u32::from(common::DISPLAYWIDTH)
|| update_region.top >= u32::from(common::DISPLAYHEIGHT)
if update_region.left >= u32::from(self.var_screen_info.xres)
|| update_region.top >= u32::from(self.var_screen_info.yres)
{
return 0;
}
Expand All @@ -94,14 +94,14 @@ impl<'a> framebuffer::FramebufferRefresh for core::Framebuffer<'a> {

// Dont try to refresh OOB horizontally
let max_x = update_region.left + update_region.width;
if max_x > u32::from(common::DISPLAYWIDTH) {
update_region.width -= max_x - u32::from(common::DISPLAYWIDTH);
if max_x > u32::from(self.var_screen_info.xres) {
update_region.width -= max_x - u32::from(self.var_screen_info.xres);
}

// Dont try to refresh OOB vertically
let max_y = update_region.top + update_region.height;
if max_y > u32::from(common::DISPLAYHEIGHT) {
update_region.height -= max_y - u32::from(common::DISPLAYHEIGHT);
if max_y > u32::from(self.var_screen_info.yres) {
update_region.height -= max_y - u32::from(self.var_screen_info.yres);
}

let update_mode = if force_full_refresh {
Expand Down

0 comments on commit 254d008

Please sign in to comment.