mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 19:56:31 +01:00
a set of 3 fixes that cure Canvas::Text leaving dirty pixels when being dragged. or might not - testing is non-deterministic, which is alarming
This commit is contained in:
parent
f98e0a0707
commit
93bc93b6f6
1 changed files with 17 additions and 10 deletions
|
|
@ -106,15 +106,15 @@ Text::_redraw (Glib::RefPtr<Pango::Layout> layout) const
|
||||||
}
|
}
|
||||||
|
|
||||||
layout->set_alignment (_alignment);
|
layout->set_alignment (_alignment);
|
||||||
|
|
||||||
int w;
|
int w;
|
||||||
int h;
|
int h;
|
||||||
|
|
||||||
layout->get_size (w, h);
|
layout->get_pixel_size (w, h);
|
||||||
|
|
||||||
_width = w / Pango::SCALE;
|
_width = w;
|
||||||
_height = h / Pango::SCALE;
|
_height = h;
|
||||||
|
|
||||||
_image = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, _width, _height);
|
_image = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, _width, _height);
|
||||||
|
|
||||||
Cairo::RefPtr<Cairo::Context> img_context = Cairo::Context::create (_image);
|
Cairo::RefPtr<Cairo::Context> img_context = Cairo::Context::create (_image);
|
||||||
|
|
@ -133,19 +133,26 @@ Text::_redraw (Glib::RefPtr<Pango::Layout> layout) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Text::render (Rect const & /*area*/, Cairo::RefPtr<Cairo::Context> context) const
|
Text::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
||||||
{
|
{
|
||||||
if (_text.empty()) {
|
if (_text.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rect self = item_to_window (Rect (0, 0, min (_clamped_width, (double)_image->get_width ()), _image->get_height ()));
|
||||||
|
boost::optional<Rect> i = self.intersection (area);
|
||||||
|
|
||||||
|
if (!i) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_need_redraw) {
|
if (_need_redraw) {
|
||||||
redraw (context);
|
redraw (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect self = item_to_window (Rect (0, 0, min (_clamped_width, _width), _height));
|
Rect intersection (i.get());
|
||||||
|
|
||||||
context->rectangle (self.x0, self.y0, self.width(), self.height());
|
context->rectangle (intersection.x0, intersection.y0, intersection.width(), intersection.height());
|
||||||
context->set_source (_image, self.x0, self.y0);
|
context->set_source (_image, self.x0, self.y0);
|
||||||
context->fill ();
|
context->fill ();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue