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