[Scummvm-cvs-logs] scummvm master -> a291679445a538ed8143a8f26952c38d6e9d3dd4

lordhoto lordhoto at gmail.com
Mon Feb 20 15:38:52 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:
76be031ed4 IPHONE: Remove some unused variables.
46e622c0fe IPHONE: Slight cleanup.
a291679445 IPHONE: Slight game screen texture related variable renaming.


Commit: 76be031ed4b000ec96d7a650c21c2158ecea2b4b
    https://github.com/scummvm/scummvm/commit/76be031ed4b000ec96d7a650c21c2158ecea2b4b
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-20T06:37:23-08:00

Commit Message:
IPHONE: Remove some unused variables.

Changed paths:
    backends/platform/iphone/iphone_video.h
    backends/platform/iphone/iphone_video.m



diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h
index f484ebb..5b4e0fd 100644
--- a/backends/platform/iphone/iphone_video.h
+++ b/backends/platform/iphone/iphone_video.h
@@ -37,7 +37,6 @@
 	void *_screenSurface;
 	NSMutableArray *_events;
 	SoftKeyboard *_keyboardView;
-	CALayer *_screenLayer;
 
 	int _widthOffset;
 	int _heightOffset;
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index 4163442..06ed7e8 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -42,7 +42,6 @@ static int _overlayWidth = 0;
 static int _overlayHeight = 0;
 static float _overlayPortraitRatio = 1.0f;
 
-NSLock *_lock = nil;
 static int _needsScreenUpdate = 0;
 static int _overlayIsEnabled = 0;
 
@@ -247,11 +246,9 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
 
 	_fullWidth = frame.size.width;
 	_fullHeight = frame.size.height;
-	_screenLayer = nil;
 
 	sharedInstance = self;
 
-	_lock = [NSLock new];
 	_keyboardView = nil;
 	_context = nil;
 	_screenTexture = 0;


Commit: 46e622c0fe080abd4627971135cea31a492edcb4
    https://github.com/scummvm/scummvm/commit/46e622c0fe080abd4627971135cea31a492edcb4
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-20T06:37:24-08:00

Commit Message:
IPHONE: Slight cleanup.

Changed paths:
    backends/platform/iphone/iphone_video.m



diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index 06ed7e8..da10b41 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -57,18 +57,20 @@ static int _mouseX = 0;
 static int _mouseY = 0;
 static int _mouseCursorEnabled = 0;
 
-// static long lastTick = 0;
-// static int frames = 0;
+#if 0
+static long lastTick = 0;
+static int frames = 0;
+#endif
 
 #define printOpenGLError() printOglError(__FILE__, __LINE__)
 
 int printOglError(const char *file, int line) {
-	int     retCode = 0;
+	int retCode = 0;
 
 	// returns 1 if an OpenGL error occurred, 0 otherwise.
 	GLenum glErr = glGetError();
 	while (glErr != GL_NO_ERROR) {
-		fprintf(stderr, "glError: %u (%s: %d)\n", glErr, file, line );
+		fprintf(stderr, "glError: %u (%s: %d)\n", glErr, file, line);
 		retCode = 1;
 		glErr = glGetError();
 	}
@@ -118,12 +120,6 @@ bool iPhone_isHighResDevice() {
 void iPhone_updateScreen(int mouseX, int mouseY) {
 	//printf("Mouse: (%i, %i)\n", mouseX, mouseY);
 
-	//_mouseX = _overlayHeight - (float)mouseX / _width * _overlayHeight;
-	//_mouseY = (float)mouseY / _height * _overlayWidth;
-
-	//_mouseX = _overlayHeight - mouseX;
-	//_mouseY = mouseY;
-
 	_mouseX = mouseX;
 	_mouseY = mouseY;
 
@@ -136,14 +132,14 @@ void iPhone_updateScreen(int mouseX, int mouseY) {
 void iPhone_updateScreenRect(unsigned short *screen, int x1, int y1, int x2, int y2) {
 	int y;
 	for (y = y1; y < y2; ++y)
-		memcpy(&_textureBuffer[(y * _textureWidth + x1 )* 2], &screen[y * _width + x1], (x2 - x1) * 2);
+		memcpy(&_textureBuffer[(y * _textureWidth + x1) * 2], &screen[y * _width + x1], (x2 - x1) * 2);
 }
 
 void iPhone_updateOverlayRect(unsigned short *screen, int x1, int y1, int x2, int y2) {
 	int y;
 	//printf("Overlaywidth: %u, fullwidth %u\n", _overlayWidth, _fullWidth);
 	for (y = y1; y < y2; ++y)
-		memcpy(&_overlayTexBuffer[(y * _overlayTexWidth + x1 )* 2], &screen[y * _overlayWidth + x1], (x2 - x1) * 2);
+		memcpy(&_overlayTexBuffer[(y * _overlayTexWidth + x1) * 2], &screen[y * _overlayWidth + x1], (x2 - x1) * 2);
 }
 
 void iPhone_initSurface(int width, int height) {
@@ -258,16 +254,14 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
 	return self;
 }
 
--(void)dealloc {
+- (void)dealloc {
 	[super dealloc];
 
 	if (_keyboardView != nil) {
 		[_keyboardView dealloc];
 	}
 
-	if (_screenTexture)
-		free(_textureBuffer);
-
+	free(_textureBuffer);
 	free(_overlayTexBuffer);
 }
 
@@ -276,16 +270,18 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
 }
 
 - (void)drawRect:(CGRect)frame {
-	// if (lastTick == 0) {
-	//	lastTick = time(0);
-	// }
-	//
-	// frames++;
-	// if (time(0) > lastTick) {
-	//	lastTick = time(0);
-	//	printf("FPS: %i\n", frames);
-	//	frames = 0;
-	// }
+#if 0
+	if (lastTick == 0) {
+		lastTick = time(0);
+	}
+
+	frames++;
+	if (time(0) > lastTick) {
+		lastTick = time(0);
+		printf("FPS: %i\n", frames);
+		frames = 0;
+	}
+#endif
 }
 
 - (void)setGraphicsMode {
@@ -315,7 +311,7 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
 
 }
 
--(void)updateMouseCursor {
+- (void)updateMouseCursor {
 	if (_mouseCursorTexture == 0) {
 		glGenTextures(1, &_mouseCursorTexture); printOpenGLError();
 		setFilterModeForTexture(_mouseCursorTexture, _graphicsMode);
@@ -456,7 +452,7 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
 
 		eaglLayer.opaque = YES;
 		eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
-										[NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGB565, kEAGLDrawablePropertyColorFormat, nil];
+		                                [NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGB565, kEAGLDrawablePropertyColorFormat, nil];
 
 		_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
 		if (!_context || [EAGLContext setCurrentContext:_context]) {


Commit: a291679445a538ed8143a8f26952c38d6e9d3dd4
    https://github.com/scummvm/scummvm/commit/a291679445a538ed8143a8f26952c38d6e9d3dd4
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-02-20T06:37:24-08:00

Commit Message:
IPHONE: Slight game screen texture related variable renaming.

Changed paths:
    backends/platform/iphone/iphone_video.m



diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index da10b41..5d57b6d 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -31,9 +31,9 @@ static int _fullWidth;
 static int _fullHeight;
 static CGRect _screenRect;
 
-static char *_textureBuffer = 0;
-static int _textureWidth = 0;
-static int _textureHeight = 0;
+static char *_gameScreenTextureBuffer = 0;
+static int _gameScreenTextureWidth = 0;
+static int _gameScreenTextureHeight = 0;
 
 static char *_overlayTexBuffer = 0;
 static int _overlayTexWidth = 0;
@@ -132,7 +132,7 @@ void iPhone_updateScreen(int mouseX, int mouseY) {
 void iPhone_updateScreenRect(unsigned short *screen, int x1, int y1, int x2, int y2) {
 	int y;
 	for (y = y1; y < y2; ++y)
-		memcpy(&_textureBuffer[(y * _textureWidth + x1) * 2], &screen[y * _width + x1], (x2 - x1) * 2);
+		memcpy(&_gameScreenTextureBuffer[(y * _gameScreenTextureWidth + x1) * 2], &screen[y * _width + x1], (x2 - x1) * 2);
 }
 
 void iPhone_updateOverlayRect(unsigned short *screen, int x1, int y1, int x2, int y2) {
@@ -261,7 +261,7 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
 		[_keyboardView dealloc];
 	}
 
-	free(_textureBuffer);
+	free(_gameScreenTextureBuffer);
 	free(_overlayTexBuffer);
 }
 
@@ -332,8 +332,8 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
 		_visibleWidth - _heightOffset,  _visibleHeight - _widthOffset
 	};
 
-	float texWidth = _width / (float)_textureWidth;
-	float texHeight = _height / (float)_textureHeight;
+	float texWidth = _width / (float)_gameScreenTextureWidth;
+	float texHeight = _height / (float)_gameScreenTextureHeight;
 
 	const GLfloat texCoords[] = {
 		texWidth, 0.0f,
@@ -350,7 +350,7 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
 	// Unfortunately we have to update the whole texture every frame, since glTexSubImage2D is actually slower in all cases
 	// due to the iPhone internals having to convert the whole texture back from its internal format when used.
 	// In the future we could use several tiled textures instead.
-	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _textureWidth, _textureHeight, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _textureBuffer); printOpenGLError();
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _gameScreenTextureWidth, _gameScreenTextureHeight, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _gameScreenTextureBuffer); printOpenGLError();
 	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
 }
 
@@ -439,12 +439,12 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
 }
 
 - (void)initSurface {
-	_textureWidth = getSizeNextPOT(_width);
-	_textureHeight = getSizeNextPOT(_height);
+	_gameScreenTextureWidth = getSizeNextPOT(_width);
+	_gameScreenTextureHeight = getSizeNextPOT(_height);
 
 	UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
 
-	//printf("Window: (%d, %d), Surface: (%d, %d), Texture(%d, %d)\n", _fullWidth, _fullHeight, _width, _height, _textureWidth, _textureHeight);
+	//printf("Window: (%d, %d), Surface: (%d, %d), Texture(%d, %d)\n", _fullWidth, _fullHeight, _width, _height, _gameScreenTextureWidth, _gameScreenTextureHeight);
 
 	if (_context == nil) {
 		orientation = UIDeviceOrientationLandscapeRight;
@@ -520,13 +520,10 @@ static void setFilterModeForTexture(GLuint tex, GraphicsModes mode) {
 	glGenTextures(1, &_overlayTexture); printOpenGLError();
 	setFilterModeForTexture(_overlayTexture, _graphicsMode);
 
-	if (_textureBuffer) {
-		free(_textureBuffer);
-	}
-
-	int textureSize = _textureWidth * _textureHeight * 2;
-	_textureBuffer = (char *)malloc(textureSize);
-	memset(_textureBuffer, 0, textureSize);
+	free(_gameScreenTextureBuffer);
+	int textureSize = _gameScreenTextureWidth * _gameScreenTextureHeight * 2;
+	_gameScreenTextureBuffer = (char *)malloc(textureSize);
+	memset(_gameScreenTextureBuffer, 0, textureSize);
 
 	glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
 






More information about the Scummvm-git-logs mailing list