mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-19 07:38:28 +00:00
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:
@ -82,6 +82,11 @@ struct Capture::Session : Genode::Session
|
|||||||
Area px; /* buffer area in pixels */
|
Area px; /* buffer area in pixels */
|
||||||
Area mm; /* physical size in millimeters */
|
Area mm; /* physical size in millimeters */
|
||||||
Rect viewport; /* part of the buffer watched by the client */
|
Rect viewport; /* part of the buffer watched by the client */
|
||||||
|
|
||||||
|
Rect clipped_viewport() const
|
||||||
|
{
|
||||||
|
return Rect::intersect(viewport, Rect { { }, px } );
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -130,8 +130,8 @@ class Nitpicker::Capture_session : public Session_object<Capture::Session>
|
|||||||
|
|
||||||
Area _area_bounds() const
|
Area _area_bounds() const
|
||||||
{
|
{
|
||||||
return { .w = _policy.w.or_default(_buffer_attr.px.w),
|
return { .w = _policy.w.or_default(_buffer_attr.clipped_viewport().w()),
|
||||||
.h = _policy.h.or_default(_buffer_attr.px.h) };
|
.h = _policy.h.or_default(_buffer_attr.clipped_viewport().h()) };
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -263,7 +263,7 @@ class Nitpicker::Capture_session : public Session_object<Capture::Session>
|
|||||||
if (!_buffer.constructed())
|
if (!_buffer.constructed())
|
||||||
return Affected_rects { };
|
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>(),
|
Canvas<Pixel_rgb888> canvas { _buffer->local_addr<Pixel_rgb888>(),
|
||||||
anchor, _buffer_attr.px };
|
anchor, _buffer_attr.px };
|
||||||
|
Reference in New Issue
Block a user