From 55f2a67e955fb69afca28dbca11ba1274400b6f9 Mon Sep 17 00:00:00 2001 From: Roman Kuznetsov Date: Thu, 24 Mar 2016 13:41:53 +0300 Subject: Revert "[ios] Improved safety of present calls" --- iphone/Maps/Classes/EAGLView.h | 1 - iphone/Maps/Classes/EAGLView.mm | 5 ----- iphone/Maps/Classes/MapViewController.h | 2 -- iphone/Maps/Classes/MapViewController.mm | 10 ---------- iphone/Maps/Classes/MapsAppDelegate.mm | 2 -- iphone/Maps/Platform/opengl/iosOGLContext.h | 6 ------ iphone/Maps/Platform/opengl/iosOGLContext.mm | 12 ++---------- iphone/Maps/Platform/opengl/iosOGLContextFactory.h | 2 -- iphone/Maps/Platform/opengl/iosOGLContextFactory.mm | 6 ------ 9 files changed, 2 insertions(+), 44 deletions(-) (limited to 'iphone/Maps') diff --git a/iphone/Maps/Classes/EAGLView.h b/iphone/Maps/Classes/EAGLView.h index dffcb6f167..600ce61de8 100644 --- a/iphone/Maps/Classes/EAGLView.h +++ b/iphone/Maps/Classes/EAGLView.h @@ -28,6 +28,5 @@ namespace dp - (CGPoint)viewPoint2GlobalPoint:(CGPoint)pt; - (CGPoint)globalPoint2ViewPoint:(CGPoint)pt; - (void)initialize; -- (void)setPresentAvailable:(BOOL)available; @end diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm index eb9dc73d01..6b8c1bcbcf 100644 --- a/iphone/Maps/Classes/EAGLView.mm +++ b/iphone/Maps/Classes/EAGLView.mm @@ -173,9 +173,4 @@ double getExactDPI(double contentScaleFactor) return CGPointMake(ptP.x / scaleFactor, ptP.y / scaleFactor); } -- (void)setPresentAvailable:(BOOL)available -{ - static_cast(m_factory.get())->setPresentAvailable(available); -} - @end diff --git a/iphone/Maps/Classes/MapViewController.h b/iphone/Maps/Classes/MapViewController.h index 4cd5ba4d1e..c5c694c871 100644 --- a/iphone/Maps/Classes/MapViewController.h +++ b/iphone/Maps/Classes/MapViewController.h @@ -21,8 +21,6 @@ namespace search { struct AddressInfo; } - (void)onTerminate; - (void)onEnterForeground; - (void)onEnterBackground; -- (void)onGetFocus; -- (void)onLoseFocus; - (void)setMapStyle:(MapStyle)mapStyle; diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index d7dc0e9337..dc98413c7f 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -362,16 +362,6 @@ NSString * const kReportSegue = @"Map2ReportSegue"; GetFramework().EnterForeground(); } -- (void)onGetFocus -{ - [(EAGLView *)self.view setPresentAvailable:YES]; -} - -- (void)onLoseFocus -{ - [(EAGLView *)self.view setPresentAvailable:NO]; -} - - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index 28f47d394f..e674b2e6b6 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -559,7 +559,6 @@ using namespace osm_auth_ios; - (void)applicationWillResignActive:(UIApplication *)application { - [self.mapViewController onLoseFocus]; [self.mapViewController.appWallAd close]; [RouteState save]; GetFramework().SetRenderingEnabled(false); @@ -586,7 +585,6 @@ using namespace osm_auth_ios; { if (application.applicationState == UIApplicationStateBackground) return; - [self.mapViewController onGetFocus]; [self handleURLs]; [self restoreRouteState]; [[Statistics instance] applicationDidBecomeActive]; diff --git a/iphone/Maps/Platform/opengl/iosOGLContext.h b/iphone/Maps/Platform/opengl/iosOGLContext.h index 41127e68df..24f905f551 100644 --- a/iphone/Maps/Platform/opengl/iosOGLContext.h +++ b/iphone/Maps/Platform/opengl/iosOGLContext.h @@ -6,8 +6,6 @@ #import #import -#include "std/atomic.hpp" - class iosOGLContext : public dp::OGLContext { public: @@ -18,8 +16,6 @@ public: virtual void present(); virtual void setDefaultFramebuffer(); virtual void resize(int w, int h); - - void setPresentAvailable(bool available); private: CAEAGLLayer * m_layer; @@ -36,6 +32,4 @@ private: GLuint m_depthBufferId; GLuint m_frameBufferId; //@} buffers - - atomic m_presentAvailable; }; \ No newline at end of file diff --git a/iphone/Maps/Platform/opengl/iosOGLContext.mm b/iphone/Maps/Platform/opengl/iosOGLContext.mm index e881c67426..0ec7e221de 100644 --- a/iphone/Maps/Platform/opengl/iosOGLContext.mm +++ b/iphone/Maps/Platform/opengl/iosOGLContext.mm @@ -12,7 +12,6 @@ iosOGLContext::iosOGLContext(CAEAGLLayer * layer, iosOGLContext * contextToShare , m_renderBufferId(0) , m_depthBufferId(0) , m_frameBufferId(0) - , m_presentAvailable(true) { if (contextToShareWith != NULL) { @@ -37,23 +36,16 @@ void iosOGLContext::makeCurrent() initBuffers(); } -void iosOGLContext::setPresentAvailable(bool available) -{ - m_presentAvailable = available; -} - void iosOGLContext::present() { ASSERT(m_nativeContext != NULL, ()); ASSERT(m_renderBufferId, ()); - + GLenum const discards[] = { GL_DEPTH_ATTACHMENT, GL_COLOR_ATTACHMENT0 }; GLCHECK(glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards)); glBindRenderbuffer(GL_RENDERBUFFER, m_renderBufferId); - - if (m_presentAvailable) - [m_nativeContext presentRenderbuffer: GL_RENDERBUFFER]; + [m_nativeContext presentRenderbuffer: GL_RENDERBUFFER]; GLCHECK(glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards + 1)); } diff --git a/iphone/Maps/Platform/opengl/iosOGLContextFactory.h b/iphone/Maps/Platform/opengl/iosOGLContextFactory.h index bcec895726..928454ffcb 100644 --- a/iphone/Maps/Platform/opengl/iosOGLContextFactory.h +++ b/iphone/Maps/Platform/opengl/iosOGLContextFactory.h @@ -14,8 +14,6 @@ public: virtual bool isDrawContextCreated() const; virtual bool isUploadContextCreated() const; - - void setPresentAvailable(bool available); private: CAEAGLLayer * m_layer; diff --git a/iphone/Maps/Platform/opengl/iosOGLContextFactory.mm b/iphone/Maps/Platform/opengl/iosOGLContextFactory.mm index 60751ff34c..501f3c3ccf 100644 --- a/iphone/Maps/Platform/opengl/iosOGLContextFactory.mm +++ b/iphone/Maps/Platform/opengl/iosOGLContextFactory.mm @@ -35,9 +35,3 @@ bool iosOGLContextFactory::isUploadContextCreated() const { return m_uploadContext != nullptr; } - -void iosOGLContextFactory::setPresentAvailable(bool available) -{ - if (m_drawContext != nullptr) - m_drawContext->setPresentAvailable(available); -} -- cgit v1.2.3