Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'iphone/Maps/Classes/EAGLView.mm')
-rw-r--r--iphone/Maps/Classes/EAGLView.mm165
1 files changed, 3 insertions, 162 deletions
diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm
index 0406a6d560..cef3ca5ef2 100644
--- a/iphone/Maps/Classes/EAGLView.mm
+++ b/iphone/Maps/Classes/EAGLView.mm
@@ -5,27 +5,14 @@
#import "MWMDirectionView.h"
#include "Framework.h"
-
-#ifndef USE_DRAPE
- #include "RenderBuffer.hpp"
- #include "RenderContext.hpp"
- #include "graphics/resource_manager.hpp"
- #include "graphics/opengl/opengl.hpp"
- #include "graphics/data_formats.hpp"
- #include "indexer/classificator_loader.hpp"
-#else
- #import "../Platform/opengl/iosOGLContextFactory.h"
-#endif
-
-#include "render/render_policy.hpp"
+#include "indexer/classificator_loader.hpp"
+#import "../Platform/opengl/iosOGLContextFactory.h"
#include "platform/platform.hpp"
-#include "platform/video_timer.hpp"
#include "std/bind.hpp"
#include "std/limits.hpp"
-
@implementation EAGLView
namespace
@@ -106,26 +93,8 @@ graphics::EDensity getDensityType(int exactDensityDPI, double scale)
// Correct retina display support in opengl renderbuffer
self.contentScaleFactor = [self correctContentScale];
-#ifndef USE_DRAPE
- renderContext = shared_ptr<iphone::RenderContext>(new iphone::RenderContext());
-
- if (!renderContext.get())
- {
- NSLog(@"EAGLView initWithCoder Error");
- return nil;
- }
-
- renderContext->makeCurrent();
-
- typedef void (*drawFrameFn)(id, SEL);
- SEL drawFrameSel = @selector(drawFrame);
- drawFrameFn drawFrameImpl = (drawFrameFn)[self methodForSelector:drawFrameSel];
-
- videoTimer = CreateIOSVideoTimer(bind(drawFrameImpl, self, drawFrameSel));
-#else
dp::ThreadSafeFactory * factory = new dp::ThreadSafeFactory(new iosOGLContextFactory(eaglLayer));
m_factory.Reset(factory);
-#endif
}
NSLog(@"EAGLView initWithCoder Ended");
@@ -135,50 +104,9 @@ graphics::EDensity getDensityType(int exactDensityDPI, double scale)
- (void)initRenderPolicy
{
NSLog(@"EAGLView initRenderPolicy Started");
-
-#ifndef USE_DRAPE
- int const dpi = static_cast<int>(getExactDPI());
-
- graphics::ResourceManager::Params rmParams;
- rmParams.m_videoMemoryLimit = GetPlatform().VideoMemoryLimit();
- rmParams.m_texFormat = graphics::Data4Bpp;
- rmParams.m_exactDensityDPI = dpi;
-
- RenderPolicy::Params rpParams;
- UIScreen * screen = [UIScreen mainScreen];
- CGRect screenRect = screen.bounds;
-
- double vs = self.contentScaleFactor;
-
- rpParams.m_screenWidth = screenRect.size.width * vs;
- rpParams.m_screenHeight = screenRect.size.height * vs;
- rpParams.m_skinName = "basic.skn";
- rpParams.m_density = getDensityType(dpi, vs);
- rpParams.m_exactDensityDPI = dpi;
- rpParams.m_videoTimer = videoTimer;
- rpParams.m_useDefaultFB = false;
- rpParams.m_rmParams = rmParams;
- rpParams.m_primaryRC = renderContext;
-
- try
- {
- renderPolicy = CreateRenderPolicy(rpParams);
- }
- catch (graphics::gl::platform_unsupported const & )
- {
- /// terminate program (though this situation is unreal :) )
- }
-
- frameBuffer = renderPolicy->GetDrawer()->Screen()->frameBuffer();
-
- Framework & f = GetFramework();
- f.SetRenderPolicy(renderPolicy);
- f.InitGuiSubsystem();
-#else
CGRect frameRect = [UIScreen mainScreen].applicationFrame;
GetFramework().CreateDrapeEngine(m_factory.GetRefPointer(), self.contentScaleFactor, frameRect.size.width, frameRect.size.height);
-#endif
NSLog(@"EAGLView initRenderPolicy Ended");
}
@@ -198,67 +126,12 @@ graphics::EDensity getDensityType(int exactDensityDPI, double scale)
- (void)setMapStyle:(MapStyle)mapStyle
{
- Framework & f = GetFramework();
-
- if (f.GetMapStyle() == mapStyle)
- return;
-
- NSLog(@"EAGLView setMapStyle Started");
-
- renderContext->makeCurrent();
-
- /// drop old render policy
- f.SetRenderPolicy(nullptr);
- frameBuffer.reset();
-
- f.SetMapStyle(mapStyle);
-
- /// init new render policy
- [self initRenderPolicy];
-
- /// restore render policy screen
- CGFloat const scale = self.contentScaleFactor;
- CGSize const s = self.bounds.size;
- [self onSize:s.width * scale withHeight:s.height * scale];
-
- /// update framework
- f.SetUpdatesEnabled(true);
-
- NSLog(@"EAGLView setMapStyle Ended");
+ //@TODO UVR
}
- (void)onSize:(int)width withHeight:(int)height
{
-#ifndef USE_DRAPE
- frameBuffer->onSize(width, height);
-
- graphics::Screen * screen = renderPolicy->GetDrawer()->Screen();
-
- /// free old render buffer, as we would not create a new one.
- screen->resetRenderTarget();
- screen->resetDepthBuffer();
- renderBuffer.reset();
-
- /// detaching of old render target will occur inside beginFrame
- screen->beginFrame();
- screen->endFrame();
-
- /// allocate the new one
- renderBuffer.reset();
- renderBuffer.reset(new iphone::RenderBuffer(renderContext, (CAEAGLLayer*)self.layer));
-
- screen->setRenderTarget(renderBuffer);
- screen->setDepthBuffer(make_shared<graphics::gl::RenderBuffer>(width, height, true));
-#endif
-
GetFramework().OnSize(width, height);
-
-#ifndef USE_DRAPE
- screen->beginFrame();
- screen->clear(graphics::Screen::s_bgColor);
- screen->endFrame();
- GetFramework().SetNeedRedraw(true);
-#endif
}
- (double)correctContentScale
@@ -270,52 +143,20 @@ graphics::EDensity getDensityType(int exactDensityDPI, double scale)
return uiScreen.nativeScale;
}
-#ifndef USE_DRAPE
-- (void)drawFrame
-{
- shared_ptr<PaintEvent> pe(new PaintEvent(renderPolicy->GetDrawer().get()));
-
- Framework & f = GetFramework();
- if (f.NeedRedraw())
- {
- // Workaround. iOS Voice recognition creates own OGL-context, so here we must set ours
- // (http://discuss.cocos2d-x.org/t/engine-crash-on-ios7/9129/6)
- [EAGLContext setCurrentContext:renderContext->getEAGLContext()];
-
- f.SetNeedRedraw(false);
- f.BeginPaint(pe);
- f.DoPaint(pe);
- renderBuffer->present();
- f.EndPaint(pe);
- }
-}
-#endif
-
- (void)layoutSubviews
{
if (!CGRectEqualToRect(lastViewSize, self.frame))
{
lastViewSize = self.frame;
-#ifndef USE_DRAPE
- CGFloat const scale = self.contentScaleFactor;
- CGSize const s = self.bounds.size;
- [self onSize:s.width * scale withHeight:s.height * scale];
-#else
CGSize const s = self.bounds.size;
[self onSize:s.width withHeight:s.height];
-#endif
}
}
- (void)dealloc
{
-#ifndef USE_DRAPE
- delete videoTimer;
- [EAGLContext setCurrentContext:nil];
-#else
GetFramework().PrepareToShutdown();
m_factory.Destroy();
-#endif
}
- (CGPoint)viewPoint2GlobalPoint:(CGPoint)pt