From a2051533f6c5cb66f295fec64cb41a4c4ae30de2 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Thu, 18 Oct 2012 19:52:59 +0300 Subject: [PATCH] [ios] Fixed debug assert and map freezing --- iphone/Maps/Classes/EAGLView.h | 18 ++++++----------- iphone/Maps/Classes/EAGLView.mm | 36 ++++++++++++++++----------------- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/iphone/Maps/Classes/EAGLView.h b/iphone/Maps/Classes/EAGLView.h index 8e70633494..498fcedea1 100644 --- a/iphone/Maps/Classes/EAGLView.h +++ b/iphone/Maps/Classes/EAGLView.h @@ -1,9 +1,6 @@ #import -#import -#import #include "../../std/shared_ptr.hpp" -#include "RenderBuffer.hpp" class VideoTimer; class RenderPolicy; @@ -28,18 +25,15 @@ namespace yg @interface EAGLView : UIView { VideoTimer * videoTimer; - shared_ptr renderContext; - shared_ptr frameBuffer; - shared_ptr renderBuffer; + shared_ptr renderContext; + shared_ptr frameBuffer; + shared_ptr renderBuffer; RenderPolicy * renderPolicy; + // Do not call onSize from layoutSubViews when real size wasn't changed. + // It's possible when we add/remove subviews (bookmark balloons) and it hangs the map without this check + CGRect lastViewSize; } - (void) initRenderPolicy; -@property (nonatomic, assign) VideoTimer * videoTimer; -@property (nonatomic, assign) shared_ptr renderContext; -@property (nonatomic, assign) shared_ptr renderBuffer; -@property (nonatomic, assign) shared_ptr frameBuffer; -@property (nonatomic, assign) RenderPolicy * renderPolicy; - @end diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm index 1eefd1ae96..b8684ff6e8 100644 --- a/iphone/Maps/Classes/EAGLView.mm +++ b/iphone/Maps/Classes/EAGLView.mm @@ -3,25 +3,22 @@ #import "EAGLView.h" -#include "../../yg/screen.hpp" -#include "../../yg/texture.hpp" -#include "../../yg/resource_manager.hpp" -#include "../../yg/internal/opengl.hpp" -#include "../../yg/skin.hpp" -#include "../../map/render_policy.hpp" -#include "../../platform/platform.hpp" -#include "../../platform/video_timer.hpp" #include "RenderBuffer.hpp" #include "RenderContext.hpp" #include "Framework.h" -@implementation EAGLView +#include "../../yg/resource_manager.hpp" +#include "../../yg/internal/opengl.hpp" +#include "../../yg/data_formats.hpp" -@synthesize videoTimer; -@synthesize frameBuffer; -@synthesize renderContext; -@synthesize renderBuffer; -@synthesize renderPolicy; +#include "../../map/render_policy.hpp" + +#include "../../platform/platform.hpp" +#include "../../platform/video_timer.hpp" + +#include "../../std/bind.hpp" + +@implementation EAGLView // You must implement this method + (Class)layerClass @@ -160,15 +157,18 @@ - (void)layoutSubviews { - CGFloat const scale = self.contentScaleFactor; - CGSize const s = self.bounds.size; - [self onSize:s.width * scale withHeight:s.height * scale]; + if (!CGRectEqualToRect(lastViewSize, self.frame)) + { + lastViewSize = self.frame; + CGFloat const scale = self.contentScaleFactor; + CGSize const s = self.bounds.size; + [self onSize:s.width * scale withHeight:s.height * scale]; + } } - (void)dealloc { delete videoTimer; - // m_framework->SetRenderPolicy(0); [EAGLContext setCurrentContext:nil]; [super dealloc]; }