[Scummvm-cvs-logs] scummvm master -> 04f9fc3e180afe47385bc189e9f5f36766d2091b
lordhoto
lordhoto at gmail.com
Thu Feb 23 01:36:47 CET 2012
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
26405be48f IPHONE: Move setFilterModeForTexture to iPhoneView.
174127c1dd IPHONE: Remove some more dead code.
04f9fc3e18 IPHONE: Move projection setup code to its own method.
Commit: 26405be48f1c011a08c51e3bcb1bd0e1a16f14a2
https://github.com/scummvm/scummvm/commit/26405be48f1c011a08c51e3bcb1bd0e1a16f14a2
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-22T16:14:39-08:00
Commit Message:
IPHONE: Move setFilterModeForTexture to iPhoneView.
Changed paths:
backends/platform/iphone/iphone_video.mm
diff --git a/backends/platform/iphone/iphone_video.mm b/backends/platform/iphone/iphone_video.mm
index d12f75a..8ea6c23 100644
--- a/backends/platform/iphone/iphone_video.mm
+++ b/backends/platform/iphone/iphone_video.mm
@@ -242,28 +242,6 @@ static bool getMouseCoords(UIDeviceOrientation orientation, CGPoint point, int *
return true;
}
-static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
- if (!tex)
- return;
-
- glBindTexture(GL_TEXTURE_2D, tex); printOpenGLError();
-
- GLint filter = GL_LINEAR;
-
- switch (mode) {
- case kGraphicsModeLinear:
- filter = GL_LINEAR;
- break;
-
- case kGraphicsModeNone:
- filter = GL_NEAREST;
- break;
- }
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); printOpenGLError();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); printOpenGLError();
-}
-
@implementation iPhoneView
+ (Class)layerClass {
@@ -409,10 +387,32 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
#endif
}
+- (void)setFilterModeForTexture:(GLuint)tex {
+ if (!tex)
+ return;
+
+ glBindTexture(GL_TEXTURE_2D, tex); printOpenGLError();
+
+ GLint filter = GL_LINEAR;
+
+ switch (_videoContext.graphicsMode) {
+ case kGraphicsModeLinear:
+ filter = GL_LINEAR;
+ break;
+
+ case kGraphicsModeNone:
+ filter = GL_NEAREST;
+ break;
+ }
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); printOpenGLError();
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); printOpenGLError();
+}
+
- (void)setGraphicsMode {
- setFilterModeForTexture(_screenTexture, _videoContext.graphicsMode);
- setFilterModeForTexture(_overlayTexture, _videoContext.graphicsMode);
- setFilterModeForTexture(_mouseCursorTexture, _videoContext.graphicsMode);
+ [self setFilterModeForTexture:_screenTexture];
+ [self setFilterModeForTexture:_overlayTexture];
+ [self setFilterModeForTexture:_mouseCursorTexture];
}
- (void)updateSurface {
@@ -439,7 +439,7 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
- (void)updateMouseCursor {
if (_mouseCursorTexture == 0) {
glGenTextures(1, &_mouseCursorTexture); printOpenGLError();
- setFilterModeForTexture(_mouseCursorTexture, _videoContext.graphicsMode);
+ [self setFilterModeForTexture:_mouseCursorTexture];
}
glBindTexture(GL_TEXTURE_2D, _mouseCursorTexture); printOpenGLError();
@@ -595,14 +595,14 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
}
glGenTextures(1, &_screenTexture); printOpenGLError();
- setFilterModeForTexture(_screenTexture, _videoContext.graphicsMode);
+ [self setFilterModeForTexture:_screenTexture];
if (_overlayTexture > 0) {
glDeleteTextures(1, &_overlayTexture); printOpenGLError();
}
glGenTextures(1, &_overlayTexture); printOpenGLError();
- setFilterModeForTexture(_overlayTexture, _videoContext.graphicsMode);
+ [self setFilterModeForTexture:_overlayTexture];
free(_gameScreenTextureBuffer);
int textureSize = _gameScreenTextureWidth * _gameScreenTextureHeight * 2;
Commit: 174127c1ddd1dcd1cbdf74e61e8e48e02f6c9e2e
https://github.com/scummvm/scummvm/commit/174127c1ddd1dcd1cbdf74e61e8e48e02f6c9e2e
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-22T16:19:34-08:00
Commit Message:
IPHONE: Remove some more dead code.
Changed paths:
backends/platform/iphone/iphone_video.h
backends/platform/iphone/iphone_video.mm
diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h
index 8315096..733851f 100644
--- a/backends/platform/iphone/iphone_video.h
+++ b/backends/platform/iphone/iphone_video.h
@@ -53,7 +53,6 @@ struct VideoContext {
};
@interface iPhoneView : UIView {
- void *_screenSurface;
NSMutableArray *_events;
SoftKeyboard *_keyboardView;
@@ -77,8 +76,6 @@ struct VideoContext {
- (void)drawRect:(CGRect)frame;
-- (void *)getSurface;
-
- (void)initSurface;
- (void)setViewTransformation;
diff --git a/backends/platform/iphone/iphone_video.mm b/backends/platform/iphone/iphone_video.mm
index 8ea6c23..c993469 100644
--- a/backends/platform/iphone/iphone_video.mm
+++ b/backends/platform/iphone/iphone_video.mm
@@ -368,10 +368,6 @@ static bool getMouseCoords(UIDeviceOrientation orientation, CGPoint point, int *
free(_overlayTexBuffer);
}
-- (void *)getSurface {
- return _screenSurface;
-}
-
- (void)drawRect:(CGRect)frame {
#if 0
if (lastTick == 0) {
Commit: 04f9fc3e180afe47385bc189e9f5f36766d2091b
https://github.com/scummvm/scummvm/commit/04f9fc3e180afe47385bc189e9f5f36766d2091b
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-22T16:27:38-08:00
Commit Message:
IPHONE: Move projection setup code to its own method.
Changed paths:
backends/platform/iphone/iphone_video.mm
diff --git a/backends/platform/iphone/iphone_video.mm b/backends/platform/iphone/iphone_video.mm
index c993469..b6636e6 100644
--- a/backends/platform/iphone/iphone_video.mm
+++ b/backends/platform/iphone/iphone_video.mm
@@ -540,51 +540,55 @@ static bool getMouseCoords(UIDeviceOrientation orientation, CGPoint point, int *
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
}
-- (void)initSurface {
- _gameScreenTextureWidth = getSizeNextPOT(_videoContext.screenWidth);
- _gameScreenTextureHeight = getSizeNextPOT(_videoContext.screenHeight);
-
- _gameScreenTexCoords[2] = _gameScreenTexCoords[6] = _videoContext.screenWidth / (GLfloat)_gameScreenTextureWidth;
- _gameScreenTexCoords[5] = _gameScreenTexCoords[7] = _videoContext.screenHeight / (GLfloat)_gameScreenTextureHeight;
+- (void)setUpOrientation:(UIDeviceOrientation)orientation width:(int *)width height:(int *)height {
+ _orientation = orientation;
- _orientation = [[UIDevice currentDevice] orientation];
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ // We always force the origin (0,0) to be in the upper left corner.
switch (_orientation) {
- case UIDeviceOrientationLandscapeLeft:
case UIDeviceOrientationLandscapeRight:
- case UIDeviceOrientationPortrait:
+ glRotatef( 90, 0, 0, 1); printOpenGLError();
+ glOrthof(0, _renderBufferHeight, _renderBufferWidth, 0, 0, 1); printOpenGLError();
+
+ *width = _renderBufferHeight;
+ *height = _renderBufferWidth;
break;
+ case UIDeviceOrientationLandscapeLeft:
+ glRotatef(-90, 0, 0, 1); printOpenGLError();
+ glOrthof(0, _renderBufferHeight, _renderBufferWidth, 0, 0, 1); printOpenGLError();
+
+ *width = _renderBufferHeight;
+ *height = _renderBufferWidth;
+ break;
+
+ case UIDeviceOrientationPortrait:
default:
+ // We must force the portrait orientation here, since we might not know
+ // the real orientation.
_orientation = UIDeviceOrientationPortrait;
- }
- //printf("Window: (%d, %d), Surface: (%d, %d), Texture(%d, %d)\n", _fullWidth, _fullHeight, _videoContext.screenWidth, _videoContext.screenHeight, _gameScreenTextureWidth, _gameScreenTextureHeight);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
+ glOrthof(0, _renderBufferWidth, _renderBufferHeight, 0, 0, 1); printOpenGLError();
- int screenWidth, screenHeight;
+ *width = _renderBufferWidth;
+ *height = _renderBufferHeight;
+ break;
+ }
+}
- // Set the origin (0,0) depending on the rotation mode.
- if (_orientation == UIDeviceOrientationLandscapeRight) {
- glRotatef( 90, 0, 0, 1); printOpenGLError();
- glOrthof(0, _renderBufferHeight, _renderBufferWidth, 0, 0, 1); printOpenGLError();
+- (void)initSurface {
+ _gameScreenTextureWidth = getSizeNextPOT(_videoContext.screenWidth);
+ _gameScreenTextureHeight = getSizeNextPOT(_videoContext.screenHeight);
- screenWidth = _renderBufferHeight;
- screenHeight = _renderBufferWidth;
- } else if (_orientation == UIDeviceOrientationLandscapeLeft) {
- glRotatef(-90, 0, 0, 1); printOpenGLError();
- glOrthof(0, _renderBufferHeight, _renderBufferWidth, 0, 0, 1); printOpenGLError();
+ _gameScreenTexCoords[2] = _gameScreenTexCoords[6] = _videoContext.screenWidth / (GLfloat)_gameScreenTextureWidth;
+ _gameScreenTexCoords[5] = _gameScreenTexCoords[7] = _videoContext.screenHeight / (GLfloat)_gameScreenTextureHeight;
- screenWidth = _renderBufferHeight;
- screenHeight = _renderBufferWidth;
- } else if (_orientation == UIDeviceOrientationPortrait) {
- glOrthof(0, _renderBufferWidth, _renderBufferHeight, 0, 0, 1); printOpenGLError();
+ int screenWidth, screenHeight;
+ [self setUpOrientation:[[UIDevice currentDevice] orientation] width:&screenWidth height:&screenHeight];
- screenWidth = _renderBufferWidth;
- screenHeight = _renderBufferHeight;
- }
+ //printf("Window: (%d, %d), Surface: (%d, %d), Texture(%d, %d)\n", _fullWidth, _fullHeight, _videoContext.screenWidth, _videoContext.screenHeight, _gameScreenTextureWidth, _gameScreenTextureHeight);
if (_screenTexture > 0) {
glDeleteTextures(1, &_screenTexture); printOpenGLError();
More information about the Scummvm-git-logs
mailing list