]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/mag-gfx/include/clip_guard
130fb56954c323527aaacf63b586e1bba263fd12
[l4.git] / l4 / pkg / mag-gfx / include / clip_guard
1 // vi:ft=cpp
2 /*
3  * (c) 2010 Alexander Warg <warg@os.inf.tu-dresden.de>
4  *     economic rights: Technische Universität Dresden (Germany)
5  *
6  * This file is part of TUD:OS and distributed under the terms of the
7  * GNU General Public License 2.
8  * Please see the COPYING-GPL-2 file for details.
9  */
10 #pragma once
11
12 #include <l4/mag-gfx/canvas>
13
14 namespace Mag_gfx {
15
16 class Clip_guard
17 {
18 private:
19   Canvas *_c;
20   Rect _o;
21
22   Clip_guard(Clip_guard const &);
23   void operator = (Clip_guard const &);
24
25 public:
26   Clip_guard(Canvas *canvas, Rect const &n)
27   : _c(canvas), _o(_c->clip())
28   { _c->set_clipping(_o & n); }
29
30   ~Clip_guard() { _c->set_clipping(_o); }
31
32 };
33
34 }