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:
authorrachytski <siarhei.rachytski@gmail.com>2011-10-24 20:15:40 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:26:38 +0300
commit943d893105e3e76839be98529994414c4b0b01a0 (patch)
treec9a0dd11971b9bd300323d8b01b6fd11f03ed473 /iphone/Maps
parent9906d541f6b2279b550d05ec6e5a6422c5e7ccf6 (diff)
using VideoTimer in Desktop and iOS version. stopping it, when the pause is longer than 60 cycles. refactored WindowHandle. implemented QtVideoTimer. closes #356
Diffstat (limited to 'iphone/Maps')
-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
-rw-r--r--iphone/Maps/Maps.xcodeproj/project.pbxproj6
6 files changed, 21 insertions, 70 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
diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj
index 20fb203878..2c91621e0f 100644
--- a/iphone/Maps/Maps.xcodeproj/project.pbxproj
+++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj
@@ -40,7 +40,6 @@
EE583CBB12F773F00042CBE3 /* unicode_blocks.txt in Resources */ = {isa = PBXBuildFile; fileRef = EE583CBA12F773F00042CBE3 /* unicode_blocks.txt */; };
EE7F29811219ECA300EB67A9 /* RenderBuffer.mm in Sources */ = {isa = PBXBuildFile; fileRef = EE7F297D1219ECA300EB67A9 /* RenderBuffer.mm */; };
EE7F29821219ECA300EB67A9 /* RenderContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = EE7F297E1219ECA300EB67A9 /* RenderContext.mm */; };
- EE7F29831219ECA300EB67A9 /* WindowHandle.mm in Sources */ = {isa = PBXBuildFile; fileRef = EE7F29801219ECA300EB67A9 /* WindowHandle.mm */; };
EEA61601134C496A003A9827 /* 01_dejavusans.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EEA615E5134C4968003A9827 /* 01_dejavusans.ttf */; };
EEA61602134C496A003A9827 /* 02_wqy-microhei.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EEA615E6134C4968003A9827 /* 02_wqy-microhei.ttf */; };
EEA61603134C496A003A9827 /* 03_jomolhari-id-a3d.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EEA615E7134C4968003A9827 /* 03_jomolhari-id-a3d.ttf */; };
@@ -649,8 +648,6 @@
EE7F297C1219ECA300EB67A9 /* RenderBuffer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; name = RenderBuffer.hpp; path = Classes/RenderBuffer.hpp; sourceTree = SOURCE_ROOT; };
EE7F297D1219ECA300EB67A9 /* RenderBuffer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = RenderBuffer.mm; path = Classes/RenderBuffer.mm; sourceTree = SOURCE_ROOT; };
EE7F297E1219ECA300EB67A9 /* RenderContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = RenderContext.mm; path = Classes/RenderContext.mm; sourceTree = SOURCE_ROOT; };
- EE7F297F1219ECA300EB67A9 /* WindowHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = WindowHandle.h; path = Classes/WindowHandle.h; sourceTree = SOURCE_ROOT; };
- EE7F29801219ECA300EB67A9 /* WindowHandle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = WindowHandle.mm; path = Classes/WindowHandle.mm; sourceTree = SOURCE_ROOT; };
EEA615E5134C4968003A9827 /* 01_dejavusans.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = 01_dejavusans.ttf; path = ../../data/01_dejavusans.ttf; sourceTree = SOURCE_ROOT; };
EEA615E6134C4968003A9827 /* 02_wqy-microhei.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "02_wqy-microhei.ttf"; path = "../../data/02_wqy-microhei.ttf"; sourceTree = SOURCE_ROOT; };
EEA615E7134C4968003A9827 /* 03_jomolhari-id-a3d.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "03_jomolhari-id-a3d.ttf"; path = "../../data/03_jomolhari-id-a3d.ttf"; sourceTree = SOURCE_ROOT; };
@@ -1271,8 +1268,6 @@
EE7F297D1219ECA300EB67A9 /* RenderBuffer.mm */,
EE16192B126E374500622BD0 /* RenderContext.hpp */,
EE7F297E1219ECA300EB67A9 /* RenderContext.mm */,
- EE7F297F1219ECA300EB67A9 /* WindowHandle.h */,
- EE7F29801219ECA300EB67A9 /* WindowHandle.mm */,
46F26CD610F623BA00ECCA39 /* EAGLView.h */,
46F26CD710F623BA00ECCA39 /* EAGLView.mm */,
1D3623240D0F684500981E51 /* MapsAppDelegate.h */,
@@ -2609,7 +2604,6 @@
FA4135ED120A263C0062D5B4 /* SettingsManager.mm in Sources */,
EE7F29811219ECA300EB67A9 /* RenderBuffer.mm in Sources */,
EE7F29821219ECA300EB67A9 /* RenderContext.mm in Sources */,
- EE7F29831219ECA300EB67A9 /* WindowHandle.mm in Sources */,
FAF37EFF126DCE6F005EA154 /* IPhoneDownload.mm in Sources */,
FAF37F00126DCE6F005EA154 /* IPhoneDownloadManager.mm in Sources */,
FAFCB63613366E78001A5C59 /* WebViewController.mm in Sources */,