mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
clip rendering of ScrollGroup to just the part of the canvas covered by the scroll group.
This stops tracks from appearing to scroll up under the rulers, among other things.
This commit is contained in:
parent
eec24b6287
commit
792fe016e7
2 changed files with 32 additions and 0 deletions
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "pbd/compose.h"
|
||||
|
||||
#include "canvas/canvas.h"
|
||||
#include "canvas/debug.h"
|
||||
#include "canvas/scroll_group.h"
|
||||
|
||||
|
|
@ -38,6 +39,35 @@ ScrollGroup::ScrollGroup (Group* parent, Duple position, ScrollSensitivity s)
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
ScrollGroup::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
||||
{
|
||||
/* clip the draw to the area that this scroll group nominally occupies
|
||||
* WITHOUT scroll offsets in effect
|
||||
*/
|
||||
|
||||
boost::optional<Rect> r = bounding_box();
|
||||
|
||||
if (!r) {
|
||||
return;
|
||||
}
|
||||
|
||||
Rect self (_position.x, _position.y, _position.x + r.get().width(), _position.y + r.get().height());
|
||||
|
||||
self.x1 = min (_position.x + _canvas->width(), self.x1);
|
||||
self.y1 = min (_position.y + _canvas->height(), self.y1);
|
||||
|
||||
context->save ();
|
||||
context->rectangle (self.x0, self.y0, self.width(), self.height());
|
||||
context->clip ();
|
||||
|
||||
Group::render (area, context);
|
||||
|
||||
context->restore ();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
ScrollGroup::scroll_to (Duple const& d)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue