changeset 13284:83f0e8f4a217 draft

(svn r17793) -Fix: [OSX] The splash image wasn't displayed if the Quartz video driver was used.
author michi_cc <michi_cc@openttd.org>
date Sat, 17 Oct 2009 22:36:39 +0000
parents c6ec5d3fc1c2
children eb90f715c80f
files src/video/cocoa/cocoa_v.h src/video/cocoa/event.mm src/video/cocoa/fullscreen.mm src/video/cocoa/wnd_quartz.mm src/video/cocoa/wnd_quickdraw.mm
diffstat 5 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/cocoa/cocoa_v.h
+++ b/src/video/cocoa/cocoa_v.h
@@ -47,7 +47,7 @@
 public:
 	virtual ~CocoaSubdriver() {}
 
-	virtual void Draw() = 0;
+	virtual void Draw(bool force_update = false) = 0;
 	virtual void MakeDirty(int left, int top, int width, int height) = 0;
 	virtual void UpdatePalette(uint first_color, uint num_colors) = 0;
 
--- a/src/video/cocoa/event.mm
+++ b/src/video/cocoa/event.mm
@@ -606,7 +606,7 @@
 	_screen.dst_ptr = _cocoa_subdriver->GetPixelBuffer();
 	DisplaySplashImage();
 	QZ_CheckPaletteAnim();
-	_cocoa_subdriver->Draw();
+	_cocoa_subdriver->Draw(true);
 	CSleep(1);
 
 	for (int i = 0; i < 2; i++) GameLoop();
--- a/src/video/cocoa/fullscreen.mm
+++ b/src/video/cocoa/fullscreen.mm
@@ -420,7 +420,7 @@
 		this->RestoreVideoMode();
 	}
 
-	virtual void Draw()
+	virtual void Draw(bool force_update)
 	{
 		const uint8 *src   = (uint8 *)this->pixel_buffer;
 		uint8 *dst         = (uint8 *)this->screen_buffer;
--- a/src/video/cocoa/wnd_quartz.mm
+++ b/src/video/cocoa/wnd_quartz.mm
@@ -129,7 +129,7 @@
 	WindowQuartzSubdriver(int bpp);
 	virtual ~WindowQuartzSubdriver();
 
-	virtual void Draw();
+	virtual void Draw(bool force_update);
 	virtual void MakeDirty(int left, int top, int width, int height);
 	virtual void UpdatePalette(uint first_color, uint num_colors);
 
@@ -552,7 +552,7 @@
 	free(this->pixel_buffer);
 }
 
-void WindowQuartzSubdriver::Draw()
+void WindowQuartzSubdriver::Draw(bool force_update)
 {
 	/* Check if we need to do anything */
 	if (this->num_dirty_rects == 0 || [ this->window isMiniaturized ]) return;
@@ -583,8 +583,10 @@
 		dirtyrect.size.width = this->dirty_rects[i].right - this->dirty_rects[i].left;
 		dirtyrect.size.height = this->dirty_rects[i].bottom - this->dirty_rects[i].top;
 
-		/* drawRect will be automatically called by Mac OS X during next update cycle, and then blitting will occur */
-		[ qzview setNeedsDisplayInRect:dirtyrect ];
+		/* Normally drawRect will be automatically called by Mac OS X during next update cycle,
+		 * and then blitting will occur. If force_update is true, it will be done right now. */
+		[ this->qzview setNeedsDisplayInRect:dirtyrect ];
+		if (force_update) [ this->qzview displayIfNeeded ];
 	}
 
 	//DrawResizeIcon();
--- a/src/video/cocoa/wnd_quickdraw.mm
+++ b/src/video/cocoa/wnd_quickdraw.mm
@@ -144,7 +144,7 @@
 	WindowQuickdrawSubdriver(int bpp);
 	virtual ~WindowQuickdrawSubdriver();
 
-	virtual void Draw();
+	virtual void Draw(bool force_update);
 	virtual void MakeDirty(int left, int top, int width, int height);
 	virtual void UpdatePalette(uint first_color, uint num_colors);
 
@@ -547,7 +547,7 @@
 	free(this->pixel_buffer);
 }
 
-void WindowQuickdrawSubdriver::Draw()
+void WindowQuickdrawSubdriver::Draw(bool force_update)
 {
 	/* Check if we need to do anything */
 	if (this->num_dirty_rects == 0 || [ this->window isMiniaturized ]) return;