Files
MapLibreParticleLab/platform/qt/src/qmapboxgl_map_renderer.hpp
Thiago Marcos P. Santos 06f1dc48a2 [core] Make the BackgroundScheduler a singleton
- Do not carry it over everywhere as parameter, it is a shared
  instance anyway and the lifecycle is pretty much the app lifecycle
  from the moment we instantiate a map.
- Rename to BackgroundScheduler because it is a Scheduler that will
  do tasks in the background, we don't make assumptions if it is a
  thread pool or a single thread.
- Most importantly, remove the dependency from `core` on `platform`.
2019-05-10 14:20:38 +03:00

53 lines
1.1 KiB
C++

#pragma once
#include "qmapboxgl.hpp"
#include "qmapboxgl_renderer_backend.hpp"
#include <mbgl/renderer/renderer.hpp>
#include <mbgl/renderer/renderer_observer.hpp>
#include <mbgl/util/util.hpp>
#include <QtGlobal>
#include <memory>
#include <mutex>
namespace mbgl {
class Renderer;
class UpdateParameters;
} // namespace mbgl
class QMapboxGLRendererBackend;
class QMapboxGLMapRenderer : public QObject
{
Q_OBJECT
public:
QMapboxGLMapRenderer(qreal pixelRatio, QMapboxGLSettings::GLContextMode, const QString &localFontFamily);
virtual ~QMapboxGLMapRenderer();
void render();
void updateFramebuffer(quint32 fbo, const mbgl::Size &size);
void setObserver(std::shared_ptr<mbgl::RendererObserver>);
// Thread-safe, called by the Frontend
void updateParameters(std::shared_ptr<mbgl::UpdateParameters>);
signals:
void needsRendering();
private:
MBGL_STORE_THREAD(tid)
Q_DISABLE_COPY(QMapboxGLMapRenderer)
std::mutex m_updateMutex;
std::shared_ptr<mbgl::UpdateParameters> m_updateParameters;
QMapboxGLRendererBackend m_backend;
std::unique_ptr<mbgl::Renderer> m_renderer;
bool m_forceScheduler;
};