mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 03:45:24 +00:00
parent
ea811a3217
commit
a5ae1e12bd
@ -153,8 +153,10 @@ void Vesa_driver::Main::_handle_config()
|
||||
|
||||
using Attr = Capture::Connection::Screen::Attr;
|
||||
_captured_screen.construct(_capture, _env.rm(), Attr {
|
||||
.px = _size,
|
||||
.mm = { } });
|
||||
.px = _size,
|
||||
.mm = { },
|
||||
.rotate = { },
|
||||
.flip = { } });
|
||||
|
||||
unsigned long const period_ms = config.attribute_value("period_ms", 20U);
|
||||
_timer.trigger_periodic(period_ms*1000);
|
||||
|
@ -31,7 +31,18 @@ class Capture::Connection : private Genode::Connection<Session>
|
||||
|
||||
public:
|
||||
|
||||
using Label = Genode::Session_label;
|
||||
using Label = Genode::Session_label;
|
||||
using Rotate = Blit::Rotate;
|
||||
using Flip = Blit::Flip;
|
||||
|
||||
static Rotate rotate_from_xml(Xml_node const &node)
|
||||
{
|
||||
unsigned const v = node.attribute_value("rotate", 0u);
|
||||
return (v == 90) ? Rotate::R90 :
|
||||
(v == 180) ? Rotate::R180 :
|
||||
(v == 270) ? Rotate::R270 :
|
||||
Rotate::R0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -98,8 +109,13 @@ class Capture::Connection::Screen
|
||||
|
||||
struct Attr
|
||||
{
|
||||
Area px; /* buffer area in pixels */
|
||||
Area mm; /* physical size in millimeters */
|
||||
Area px; /* buffer area in pixels */
|
||||
Area mm; /* physical size in millimeters */
|
||||
Rotate rotate;
|
||||
Flip flip;
|
||||
|
||||
Area padded_px() const { return { .w = align_addr(px.w, 3),
|
||||
.h = align_addr(px.h, 3) }; }
|
||||
};
|
||||
|
||||
Attr const attr;
|
||||
@ -113,7 +129,8 @@ class Capture::Connection::Screen
|
||||
|
||||
Attached_dataspace _ds;
|
||||
|
||||
Texture<Pixel> const _texture { _ds.local_addr<Pixel>(), nullptr, attr.px };
|
||||
Texture<Pixel> const _texture { _ds.local_addr<Pixel>(), nullptr,
|
||||
attr.padded_px() };
|
||||
|
||||
public:
|
||||
|
||||
@ -126,26 +143,31 @@ class Capture::Connection::Screen
|
||||
|
||||
Rect apply_to_surface(Surface<Pixel> &surface)
|
||||
{
|
||||
Rect bounding_box { };
|
||||
/* record information about pixels affected by 'back2front' */
|
||||
struct Flusher : Surface_base::Flusher
|
||||
{
|
||||
Rect bounding_box { };
|
||||
void flush_pixels(Rect rect) override
|
||||
{
|
||||
bounding_box = bounding_box.area.count()
|
||||
? Rect::compound(bounding_box, rect)
|
||||
: rect;
|
||||
};
|
||||
} flusher { };
|
||||
|
||||
surface.flusher(&flusher);
|
||||
|
||||
using Affected_rects = Session::Affected_rects;
|
||||
|
||||
Affected_rects const affected = _connection.capture_at(Capture::Point(0, 0));
|
||||
|
||||
with_texture([&] (Texture<Pixel> const &texture) {
|
||||
|
||||
affected.for_each_rect([&] (Capture::Rect const rect) {
|
||||
|
||||
surface.clip(rect);
|
||||
|
||||
Blit_painter::paint(surface, texture, Capture::Point(0, 0));
|
||||
|
||||
bounding_box = bounding_box.area.count()
|
||||
? Rect::compound(bounding_box, rect)
|
||||
: rect;
|
||||
Blit::back2front(surface, texture, rect, attr.rotate, attr.flip);
|
||||
});
|
||||
});
|
||||
return bounding_box;
|
||||
surface.flusher(nullptr);
|
||||
return flusher.bounding_box;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -88,8 +88,10 @@ struct Framebuffer::Main
|
||||
Capture::Connection _capture { _env };
|
||||
|
||||
Capture::Connection::Screen _captured_screen { _capture, _env.rm(), {
|
||||
.px = _info.size,
|
||||
.mm = { } } };
|
||||
.px = _info.size,
|
||||
.mm = { },
|
||||
.rotate = { },
|
||||
.flip = { } } };
|
||||
Timer::Connection _timer { _env };
|
||||
|
||||
Signal_handler<Main> _timer_handler { _env.ep(), *this, &Main::_handle_timer };
|
||||
|
@ -60,8 +60,10 @@ struct Pl11x_driver::Main
|
||||
Capture::Connection _capture { _env };
|
||||
|
||||
Capture::Connection::Screen _captured_screen { _capture, _env.rm(), {
|
||||
.px = _size,
|
||||
.mm = { } } };
|
||||
.px = _size,
|
||||
.mm = { },
|
||||
.rotate = { },
|
||||
.flip = { } } };
|
||||
|
||||
|
||||
/*
|
||||
|
@ -66,8 +66,10 @@ class Main
|
||||
Capture::Area const _size { SCR_WIDTH, SCR_HEIGHT };
|
||||
Capture::Connection _capture { _env };
|
||||
Capture::Connection::Screen _captured_screen { _capture, _env.rm(), {
|
||||
.px = _size,
|
||||
.mm = { } } };
|
||||
.px = _size,
|
||||
.mm = { },
|
||||
.rotate = { },
|
||||
.flip = { } } };
|
||||
Timer::Connection _timer { _env };
|
||||
|
||||
Signal_handler<Main> _timer_handler { _env.ep(), *this, &Main::_handle_timer };
|
||||
|
@ -273,8 +273,10 @@ struct Fb_sdl::Sdl : Noncopyable
|
||||
|
||||
using Attr = Capture::Connection::Screen::Attr;
|
||||
_captured_screen.construct(_capture, _rm, Attr {
|
||||
.px = size,
|
||||
.mm = { } });
|
||||
.px = size,
|
||||
.mm = { },
|
||||
.rotate = { },
|
||||
.flip = { }});
|
||||
|
||||
_update_screen_from_capture();
|
||||
_schedule_next_frame();
|
||||
|
@ -357,8 +357,10 @@ class Virtio_fb::Driver
|
||||
|
||||
using Attr = Capture::Connection::Screen::Attr;
|
||||
_captured_screen.construct(_capture, _env.rm(), Attr {
|
||||
.px = _display_area,
|
||||
.mm = { } });
|
||||
.px = _display_area,
|
||||
.mm = { },
|
||||
.rotate = { },
|
||||
.flip = { } });
|
||||
}
|
||||
|
||||
void _shutdown_display()
|
||||
|
@ -262,8 +262,10 @@ class Black_hole_test::Capture_test
|
||||
Capture::Pixel _pixels[1];
|
||||
Surface<Capture::Pixel> _surface { _pixels, _screen_size };
|
||||
Capture::Connection::Screen _screen { _connection, _env.rm(),
|
||||
{ .px = _screen_size,
|
||||
.mm = { } } };
|
||||
{ .px = _screen_size,
|
||||
.mm = { },
|
||||
.rotate = { },
|
||||
.flip = { } } };
|
||||
bool _finished { false };
|
||||
|
||||
public:
|
||||
|
@ -224,8 +224,10 @@ struct Framebuffer::Driver
|
||||
if (!conn.size.valid())
|
||||
return same;
|
||||
|
||||
Capture::Connection::Screen::Attr attr = { .px = conn.size,
|
||||
.mm = conn.size_mm };
|
||||
Capture::Connection::Screen::Attr attr = { .px = conn.size,
|
||||
.mm = conn.size_mm,
|
||||
.rotate = { },
|
||||
.flip = { } };
|
||||
|
||||
conn.capture.construct(env, label);
|
||||
conn.screen .construct(*conn.capture, env.rm(), attr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user