mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 20:05:54 +00:00
menu_view: avoid flicker when enlarging the view
Each time when enlarging the menu view, a new 'Gui_buffer' is constructed with the new size. At its contruction time, the default reset background color is in effect, which is evaluated by 'reset_surface' as part of the construction. A custom reset color takes effect only after the construction. Hence, when the Gui_buffer is flushed to screen immediately at construction time, the gray default becomes visible for a short time. This patch changes the Gui_buffer to accept the reset background color as construction argument so that it takes immediate effect. Related to #4592
This commit is contained in:
parent
11ff774f72
commit
3447d0ccb9
@ -25,7 +25,7 @@
|
||||
#include <blit/painter.h>
|
||||
|
||||
|
||||
struct Gui_buffer
|
||||
struct Gui_buffer : Genode::Noncopyable
|
||||
{
|
||||
typedef Genode::Pixel_rgb888 Pixel_rgb888;
|
||||
typedef Genode::Pixel_alpha8 Pixel_alpha8;
|
||||
@ -50,7 +50,7 @@ struct Gui_buffer
|
||||
|
||||
bool const use_alpha;
|
||||
|
||||
Pixel_rgb888 reset_color { 127, 127, 127, 255 };
|
||||
Pixel_rgb888 const reset_color;
|
||||
|
||||
/**
|
||||
* Return dataspace capability for virtual framebuffer
|
||||
@ -80,17 +80,24 @@ struct Gui_buffer
|
||||
|
||||
enum class Alpha { OPAQUE, ALPHA };
|
||||
|
||||
static Genode::Color default_reset_color()
|
||||
{
|
||||
return Genode::Color(127, 127, 127, 255);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Gui_buffer(Gui::Connection &gui, Area size,
|
||||
Genode::Ram_allocator &ram, Genode::Region_map &rm,
|
||||
Alpha alpha = Alpha::ALPHA)
|
||||
Alpha alpha = Alpha::ALPHA,
|
||||
Genode::Color reset_color = default_reset_color())
|
||||
:
|
||||
ram(ram), rm(rm), gui(gui),
|
||||
mode({ .area = { Genode::max(1U, size.w()),
|
||||
Genode::max(1U, size.h()) } }),
|
||||
use_alpha(alpha == Alpha::ALPHA)
|
||||
use_alpha(alpha == Alpha::ALPHA),
|
||||
reset_color(reset_color.r, reset_color.g, reset_color.b, reset_color.a)
|
||||
{
|
||||
reset_surface();
|
||||
}
|
||||
|
@ -386,17 +386,13 @@ void Menu_view::Main::_handle_frame_timer()
|
||||
bool const size_increased = (max_size.w() > buffer_w)
|
||||
|| (max_size.h() > buffer_h);
|
||||
|
||||
if (!_buffer.constructed() || size_increased) {
|
||||
if (!_buffer.constructed() || size_increased)
|
||||
_buffer.construct(_gui, max_size, _env.ram(), _env.rm(),
|
||||
_opaque ? Gui_buffer::Alpha::OPAQUE
|
||||
: Gui_buffer::Alpha::ALPHA);
|
||||
_buffer->reset_color = { _background_color.r,
|
||||
_background_color.g,
|
||||
_background_color.b,
|
||||
_background_color.a };
|
||||
} else {
|
||||
: Gui_buffer::Alpha::ALPHA,
|
||||
_background_color);
|
||||
else
|
||||
_buffer->reset_surface();
|
||||
}
|
||||
|
||||
_root_widget.position(Point(0, 0));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user