fixed white-screen-after-download-dialog bug.

This commit is contained in:
rachytski 2011-03-12 00:10:43 +02:00 committed by Alex Zolotarev
parent 41de69b527
commit aa0b4b4f82
8 changed files with 89 additions and 54 deletions

View file

@ -36,60 +36,60 @@
{
if ((self = [super initWithCoder:coder]))
{
// Setup Layer Properties
CAEAGLLayer * eaglLayer = (CAEAGLLayer *)self.layer;
// Setup Layer Properties
CAEAGLLayer * eaglLayer = (CAEAGLLayer *)self.layer;
eaglLayer.opaque = YES;
eaglLayer.opaque = YES;
/// ColorFormat : RGB565
/// Backbuffer : YES, (to prevent from loosing content when mixing with ordinary layers).
eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES],
kEAGLDrawablePropertyRetainedBacking,
kEAGLColorFormatRGB565,
kEAGLDrawablePropertyColorFormat,
nil];
/// ColorFormat : RGB565
/// Backbuffer : YES, (to prevent from loosing content when mixing with ordinary layers).
eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO],
kEAGLDrawablePropertyRetainedBacking,
kEAGLColorFormatRGB565,
kEAGLDrawablePropertyColorFormat,
nil];
int etalonW = 320;
int scrW = etalonW;
int etalonW = 320;
int scrW = etalonW;
UIDevice * device = [UIDevice currentDevice];
UIDevice * device = [UIDevice currentDevice];
float ver = [device.systemVersion floatValue];
NSLog(@"%@", device.systemVersion);
/// rounding problems
if (ver >= 3.199)
{
UIScreen * mainScr = [UIScreen mainScreen];
scrW = mainScr.currentMode.size.width;
if (scrW == 640)
self.contentScaleFactor = 2.0;
}
float ver = [device.systemVersion floatValue];
NSLog(@"%@", device.systemVersion);
/// rounding problems
if (ver >= 3.199)
{
UIScreen * mainScr = [UIScreen mainScreen];
scrW = mainScr.currentMode.size.width;
if (scrW == 640)
self.contentScaleFactor = 2.0;
}
renderContext = shared_ptr<iphone::RenderContext>(new iphone::RenderContext());
renderContext = shared_ptr<iphone::RenderContext>(new iphone::RenderContext());
if (!renderContext.get())
{
[self release];
return nil;
}
if (!renderContext.get())
{
[self release];
return nil;
}
renderContext->makeCurrent();
frameBuffer = shared_ptr<yg::gl::FrameBuffer>(new yg::gl::FrameBuffer());
renderContext->makeCurrent();
frameBuffer = shared_ptr<yg::gl::FrameBuffer>(new yg::gl::FrameBuffer());
int bigVBSize = pow(2, ceil(log2(15000 * sizeof(yg::gl::Vertex))));
int bigIBSize = pow(2, ceil(log2(30000 * sizeof(unsigned short))));
int bigVBSize = pow(2, ceil(log2(15000 * sizeof(yg::gl::Vertex))));
int bigIBSize = pow(2, ceil(log2(30000 * sizeof(unsigned short))));
int smallVBSize = pow(2, ceil(log2(1500 * sizeof(yg::gl::Vertex))));
int smallIBSize = pow(2, ceil(log2(3000 * sizeof(unsigned short))));
int smallVBSize = pow(2, ceil(log2(1500 * sizeof(yg::gl::Vertex))));
int smallIBSize = pow(2, ceil(log2(3000 * sizeof(unsigned short))));
int blitVBSize = pow(2, ceil(log2(10 * sizeof(yg::gl::AuxVertex))));
int blitIBSize = pow(2, ceil(log2(10 * sizeof(unsigned short))));
int blitVBSize = pow(2, ceil(log2(10 * sizeof(yg::gl::AuxVertex))));
int blitIBSize = pow(2, ceil(log2(10 * sizeof(unsigned short))));
resourceManager = shared_ptr<yg::ResourceManager>(new yg::ResourceManager(
resourceManager = shared_ptr<yg::ResourceManager>(new yg::ResourceManager(
bigVBSize, bigIBSize, 20,
smallVBSize, smallIBSize, 30,
blitVBSize, blitIBSize, 20,
blitVBSize, blitIBSize, 20,
512, 256, 10,
GetPlatform().ReadPathForFile("unicode_blocks.txt").c_str(),
GetPlatform().ReadPathForFile("fonts_whitelist.txt").c_str(),

View file

@ -35,6 +35,7 @@ typedef FrameWork<model::FeaturesFetcher, Navigator, iphone::WindowHandle> frame
- (void) OnSettingsClicked: (id)sender
{
m_framework->SetUpdatesEnabled(false);
[SettingsManager Show:self WithStorage:m_storage];
}
@ -65,18 +66,18 @@ typedef FrameWork<model::FeaturesFetcher, Navigator, iphone::WindowHandle> frame
m_locationController = [[UserLocationController alloc] initWithDelegate:self];
m_CurrentAction = NOTHING;
m_isDirtyPosition = false;
m_isDirtyPosition = false;
// initialize with currently active screen orientation
[self didRotateFromInterfaceOrientation: self.interfaceOrientation];
[self didRotateFromInterfaceOrientation: self.interfaceOrientation];
m_framework->initializeGL([(EAGLView*)self.view renderContext], resourceManager);
// to perform a proper resize
[(EAGLView*)self.view layoutSubviews];
// restore previous screen position
if (!m_framework->LoadState())
// restore previous screen position
if (!m_framework->LoadState())
m_framework->ShowAll();
}
@ -307,8 +308,8 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context)
{
if (m_framework)
{
NSLog(@"invalidate");
m_framework->Invalidate();
if (!m_framework->SetUpdatesEnabled(true))
m_framework->Invalidate();
}
}

View file

@ -16,11 +16,11 @@ namespace iphone
{
class WindowHandle : public ::WindowHandle
{
private:
EAGLView * m_view;
private:
EAGLView * m_view;
public:
WindowHandle(EAGLView * view);
WindowHandle(EAGLView * view);
void invalidate();
void invalidateImpl();
};
}

View file

@ -18,7 +18,7 @@ namespace iphone
m_view = view;
}
void WindowHandle::invalidate()
void WindowHandle::invalidateImpl()
{
[m_view drawViewOnMainThread];
}

View file

@ -630,7 +630,7 @@
PROVISIONING_PROFILE = "";
SDKROOT = iphoneos;
STRIP_INSTALLED_PRODUCT = NO;
VALID_ARCHS = "armv7 armv6";
VALID_ARCHS = "armv6 armv7";
VERSIONING_SYSTEM = "apple-generic";
};
name = "Device Debug";

View file

@ -288,6 +288,11 @@ public:
UpdateNow();
}
bool SetUpdatesEnabled(bool doEnable)
{
return m_windowHandle->setUpdatesEnabled(doEnable);
}
/// enabling/disabling AddRedrawCommand
void SetRedrawEnabled(bool isRedrawEnabled)
{

View file

@ -3,6 +3,7 @@
#include "../std/shared_ptr.hpp"
#include "events.hpp"
#include "drawer_yg.hpp"
#include "../base/logging.hpp"
namespace yg
{
@ -19,8 +20,14 @@ private:
shared_ptr<DrawerYG> m_drawer;
shared_ptr<yg::gl::RenderContext> m_renderContext;
bool m_hasPendingUpdates;
bool m_isUpdatesEnabled;
public:
WindowHandle() : m_hasPendingUpdates(false), m_isUpdatesEnabled(true)
{}
shared_ptr<DrawerYG> const & drawer()
{
return m_drawer;
@ -41,5 +48,26 @@ public:
m_drawer = drawer;
}
virtual void invalidate() = 0;
bool setUpdatesEnabled(bool doEnable)
{
bool res = false;
if ((!m_isUpdatesEnabled) && (doEnable) && (m_hasPendingUpdates))
{
invalidateImpl();
m_hasPendingUpdates = false;
res = true;
}
m_isUpdatesEnabled = doEnable;
return res;
}
void invalidate()
{
if (m_isUpdatesEnabled)
invalidateImpl();
else
m_hasPendingUpdates = true;
}
virtual void invalidateImpl() = 0;
};

View file

@ -13,9 +13,10 @@ namespace qt
QWidget * m_pWnd;
public:
WindowHandle(QWidget * p) : m_pWnd(p) {}
void invalidate()
void invalidateImpl()
{
ASSERT ( m_pWnd != 0, () );
m_pWnd->setUpdatesEnabled(true);