From 650749d401d25bb2269f6ce975d69047cd0ab6bf Mon Sep 17 00:00:00 2001 From: Oystein Eftevaag Date: Sun, 15 Feb 2009 19:09:59 +0000 Subject: Compatibility fixes for the official iPhone SDK svn-id: r38280 --- backends/platform/iphone/blit.cpp | 51 ++++++++++++++++++++++++++++++++ backends/platform/iphone/iphone_video.h | 24 ++++++++++++--- backends/platform/iphone/iphone_video.m | 11 +++---- backends/platform/iphone/osys_iphone.cpp | 5 +--- backends/platform/iphone/osys_iphone.h | 1 + 5 files changed, 77 insertions(+), 15 deletions(-) create mode 100644 backends/platform/iphone/blit.cpp (limited to 'backends/platform') diff --git a/backends/platform/iphone/blit.cpp b/backends/platform/iphone/blit.cpp new file mode 100644 index 0000000000..b1575dc16a --- /dev/null +++ b/backends/platform/iphone/blit.cpp @@ -0,0 +1,51 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $UR$ + * $Id$ + * + */ + +#include "common/scummsys.h" +#include "blit_arm.h" + +void blitLandscapeScreenRect16bpp(uint16 *dst, uint16 *src, int width, int height, int screenWidth, int screenHeight) +{ + for (int x = width; x > 0; x--) { + for (int y = height; y > 0; y--) { + *(dst++) = *src; + src += screenWidth; + } + dst -= screenHeight + height - 0; + src += 1 - (height - 0) * screenWidth; + } +} + +void blitLandscapeScreenRect8bpp(uint16 *dst, byte *src, int width, int height, uint16 *palette, int screenWidth, int screenHeight) +{ + for (int x = width; x > 0; x--) { + for (int y = height; y > 0; y--) { + *(dst++) = palette[*src]; + src += screenWidth; + } + dst -= screenHeight + height - 0; + src += 1 - (height - 0) * screenWidth; + } +} diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h index ebfeb1ce0b..0ef21007ba 100644 --- a/backends/platform/iphone/iphone_video.h +++ b/backends/platform/iphone/iphone_video.h @@ -28,14 +28,30 @@ #import #import -#import - #import + #import "iphone_keyboard.h" +void *CoreSurfaceBufferGetBaseAddress(void* surface); +int CoreSurfaceBufferLock(void* surface, unsigned int lockType); +int CoreSurfaceBufferUnlock(void* surface); +void* CoreSurfaceBufferCreate(CFDictionaryRef dict); + +extern CFStringRef kCoreSurfaceBufferGlobal; +extern CFStringRef kCoreSurfaceBufferMemoryRegion; +extern CFStringRef kCoreSurfaceBufferPitch; +extern CFStringRef kCoreSurfaceBufferWidth; +extern CFStringRef kCoreSurfaceBufferHeight; +extern CFStringRef kCoreSurfaceBufferPixelFormat; +extern CFStringRef kCoreSurfaceBufferAllocSize; + +struct __GSEvent; +CGPoint GSEventGetLocationInWindow(struct __GSEvent *ev); +unsigned int GSEventDeviceOrientation(struct __GSEvent *ev); + @interface iPhoneView : UIView { - CoreSurfaceBufferRef _screenSurface; + void* _screenSurface; NSMutableArray* _events; NSLock* _lock; SoftKeyboard* _keyboardView; @@ -51,7 +67,7 @@ - (void)drawRect:(CGRect)frame; -- (CoreSurfaceBufferRef)getSurface; +- (void *)getSurface; - (void)initSurface; diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m index 400bb102d2..ab85d2868a 100644 --- a/backends/platform/iphone/iphone_video.m +++ b/backends/platform/iphone/iphone_video.m @@ -27,16 +27,13 @@ #include "iphone_common.h" #import -#import #import -#import #import static iPhoneView *sharedInstance = nil; static int _width = 0; static int _height = 0; static bool _landscape; -static int _orientation = -1; static CGRect _screenRect; // static long lastTick = 0; @@ -126,7 +123,7 @@ bool getLocalMouseCoords(CGPoint *point) { } } -- (CoreSurfaceBufferRef)getSurface { +- (void *)getSurface { return _screenSurface; } @@ -220,9 +217,9 @@ bool getLocalMouseCoords(CGPoint *point) { [screenLayer setOpaque: YES]; if (_screenLayer != nil) { - [[sharedInstance _layer] replaceSublayer: _screenLayer with: screenLayer]; + [[sharedInstance layer] replaceSublayer: _screenLayer with: screenLayer]; } else { - [[sharedInstance _layer] addSublayer: screenLayer]; + [[sharedInstance layer] addSublayer: screenLayer]; } _screenLayer = screenLayer; @@ -396,7 +393,7 @@ bool getLocalMouseCoords(CGPoint *point) { return TRUE; } -- (int)swipe:(int)num withEvent:(GSEvent*)event { +- (int)swipe:(int)num withEvent:(struct __GSEvent *)event { //printf("swipe: %i\n", num); [self addEvent: diff --git a/backends/platform/iphone/osys_iphone.cpp b/backends/platform/iphone/osys_iphone.cpp index f22063e3d5..09507a6914 100644 --- a/backends/platform/iphone/osys_iphone.cpp +++ b/backends/platform/iphone/osys_iphone.cpp @@ -46,9 +46,6 @@ #include "blit_arm.h" #include -#include -#include - const OSystem::GraphicsMode OSystem_IPHONE::s_supportedGraphicsModes[] = { {0, 0, 0} }; @@ -513,7 +510,7 @@ void OSystem_IPHONE::updateHardwareSurfaceForRect(const Common::Rect& updatedRec break; } } - } + } } Graphics::Surface *OSystem_IPHONE::lockScreen() { diff --git a/backends/platform/iphone/osys_iphone.h b/backends/platform/iphone/osys_iphone.h index c61461622c..6ae5ed34d7 100644 --- a/backends/platform/iphone/osys_iphone.h +++ b/backends/platform/iphone/osys_iphone.h @@ -31,6 +31,7 @@ #include "common/events.h" #include "sound/mixer_intern.h" #include "backends/fs/posix/posix-fs-factory.h" +#include "graphics/colormasks.h" #include -- cgit v1.2.3