Added context factory to BERenderer.

This commit is contained in:
Dmitry Kunin 2013-12-27 17:26:59 +03:00 committed by Alex Zolotarev
parent fe06759578
commit d3eb0931b8
4 changed files with 27 additions and 19 deletions

View file

@ -8,13 +8,14 @@
namespace df
{
BackendRenderer::BackendRenderer(RefPointer<ThreadsCommutator> commutator,
double visualScale,
int surfaceWidth,
int surfaceHeight)
BackendRenderer::BackendRenderer(RefPointer<ThreadsCommutator> commutator
,RefPointer<OGLContextFactory> oglcontextfactory
,double visualScale
,int surfaceWidth
,int surfaceHeight)
: m_commutator(commutator)
{
m_impl.Reset(new BackendRendererImpl(m_commutator, visualScale, surfaceWidth, surfaceHeight));
m_impl.Reset(new BackendRendererImpl(m_commutator, oglcontextfactory, visualScale, surfaceWidth, surfaceHeight));
}
BackendRenderer::~BackendRenderer()

View file

@ -1,6 +1,7 @@
#pragma once
#include "../drape/pointers.hpp"
#include "../drape/oglcontextfactory.hpp"
#include "../geometry/screenbase.hpp"
@ -15,10 +16,11 @@ namespace df
class BackendRenderer
{
public:
BackendRenderer(RefPointer<ThreadsCommutator> commutator,
double visualScale,
int surfaceWidth,
int surfaceHeight);
BackendRenderer(RefPointer<ThreadsCommutator> commutator
,RefPointer<OGLContextFactory> oglcontextfactory
,double visualScale
,int surfaceWidth
,int surfaceHeight);
~BackendRenderer();

View file

@ -1,7 +1,6 @@
#include "backend_renderer_impl.hpp"
#include "threads_commutator.hpp"
#include "render_thread.hpp"
#include "tile_info.hpp"
#include "memory_feature_index.hpp"
#include "read_mwm_task.hpp"
@ -43,12 +42,14 @@ namespace
namespace df
{
BackendRendererImpl::BackendRendererImpl(RefPointer<ThreadsCommutator> commutator,
double visualScale,
int surfaceWidth,
int surfaceHeight)
BackendRendererImpl::BackendRendererImpl(RefPointer<ThreadsCommutator> commutator
,RefPointer<OGLContextFactory> oglcontextfactory
,double visualScale
,int surfaceWidth
,int surfaceHeight)
: m_engineContext(commutator)
, m_commutator(commutator)
, m_contextFactory(oglcontextfactory)
{
m_scaleProcessor.SetParams(visualScale, ScalesProcessor::CalculateTileSize(surfaceWidth, surfaceHeight));
@ -208,7 +209,7 @@ namespace df
void BackendRendererImpl::ThreadMain()
{
InitRenderThread();
m_contextFactory->getResourcesUploadContext()->makeCurrent();
while (!IsCancelled())
ProcessSingleMessage(true);

View file

@ -6,6 +6,7 @@
#include "batchers_pool.hpp"
#include "../drape/pointers.hpp"
#include "../drape/oglcontextfactory.hpp"
#include "../map/scales_processor.hpp"
#include "../map/tiler.hpp"
@ -27,10 +28,12 @@ namespace df
public threads::IRoutine
{
public:
BackendRendererImpl(RefPointer<ThreadsCommutator> commutator,
double visualScale,
int surfaceWidth,
int surfaceHeight);
BackendRendererImpl(RefPointer<ThreadsCommutator> commutator
,RefPointer<OGLContextFactory> oglcontextfactory
,double visualScale
,int surfaceWidth
,int surfaceHeight);
~BackendRendererImpl();
private:
@ -86,5 +89,6 @@ namespace df
threads::Thread m_selfThread;
MasterPointer<threads::ThreadPool> m_threadPool;
RefPointer<ThreadsCommutator> m_commutator;
RefPointer<OGLContextFactory> m_contextFactory;
};
}