1 /** @file windowtransform.cpp  Base class for window content transformation.
2  *
3  * @authors Copyright (c) 2013-2017 Jaakko Keränen <jaakko.keranen@iki.fi>
4  *
5  * @par License
6  * LGPL: http://www.gnu.org/licenses/lgpl.html
7  *
8  * <small>This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or (at your
11  * option) any later version. This program is distributed in the hope that it
12  * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
14  * General Public License for more details. You should have received a copy of
15  * the GNU Lesser General Public License along with this program; if not, see:
16  * http://www.gnu.org/licenses</small>
17  */
18 
19 #include "de/WindowTransform"
20 #include "de/BaseWindow"
21 
22 namespace de {
23 
DENG2_PIMPL_NOREF(WindowTransform)24 DENG2_PIMPL_NOREF(WindowTransform)
25 {
26     BaseWindow *win;
27 };
28 
WindowTransform(BaseWindow & window)29 WindowTransform::WindowTransform(BaseWindow &window)
30     : d(new Impl)
31 {
32     d->win = &window;
33 }
34 
window() const35 BaseWindow &WindowTransform::window() const
36 {
37     DENG2_ASSERT(d->win != 0);
38     return *d->win;
39 }
40 
glInit()41 void WindowTransform::glInit()
42 {
43     // nothing to do
44 }
45 
glDeinit()46 void WindowTransform::glDeinit()
47 {
48     // nothing to do
49 }
50 
logicalRootSize(Vector2ui const & physicalCanvasSize) const51 Vector2ui WindowTransform::logicalRootSize(Vector2ui const &physicalCanvasSize) const
52 {
53     return physicalCanvasSize;
54 }
55 
windowToLogicalCoords(Vector2i const & pos) const56 Vector2f WindowTransform::windowToLogicalCoords(Vector2i const &pos) const
57 {
58     return pos;
59 }
60 
logicalToWindowCoords(Vector2i const & pos) const61 Vector2f WindowTransform::logicalToWindowCoords(Vector2i const &pos) const
62 {
63     return pos;
64 }
65 
logicalToWindowCoords(Rectanglei const & rect) const66 Rectanglef WindowTransform::logicalToWindowCoords(Rectanglei const &rect) const
67 {
68     return Rectanglef(logicalToWindowCoords(rect.topLeft),
69                       logicalToWindowCoords(rect.bottomRight));
70 }
71 
drawTransformed()72 void WindowTransform::drawTransformed()
73 {
74     return d->win->drawWindowContent();
75 }
76 
77 } // namespace de
78