*/
+#include <vector>
+
#include <cairomm/region.h>
#include <cairomm/surface.h>
#include <cairomm/context.h>
+#include "pbd/compose.h"
+#include "pbd/error.h"
+#include "pbd/i18n.h"
+
+#include "ardour/debug.h"
+
#include "canvas.h"
#include "layout.h"
#include "push2.h"
+#ifdef __APPLE__
+#define Rect ArdourCanvas::Rect
+#endif
+
using namespace ArdourCanvas;
using namespace ArdourSurface;
+using namespace PBD;
const int Push2Canvas::pixels_per_row = 1024;
if (expose ()) {
/* something rendered, update device_frame_buffer */
blit_to_device_frame_buffer ();
+
+#undef RENDER_LAYOUTS
+#ifdef RENDER_LAYOUTS
+ if (p2.current_layout()) {
+ std::string s = p2.current_layout()->name();
+ s += ".png";
+ frame_buffer->write_to_png (s);
+ }
+#endif
}
int transferred = 0;
{
Cairo::RectangleInt cr;
- cr.x = r.x1;
- cr.y = r.y1;
+ cr.x = r.x0;
+ cr.y = r.y0;
cr.width = r.width();
- cr.width = r.height();
+ cr.height = r.height();
+
+ // DEBUG_TRACE (DEBUG::Push2, string_compose ("invalidate rect %1\n", r));
expose_region->do_union (cr);
const int nrects = expose_region->get_num_rectangles ();
+ //DEBUG_TRACE (DEBUG::Push2, string_compose ("expose with %1 rects\n", nrects));
+
for (int n = 0; n < nrects; ++n) {
Cairo::RectangleInt r = expose_region->get_rectangle (n);
context->rectangle (r.x, r.y, r.width, r.height);
Push2Layout* layout = p2.current_layout();
if (layout) {
+ /* all layouts cover (at least) the full size of the video
+ display, so we do not need to check if the layout intersects
+ the bounding box of the full expose region.
+ */
Cairo::RectangleInt r = expose_region->get_extents();
+ Rect rr (r.x, r.y, r.x + r.width, r.y + r.height);
+ //DEBUG_TRACE (DEBUG::Push2, string_compose ("render layout with %1\n", rr));
layout->render (Rect (r.x, r.y, r.x + r.width, r.y + r.height), context);
}
context->reset_clip ();
+ /* why is there no "reset()" method for Cairo::Region? */
+
+ expose_region = Cairo::Region::create ();
+
return true;
}
return 0;
}
+
+void
+Push2Canvas::request_size (Duple)
+{
+ /* fixed size canvas */
+}
+
+Rect
+Push2Canvas::visible_area () const
+{
+ /* may need to get more sophisticated once we do scrolling */
+ return Rect (0, 0, 960, 160);
+}
+
+Glib::RefPtr<Pango::Context>
+Push2Canvas::get_pango_context ()
+{
+ if (!pango_context) {
+ PangoFontMap* map = pango_cairo_font_map_get_default ();
+ if (!map) {
+ error << _("Default Cairo font map is null!") << endmsg;
+ return Glib::RefPtr<Pango::Context> ();
+ }
+
+ PangoContext* context = pango_font_map_create_context (map);
+
+ if (!context) {
+ error << _("cannot create new PangoContext from cairo font map") << endmsg;
+ return Glib::RefPtr<Pango::Context> ();
+ }
+
+ pango_context = Glib::wrap (context);
+ }
+
+ return pango_context;
+}