[build] move headless rendering files to platform/default

This commit is contained in:
Konstantin Käfer
2016-11-22 15:17:51 +01:00
parent 3bc79e316e
commit 117863f111
38 changed files with 72 additions and 63 deletions

View File

@@ -1,57 +0,0 @@
#pragma once
#include <mbgl/gl/extension.hpp>
#include <mbgl/map/backend.hpp>
#include <memory>
#include <functional>
namespace mbgl {
class HeadlessDisplay;
class HeadlessBackend : public Backend {
public:
HeadlessBackend();
HeadlessBackend(std::shared_ptr<HeadlessDisplay>);
~HeadlessBackend() override;
void invalidate() override;
void activate() override;
void deactivate() override;
void notifyMapChange(MapChange) override;
void setMapChangeCallback(std::function<void(MapChange)>&& cb) { mapChangeCallback = std::move(cb); }
struct Impl {
virtual ~Impl() {}
virtual void activateContext() = 0;
virtual void deactivateContext() {}
};
private:
// Implementation specific functions
static gl::glProc initializeExtension(const char*);
bool hasContext() const { return bool(impl); }
bool hasDisplay();
void createContext();
private:
void destroyContext();
void activateContext();
void deactivateContext();
std::unique_ptr<Impl> impl;
std::shared_ptr<HeadlessDisplay> display;
bool extensionsLoaded = false;
bool active = false;
std::function<void(MapChange)> mapChangeCallback;
};
} // namespace mbgl

View File

@@ -1,20 +0,0 @@
#pragma once
#include <memory>
namespace mbgl {
class HeadlessDisplay {
public:
HeadlessDisplay();
~HeadlessDisplay();
template <typename DisplayAttribute>
DisplayAttribute attribute() const;
private:
class Impl;
std::unique_ptr<Impl> impl;
};
} // namespace mbgl

View File

@@ -1,33 +0,0 @@
#pragma once
#include <mbgl/map/view.hpp>
#include <mbgl/gl/framebuffer.hpp>
#include <mbgl/gl/renderbuffer.hpp>
#include <mbgl/util/optional.hpp>
#include <mbgl/util/image.hpp>
namespace mbgl {
namespace gl {
class Context;
} // namespace gl
class OffscreenView : public View {
public:
OffscreenView(gl::Context&, Size size = { 256, 256 });
void bind() override;
PremultipliedImage readStillImage();
public:
const Size size;
private:
gl::Context& context;
optional<gl::Framebuffer> framebuffer;
optional<gl::Renderbuffer<gl::RenderbufferType::RGBA>> color;
optional<gl::Renderbuffer<gl::RenderbufferType::DepthStencil>> depthStencil;
};
} // namespace mbgl