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')
-rw-r--r--iphone/Maps/Classes/EAGLView.h13
-rw-r--r--iphone/Maps/Classes/EAGLView.mm37
-rw-r--r--iphone/Maps/Classes/MapViewController.mm3
-rw-r--r--iphone/Maps/Classes/WindowHandle.h17
-rw-r--r--iphone/Maps/Classes/WindowHandle.mm15
5 files changed, 21 insertions, 64 deletions
diff --git a/iphone/Maps/Classes/EAGLView.h b/iphone/Maps/Classes/EAGLView.h
index 4a24c4e958..a7289d4b6f 100644
--- a/iphone/Maps/Classes/EAGLView.h
+++ b/iphone/Maps/Classes/EAGLView.h
@@ -9,7 +9,8 @@
#include "../../map/drawer_yg.hpp"
#include "../../map/framework.hpp"
#include "../../map/feature_vec_model.hpp"
-#include "RenderBuffer.hpp"
+#include "../../platform/video_timer.hpp"
+#include"RenderBuffer.hpp"
namespace iphone
{
@@ -41,17 +42,15 @@ typedef Framework<model::FeaturesFetcher> framework_t;
@public
- shared_ptr<iphone::WindowHandle> windowHandle;
+ shared_ptr<WindowHandle> windowHandle;
+ shared_ptr<VideoTimer> videoTimer;
shared_ptr<DrawerYG> drawer;
shared_ptr<iphone::RenderBuffer> renderBuffer;
}
-// Called as a result of invalidate on iphone::WindowHandle
-- (void)drawViewOnMainThread;
-
-@property (nonatomic, assign) CADisplayLink * displayLink;
+- (void) drawFrame;
@property (nonatomic, assign) framework_t * framework;
-@property (nonatomic, assign) shared_ptr<iphone::WindowHandle> windowHandle;
+@property (nonatomic, assign) shared_ptr<WindowHandle> windowHandle;
@property (nonatomic, assign) shared_ptr<DrawerYG> drawer;
@property (nonatomic, assign) shared_ptr<iphone::RenderContext> renderContext;
@property (nonatomic, assign) shared_ptr<iphone::RenderBuffer> renderBuffer;
diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm
index 842ec24bef..44c4566d3c 100644
--- a/iphone/Maps/Classes/EAGLView.mm
+++ b/iphone/Maps/Classes/EAGLView.mm
@@ -2,7 +2,6 @@
#import <OpenGLES/EAGLDrawable.h>
#import "EAGLView.h"
-#import "WindowHandle.h"
#include "../../yg/screen.hpp"
#include "../../yg/texture.hpp"
@@ -13,18 +12,15 @@
#include "RenderBuffer.hpp"
#include "RenderContext.hpp"
-bool _doRepaint = true;
-bool _inRepaint = false;
-
@implementation EAGLView
@synthesize framework;
@synthesize windowHandle;
+@synthesize videoTimer;
@synthesize drawer;
@synthesize renderContext;
@synthesize renderBuffer;
@synthesize resourceManager;
-@synthesize displayLink;
// You must implement this method
+ (Class)layerClass
@@ -143,13 +139,19 @@ bool _inRepaint = false;
drawer = shared_ptr<DrawerYG>(new DrawerYG(p));
- windowHandle = shared_ptr<iphone::WindowHandle>(new iphone::WindowHandle(_doRepaint));
+ windowHandle.reset(new WindowHandle());
- windowHandle->setRenderContext(renderContext);
+ windowHandle->setUpdatesEnabled(false);
+
+ typedef void (*drawFrameFn)(id, SEL);
+ SEL drawFrameSel = @selector(drawFrame);
+ drawFrameFn drawFrameImpl = (drawFrameFn)[self methodForSelector:drawFrameSel];
+
+ videoTimer.reset(CreateIOSVideoTimer(bind(drawFrameImpl, self, drawFrameSel)));
- displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(drawView)];
- displayLink.frameInterval = 1;
- [displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
+ windowHandle->setVideoTimer(videoTimer);
+
+ windowHandle->setRenderContext(renderContext);
}
return self;
@@ -174,7 +176,7 @@ bool _inRepaint = false;
drawer->screen()->endFrame();
}
-- (void)drawView
+- (void)drawFrame
{
shared_ptr<PaintEvent> pe(new PaintEvent(drawer.get()));
if (windowHandle->needRedraw())
@@ -187,16 +189,6 @@ bool _inRepaint = false;
}
}
-- (void)drawViewThunk:(id)obj
-{
- [self drawView];
-}
-
-- (void)drawViewOnMainThread
-{
- [self performSelectorOnMainThread:@selector(drawViewThunk:) withObject:nil waitUntilDone:NO];
-}
-
- (void)layoutSubviews
{
CGFloat const scale = self.contentScaleFactor;
@@ -206,8 +198,7 @@ bool _inRepaint = false;
- (void)dealloc
{
- [displayLink invalidate];
- [displayLink release];
+ videoTimer.reset();
[EAGLContext setCurrentContext:nil];
[super dealloc];
}
diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm
index 2ccd1a0cd9..733f03a610 100644
--- a/iphone/Maps/Classes/MapViewController.mm
+++ b/iphone/Maps/Classes/MapViewController.mm
@@ -2,7 +2,6 @@
#import "SearchVC.h"
#import "MapsAppDelegate.h"
#import "EAGLView.h"
-#import "WindowHandle.h"
#import "../Settings/SettingsManager.h"
#include "RenderContext.hpp"
@@ -122,7 +121,7 @@ storage::Storage m_storage;
// Here we're creating view and window handle in it, and later we should pass framework to the view
EAGLView * v = (EAGLView *)self.view;
- shared_ptr<iphone::WindowHandle> windowHandle = [(EAGLView*)self.view windowHandle];
+ shared_ptr<WindowHandle> windowHandle = [(EAGLView*)self.view windowHandle];
shared_ptr<yg::ResourceManager> resourceManager = [(EAGLView*)self.view resourceManager];
m_framework = FrameworkFactory<model::FeaturesFetcher>::CreateFramework(windowHandle, 40);
diff --git a/iphone/Maps/Classes/WindowHandle.h b/iphone/Maps/Classes/WindowHandle.h
deleted file mode 100644
index 394e82aa81..0000000000
--- a/iphone/Maps/Classes/WindowHandle.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#import "RenderContext.hpp"
-
-#include "../../../map/window_handle.hpp"
-
-@class EAGLView;
-
-namespace iphone
-{
- class WindowHandle : public ::WindowHandle
- {
- bool * m_doRepaint;
-
- public:
- WindowHandle(bool & doRepaint);
- virtual void invalidateImpl();
- };
-}
diff --git a/iphone/Maps/Classes/WindowHandle.mm b/iphone/Maps/Classes/WindowHandle.mm
deleted file mode 100644
index cf657a0019..0000000000
--- a/iphone/Maps/Classes/WindowHandle.mm
+++ /dev/null
@@ -1,15 +0,0 @@
-#import "WindowHandle.h"
-#import "EAGLView.h"
-
-namespace iphone
-{
- WindowHandle::WindowHandle(bool & doRepaint)
- {
- m_doRepaint = &doRepaint;
- }
-
- void WindowHandle::invalidateImpl()
- {
- *m_doRepaint = true;
- }
-} \ No newline at end of file