~hikiko/mir/mir.sdl-backend

« back to all changes in this revision

Viewing changes to src/server/graphics/sdl/sdl_display.cpp

  • Committer: Eleni Maria Stea
  • Date: 2013-03-20 10:46:49 UTC
  • Revision ID: elene.mst@gmail.com-20130320104649-a68tzebn7jtrc616
*in progress* display - sdl initialization - quick backup

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 */
18
18
 
19
19
#include "sdl_display.h"
 
20
 
 
21
#include "mir/graphics/display_configuration.h"
 
22
 
20
23
#include <boost/throw_exception.hpp>
21
24
#include <stdexcept>
 
25
 
22
26
#include <GL/gl.h>
23
27
 
 
28
#include <functional>
 
29
 
24
30
namespace mgs = mir::graphics::sdl;
25
31
namespace mg = mir::graphics;
26
32
namespace geom = mir::geometry;
27
33
 
28
 
/* TODO: null display configuration */
 
34
namespace
 
35
{
 
36
class NullDisplayConfiguration : public mg::DisplayConfiguration {
 
37
public:
 
38
        void for_each_card(std::function<void(mg::DisplayConfigurationCard const&)>)
 
39
    {
 
40
    }
 
41
 
 
42
    void for_each_output(std::function<void(mg::DisplayConfigurationOutput const&)>)
 
43
    {
 
44
    }
 
45
 
 
46
};
 
47
}
29
48
 
30
49
mgs::SDLDisplay::SDLDisplay()
31
50
{
66
85
        return true;
67
86
}
68
87
 
 
88
geom::Rectangle mgs::SDLDisplay::view_area() const
 
89
{
 
90
        geom::Point pt {geom::X{0}, geom::Y{0}};
 
91
        geom::Size sz {
 
92
                geom::Width {sdl_surf->w},
 
93
                geom::Height {sdl_surf->h}
 
94
        };
 
95
 
 
96
        return geom::Rectangle {pt, sz};
 
97
}
 
98
 
 
99
void mgs::SDLDisplay::for_each_display_buffer(std::function<void(mg::DisplayBuffer&)> const& f)
 
100
{
 
101
        f(*this);
 
102
}
 
103
 
 
104
std::shared_ptr<mg::DisplayConfiguration> mgs::SDLDisplay::configuration()
 
105
{
 
106
        return std::make_shared<NullDisplayConfiguration>();
 
107
}