#include "pbd/stacktrace.h"
#include "canvas/canvas.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "canvas/debug.h"
#include "canvas/line.h"
#include "canvas/scroll_group.h"
-#include "canvas/utils.h"
#ifdef __APPLE__
#include <gdk/gdk.h>
/** Construct a new Canvas */
Canvas::Canvas ()
: _root (this)
- , _bg_color (rgba_to_color (0, 1.0, 0.0, 1.0))
+ , _bg_color (Gtkmm2ext::rgba_to_color (0, 1.0, 0.0, 1.0))
, _last_render_start_timestamp(0)
{
set_epoch ();
}
}
+gint64
+Canvas::get_microseconds_since_render_start () const
+{
+ gint64 timestamp = g_get_monotonic_time();
+
+ if (_last_render_start_timestamp == 0 || timestamp <= _last_render_start_timestamp) {
+ return 0;
+ }
+
+ return timestamp - _last_render_start_timestamp;
+}
+
ostream&
operator<< (ostream& o, Canvas& c)
{
}
void
-Canvas::set_background_color (Color c)
+Canvas::set_background_color (Gtkmm2ext::Color c)
{
_bg_color = c;
}
#ifdef __APPLE__
if (_nsglview) {
- Gtkmm2ext::nsglview_queue_draw (_nsglview, ev->area.x, ev->area.y, ev->area.width, ev->area.height);
return true;
}
#endif
/* draw background color */
draw_context->rectangle (ev->area.x, ev->area.y, ev->area.width, ev->area.height);
- set_source_rgba (draw_context, _bg_color);
+ Gtkmm2ext::set_source_rgba (draw_context, _bg_color);
draw_context->fill ();
/* render canvas */
#endif
}
+void
+GtkCanvas::queue_draw()
+{
+#ifdef __APPLE__
+ if (_nsglview) {
+ Gtkmm2ext::nsglview_queue_draw (_nsglview, 0, 0, get_width (), get_height ());
+ return;
+ }
+#endif
+ Gtk::Widget::queue_draw ();
+}
+
+void
+GtkCanvas::queue_draw_area (int x, int y, int width, int height)
+{
+#ifdef __APPLE__
+ if (_nsglview) {
+ Gtkmm2ext::nsglview_queue_draw (_nsglview, x, y, width, height);
+ return;
+ }
+#endif
+ Gtk::Widget::queue_draw_area (x, y, width, height);
+}
+
/** Called to request a redraw of our canvas.
* @param area Area to redraw, in window coordinates.
*/