small fixes

git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@74 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
albertzeyer
2009-07-21 22:45:00 +00:00
parent 917af3627a
commit 33ea8ab2ad
4 changed files with 1531 additions and 1520 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -5,6 +5,7 @@
* Author: gerstrong
*/
#include "COpenGL.h"
#include "CVideoDriver.h"
#include "../CLogFile.h"
#define GAME_STD_WIDTH 320
@@ -115,7 +116,7 @@ void COpenGL::render(void)
//Clear the screen
glClear(GL_COLOR_BUFFER_BIT); // Clear The Screen
SDL_LockSurface(m_blitsurface);
LockSurface(m_blitsurface);
if(m_ScaleX == 2) //Scale 2x
{
@@ -157,7 +158,7 @@ void COpenGL::render(void)
glVertex3f (0.0, 1.0, 0.0);
glEnd();
SDL_UnlockSurface(m_blitsurface);
UnlockSurface(m_blitsurface);
// Reset (Position?)
glLoadIdentity();

View File

@@ -427,11 +427,11 @@ void CVideoDriver::update_screen(void)
mp_OpenGL->render();
SDL_LockSurface(FGLayerSurface);
LockSurface(FGLayerSurface);
// Flush the layers
memset(FGLayerSurface->pixels,SDL_MapRGB(FGLayerSurface->format, 0, 0, 0),
GAME_STD_WIDTH*GAME_STD_HEIGHT*FGLayerSurface->format->BytesPerPixel);
SDL_UnlockSurface(FGLayerSurface);
UnlockSurface(FGLayerSurface);
}
else // No OpenGL but Software Rendering
{
@@ -442,8 +442,8 @@ void CVideoDriver::update_screen(void)
// another offscreen buffer, and must now stretchblit it to the screen
if (Zoom == 1 && Width != 320 )
{
SDL_LockSurface(BlitSurface);
SDL_LockSurface(screen);
LockSurface(BlitSurface);
LockSurface(screen);
if(Filtermode == 0)
{
@@ -455,13 +455,13 @@ void CVideoDriver::update_screen(void)
g_pLogFile->textOut(PURPLE,"Try to use a higher zoom factor. Switching to no-filter<br>");
Filtermode = 0;
}
SDL_UnlockSurface(screen);
SDL_UnlockSurface(BlitSurface);
UnlockSurface(screen);
UnlockSurface(BlitSurface);
}
if (Zoom == 2)
{
SDL_LockSurface(BlitSurface);
SDL_LockSurface(screen);
LockSurface(BlitSurface);
LockSurface(screen);
if(Filtermode == 0)
{
@@ -479,13 +479,13 @@ void CVideoDriver::update_screen(void)
Filtermode = 0;
}
SDL_UnlockSurface(screen);
SDL_UnlockSurface(BlitSurface);
UnlockSurface(screen);
UnlockSurface(BlitSurface);
}
else if (Zoom == 3)
{
SDL_LockSurface(BlitSurface);
SDL_LockSurface(screen);
LockSurface(BlitSurface);
LockSurface(screen);
if(Filtermode == 0)
{
@@ -507,13 +507,13 @@ void CVideoDriver::update_screen(void)
g_pLogFile->textOut(PURPLE,"Try to use a higher zoom factor. Switching to no-filter<br>");
Filtermode = 0;
}
SDL_UnlockSurface(screen);
SDL_UnlockSurface(BlitSurface);
UnlockSurface(screen);
UnlockSurface(BlitSurface);
}
else if (Zoom == 4)
{
SDL_LockSurface(BlitSurface);
SDL_LockSurface(screen);
LockSurface(BlitSurface);
LockSurface(screen);
if(Filtermode == 0)
{
@@ -540,18 +540,18 @@ void CVideoDriver::update_screen(void)
g_pLogFile->textOut(PURPLE,"Try to use a higher zoom factor. Switching to no-filter<br>");
Filtermode = 0;
}
SDL_UnlockSurface(screen);
SDL_UnlockSurface(BlitSurface);
UnlockSurface(screen);
UnlockSurface(BlitSurface);
}
SDL_Flip(screen);
//SDL_UpdateRect(screen, screenrect.x, screenrect.y, screenrect.w, screenrect.h);
SDL_LockSurface(FGLayerSurface);
LockSurface(FGLayerSurface);
// Flush the layers
memset(FGLayerSurface->pixels,SDL_MapRGB(FGLayerSurface->format, 0, 0, 0),
GAME_STD_WIDTH*GAME_STD_HEIGHT*FGLayerSurface->format->BytesPerPixel);
SDL_UnlockSurface(FGLayerSurface);
UnlockSurface(FGLayerSurface);
#ifdef USE_OPENGL
}
#endif

View File

@@ -17,6 +17,17 @@
#include <SDL.h>
inline bool LockSurface(SDL_Surface * bmp) {
if (SDL_MUSTLOCK(bmp))
return SDL_LockSurface(bmp) != -1;
return true;
}
inline void UnlockSurface(SDL_Surface * bmp) {
if (SDL_MUSTLOCK(bmp))
SDL_UnlockSurface(bmp);
}
class CVideoDriver : public CSingleton<CVideoDriver>
{
public: