nitpicker: evaluate capture view port

This patch adds the support for a client-specified buffer viewport to
nitpicker. It thereby allows clients to allocate a buffer that is larger
than the visible pixels, in particular, padding the buffer dimensions to
SIMD-friendly boundaries.

Issue #5518
This commit is contained in:
Norman Feske 2025-04-14 21:06:58 +02:00
parent a43c0b2cb4
commit d0e97c1e59
2 changed files with 8 additions and 3 deletions

View File

@ -82,6 +82,11 @@ struct Capture::Session : Genode::Session
Area px; /* buffer area in pixels */
Area mm; /* physical size in millimeters */
Rect viewport; /* part of the buffer watched by the client */
Rect clipped_viewport() const
{
return Rect::intersect(viewport, Rect { { }, px } );
}
};
/**

View File

@ -130,8 +130,8 @@ class Nitpicker::Capture_session : public Session_object<Capture::Session>
Area _area_bounds() const
{
return { .w = _policy.w.or_default(_buffer_attr.px.w),
.h = _policy.h.or_default(_buffer_attr.px.h) };
return { .w = _policy.w.or_default(_buffer_attr.clipped_viewport().w()),
.h = _policy.h.or_default(_buffer_attr.clipped_viewport().h()) };
}
public:
@ -263,7 +263,7 @@ class Nitpicker::Capture_session : public Session_object<Capture::Session>
if (!_buffer.constructed())
return Affected_rects { };
Point const anchor = _anchor_point() + pos;
Point const anchor = _anchor_point() + pos - _buffer_attr.clipped_viewport().at;
Canvas<Pixel_rgb888> canvas { _buffer->local_addr<Pixel_rgb888>(),
anchor, _buffer_attr.px };