mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 09:46:20 +00:00
Reduce code duplication by using Point::from_xml
This commit is contained in:
parent
b11116088a
commit
4969c7cdb0
@ -338,9 +338,7 @@ struct Nit_fb::Main : View_updater
|
||||
|
||||
Framebuffer::Mode const gui_mode = gui.mode();
|
||||
|
||||
position = _coordinate_origin(gui_mode, config)
|
||||
+ Point((int)config.attribute_value("xpos", 0L),
|
||||
(int)config.attribute_value("ypos", 0L));
|
||||
position = _coordinate_origin(gui_mode, config) + Point::from_xml(config);
|
||||
|
||||
bool const attr = config.has_attribute("width") ||
|
||||
config.has_attribute("height");
|
||||
|
@ -66,12 +66,6 @@ struct Test::Main
|
||||
|
||||
Heap _heap { _env.ram(), _env.rm() };
|
||||
|
||||
static Gui::Point _point_from_xml(Xml_node node)
|
||||
{
|
||||
return Gui::Point((int)node.attribute_value("xpos", 0L),
|
||||
(int)node.attribute_value("ypos", 0L));
|
||||
}
|
||||
|
||||
static Gui::Area _area_from_xml(Xml_node node, Gui::Area default_area)
|
||||
{
|
||||
return Gui::Area(node.attribute_value("width", default_area.w),
|
||||
@ -111,7 +105,7 @@ struct Test::Main
|
||||
{
|
||||
auto view_rect = [&] (Xml_node node)
|
||||
{
|
||||
return Gui::Rect(_point_from_xml(node),
|
||||
return Gui::Rect(Gui::Point::from_xml(node),
|
||||
_area_from_xml(node, _mode.area));
|
||||
};
|
||||
|
||||
@ -155,7 +149,7 @@ struct Test::Main
|
||||
|
||||
Capture_input(Env &env, Gui::Area area, Xml_node const &config)
|
||||
:
|
||||
_env(env), _area(area), _at(_point_from_xml(config))
|
||||
_env(env), _area(area), _at(Gui::Point::from_xml(config))
|
||||
{ }
|
||||
|
||||
Affected_rects capture() { return _capture.capture_at(_at); }
|
||||
|
@ -70,12 +70,6 @@ struct Test::Main
|
||||
|
||||
Root_directory _root_dir { _env, _heap, _config.xml().sub_node("vfs") };
|
||||
|
||||
static Gui::Point _point_from_xml(Xml_node node)
|
||||
{
|
||||
return Gui::Point((int)node.attribute_value("xpos", 0L),
|
||||
(int)node.attribute_value("ypos", 0L));
|
||||
}
|
||||
|
||||
static Gui::Area _area_from_xml(Xml_node node, Gui::Area default_area)
|
||||
{
|
||||
return Gui::Area(node.attribute_value("width", default_area.w),
|
||||
@ -115,7 +109,7 @@ struct Test::Main
|
||||
{
|
||||
auto view_rect = [&] (Xml_node node)
|
||||
{
|
||||
return Gui::Rect(_point_from_xml(node),
|
||||
return Gui::Rect(Gui::Point::from_xml(node),
|
||||
_area_from_xml(node, _mode.area));
|
||||
};
|
||||
|
||||
@ -164,7 +158,7 @@ struct Test::Main
|
||||
Xml_node const &config)
|
||||
:
|
||||
_env(env), _root_dir(root_dir), _area(area),
|
||||
_at(_point_from_xml(config))
|
||||
_at(Gui::Point::from_xml(config))
|
||||
{ }
|
||||
|
||||
Affected_rects capture() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user