remove all xml++.h inclusion by canvas implementations
[ardour.git] / libs / canvas / pixbuf.cc
1 #include <cairomm/cairomm.h>
2 #include <gdkmm/general.h>
3
4 #include "canvas/pixbuf.h"
5
6 using namespace std;
7 using namespace ArdourCanvas;
8
9 Pixbuf::Pixbuf (Group* g)
10         : Item (g)
11 {
12         
13 }
14
15 void
16 Pixbuf::render (Rect const & /*area*/, Cairo::RefPtr<Cairo::Context> context) const
17 {
18         Gdk::Cairo::set_source_pixbuf (context, _pixbuf, 0, 0);
19         context->paint ();
20 }
21         
22 void
23 Pixbuf::compute_bounding_box () const
24 {
25         if (_pixbuf) {
26                 _bounding_box = boost::optional<Rect> (Rect (0, 0, _pixbuf->get_width(), _pixbuf->get_height()));
27         } else {
28                 _bounding_box = boost::optional<Rect> ();
29         }
30
31         _bounding_box_dirty = false;
32 }
33
34 void
35 Pixbuf::set (Glib::RefPtr<Gdk::Pixbuf> pixbuf)
36 {
37         begin_change ();
38         
39         _pixbuf = pixbuf;
40         _bounding_box_dirty = true;
41
42         end_change ();
43 }
44
45 Glib::RefPtr<Gdk::Pixbuf>
46 Pixbuf::pixbuf() {
47         return _pixbuf;
48 }
49