raster: don't zero the framebuffer when the cached backdrop is about to overwrite it
CI / test (push) Failing after 18s
CI / test (push) Failing after 18s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c6e31b4a8f
commit
63e63c65e0
1 file changed
+11
-2
+11
-2
@@ -552,11 +552,20 @@ impl Raster {
|
|||||||
/// panel, then client popups. The same layering as the software renderer's `render_scene`.
|
/// panel, then client popups. The same layering as the software renderer's `render_scene`.
|
||||||
pub fn submit(&mut self, f: &wt::Frame, fonts: &mut Fonts) {
|
pub fn submit(&mut self, f: &wt::Frame, fonts: &mut Fonts) {
|
||||||
let (w, h) = (f.width.max(1), f.height.max(1));
|
let (w, h) = (f.width.max(1), f.height.max(1));
|
||||||
if w != self.w || h != self.h || self.fb.len() != (w * h * 4) as usize {
|
let resized = w != self.w || h != self.h || self.fb.len() != (w * h * 4) as usize;
|
||||||
|
if resized {
|
||||||
self.w = w;
|
self.w = w;
|
||||||
self.h = h;
|
self.h = h;
|
||||||
self.fb = vec![0u8; (w * h * 4) as usize];
|
self.fb = vec![0u8; (w * h * 4) as usize];
|
||||||
} else {
|
}
|
||||||
|
// The frame starts from the cached backdrop (which covers every pixel), so the buffer is
|
||||||
|
// only cleared when there is none: no point zeroing 8 MB that is overwritten at once.
|
||||||
|
let backdrop_ready = match (&f.wallpaper, &self.wallpaper) {
|
||||||
|
(None, Some((_, cw, ch, _))) => *cw == w && *ch == h,
|
||||||
|
(Some(ops), Some((o, cw, ch, _))) => *cw == w && *ch == h && o == ops,
|
||||||
|
_ => false,
|
||||||
|
};
|
||||||
|
if !resized && !backdrop_ready {
|
||||||
self.fb.fill(0);
|
self.fb.fill(0);
|
||||||
}
|
}
|
||||||
let surfaces = &self.surfaces;
|
let surfaces = &self.surfaces;
|
||||||
|
|||||||
Reference in new issue
Block a user