move CairoCanvas::render() implementation for ArdourCanvas::Canvas into source

Note that this implementation only redraws a single (cairo_rectangle_t-defined) rect, and cannot
provide sub-rects the way that a normal GDK/GTK expose-driven redraw can
This commit is contained in:
Paul Davis 2024-03-18 10:50:36 -06:00
parent 71e085d825
commit 4b563ae518
2 changed files with 11 additions and 6 deletions

View File

@ -1600,6 +1600,13 @@ GtkCanvas::grab_can_translate () const
return _grabbed_item->scroll_translation ();
}
void
GtkCanvas::render (Cairo::RefPtr<Cairo::Context> const & ctx, cairo_rectangle_t* r)
{
ArdourCanvas::Rect rect (r->x, r->y, r->width + r->x, r->height + r->y);
Canvas::render (rect, ctx);
}
/** Create a GtkCanvaSViewport.
* @param hadj Adjustment to use for horizontal scrolling.
* @param vadj Adjustment to use for vertica scrolling.

View File

@ -249,12 +249,10 @@ public:
Glib::RefPtr<Pango::Context> get_pango_context();
void render (Cairo::RefPtr<Cairo::Context> const & ctx, cairo_rectangle_t* r)
{
ArdourCanvas::Rect rect (r->x, r->y, r->width + r->x, r->height + r->y);
Canvas::render (rect, ctx);
}
/* This is the render method called via the Gtkmm2ext::CairoCanvas API,
which is distinct from ArdourCanvas.
*/
void render (Cairo::RefPtr<Cairo::Context> const & ctx, cairo_rectangle_t* r);
void prepare_for_render () const;
uint32_t background_color() { return Canvas::background_color (); }