]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/mag/server/src/screen.cc
update
[l4.git] / l4 / pkg / mag / server / src / screen.cc
1 /*
2  * (c) 2010 Alexander Warg <warg@os.inf.tu-dresden.de>
3  *     economic rights: Technische Universität Dresden (Germany)
4  *
5  * This file is part of TUD:OS and distributed under the terms of the
6  * GNU General Public License 2.
7  * Please see the COPYING-GPL-2 file for details.
8  */
9 #include "factory"
10
11 #include <l4/mag-gfx/mem_factory>
12 #include "mouse_cursor.h"
13
14 namespace Mag_server {
15
16 using namespace Mag_gfx;
17
18
19 template< typename PT >
20 class Csf : public Screen_factory, public Mem::Factory<PT>
21 {
22 public:
23
24   View *create_cursor(Texture const *cursor)
25   {
26     typedef typename PT::Pixel Pixel;
27     if (cursor->type() == PT::type())
28       return new Mouse_cursor<PT>(cursor);
29     else
30       {
31         void *m = malloc(cursor->size().pixels() * sizeof(Pixel));
32         Texture *c = new Mem::Texture<PT>((Pixel*)m, cursor->size());
33         c->blit(cursor);
34         return new Mouse_cursor<PT>(c);
35       }
36   }
37
38 };
39
40
41 static Csf<Rgb15>  _csf_rgb15;
42 static Csf<Bgr15>  _csf_bgr15;
43 static Csf<Rgb16>  _csf_rgb16;
44 static Csf<Bgr16>  _csf_bgr16;
45 static Csf<Rgb24>  _csf_rgb24;
46 static Csf<Rgb32>  _csf_rgb32;
47 static Csf<Bgr32>  _csf_bgr32;
48 static Csf<Rgba32>  _csf_rgba32;
49
50 }