~vanvugt/mir/fix-1226139

« back to all changes in this revision

Viewing changes to src/server/graphics/android/android_platform.cpp

  • Committer: Tarmac
  • Author(s): Alan Griffiths
  • Date: 2013-09-11 12:17:14 UTC
  • mfrom: (1059.1.3 mir)
  • Revision ID: tarmac-20130911121714-l4u0c5s7jystmhm6
graphics: Simplify NativeAndroidPlatform out of existence.

Approved by Alexandros Frantzis, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include "mir/graphics/buffer_ipc_packer.h"
31
31
#include "mir/options/option.h"
32
32
 
33
 
#include "mir/graphics/native_platform.h"
34
33
#include "mir/graphics/null_display_report.h"
35
34
#include <boost/throw_exception.hpp>
36
35
#include <stdexcept>
100
99
    packer->pack_stride(buffer->stride());
101
100
}
102
101
 
 
102
void mga::AndroidPlatform::initialize(int /*data_items*/, int const* /*data*/, int /*fd_items*/, int const* /*fd*/)
 
103
{
 
104
}
 
105
 
 
106
 
103
107
std::shared_ptr<mg::InternalClient> mga::AndroidPlatform::create_internal_client()
104
108
{
105
109
    return std::make_shared<mga::InternalClient>();
110
114
    return std::make_shared<mga::AndroidPlatform>(display_report);
111
115
}
112
116
 
113
 
namespace
114
 
{
115
 
// TODO: mg::NativePlatform is not needed. Remove interface and just use mga::AndroidPlatform
116
 
// It may well turn out that NativePlatform == Platform - but this keeps them separate for now
117
 
struct NativeAndroidPlatform : mg::NativePlatform
118
 
{
119
 
    NativeAndroidPlatform()
120
 
        : underlying_android_platform(std::make_shared<mga::AndroidPlatform>(std::make_shared<mg::NullDisplayReport>()))
121
 
    {
122
 
 
123
 
    }
124
 
 
125
 
    void initialize(int /*data_items*/, int const* /*data*/, int /*fd_items*/, int const* /*fd*/) override
126
 
    {
127
 
    }
128
 
 
129
 
    std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator(
130
 
        std::shared_ptr<mg::BufferInitializer> const& init) override
131
 
    {
132
 
        return underlying_android_platform->create_buffer_allocator(init);
133
 
    }
134
 
 
135
 
    std::shared_ptr<mg::PlatformIPCPackage> get_ipc_package() override
136
 
    {
137
 
        return underlying_android_platform->get_ipc_package();
138
 
    }
139
 
 
140
 
    std::shared_ptr<mg::InternalClient> create_internal_client() override
141
 
    {
142
 
        return underlying_android_platform->create_internal_client();
143
 
    }
144
 
 
145
 
    void fill_ipc_package(std::shared_ptr<mg::BufferIPCPacker> const& packer,
146
 
            std::shared_ptr<mg::Buffer> const& buf) const override
147
 
    {
148
 
       underlying_android_platform->fill_ipc_package(packer, buf);
149
 
    }
150
 
 
151
 
private:
152
 
    std::shared_ptr<mg::Platform> underlying_android_platform;
153
 
};
154
 
}
155
 
 
156
 
extern "C" std::shared_ptr<mg::NativePlatform> create_native_platform()
157
 
{
158
 
    return std::make_shared<::NativeAndroidPlatform>();
 
117
extern "C" std::shared_ptr<mg::NativePlatform> create_native_platform(std::shared_ptr<mg::DisplayReport> const& display_report)
 
118
{
 
119
    return std::make_shared<mga::AndroidPlatform>(display_report);
159
120
}