From 9d1a9977c3e76523a3ba1ce745ded00401a63fba Mon Sep 17 00:00:00 2001 From: stephena Date: Sun, 15 Jan 2006 22:43:21 +0000 Subject: [PATCH] Some fixes for the OSX port. Mark, do these work?? git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/common/FrameBufferGL.cxx | 11 +++++++---- stella/src/common/FrameBufferSoft.cxx | 23 +++++++++++++++++++---- stella/src/common/FrameBufferSoft.hxx | 6 ++++-- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/stella/src/common/FrameBufferGL.cxx b/stella/src/common/FrameBufferGL.cxx index fda3b3a2e..a60381f88 100644 --- a/stella/src/common/FrameBufferGL.cxx +++ b/stella/src/common/FrameBufferGL.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: FrameBufferGL.cxx,v 1.53 2006-01-15 20:46:19 stephena Exp $ +// $Id: FrameBufferGL.cxx,v 1.54 2006-01-15 22:43:21 stephena Exp $ //============================================================================ #ifdef DISPLAY_OPENGL @@ -564,9 +564,12 @@ void FrameBufferGL::enablePhosphor(bool enable) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void FrameBufferGL::cls() { - p_glClear(GL_COLOR_BUFFER_BIT); - SDL_GL_SwapBuffers(); - p_glClear(GL_COLOR_BUFFER_BIT); + if(myFuncsLoaded) + { + p_glClear(GL_COLOR_BUFFER_BIT); + SDL_GL_SwapBuffers(); + p_glClear(GL_COLOR_BUFFER_BIT); + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/common/FrameBufferSoft.cxx b/stella/src/common/FrameBufferSoft.cxx index 657c8fc36..6003a7d52 100644 --- a/stella/src/common/FrameBufferSoft.cxx +++ b/stella/src/common/FrameBufferSoft.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: FrameBufferSoft.cxx,v 1.43 2006-01-15 16:31:01 stephena Exp $ +// $Id: FrameBufferSoft.cxx,v 1.44 2006-01-15 22:43:21 stephena Exp $ //============================================================================ #include @@ -95,6 +95,18 @@ bool FrameBufferSoft::createScreen() cerr << "ERROR: Unable to open SDL window: " << SDL_GetError() << endl; return false; } + switch(myScreen->format->BitsPerPixel) + { + case 16: + myPitch = myScreen->pitch/2; + break; + case 24: + myPitch = myScreen->pitch/3; + break; + case 32: + myPitch = myScreen->pitch/4; + break; + } myOSystem->eventHandler().refreshDisplay(); return true; @@ -289,7 +301,7 @@ void FrameBufferSoft::drawMediaSource() buffer[pos++] = (uInt16) myAvgPalette[v][w]; } } - screenofsY += myScreen->w; + screenofsY += myPitch; } bufofsY += width; } @@ -330,7 +342,7 @@ void FrameBufferSoft::drawMediaSource() buffer[pos++] = (uInt16) myAvgPalette[v][w]; } } - screenofsY += myScreen->w; + screenofsY += myPitch; } bufofsY += width; } @@ -370,7 +382,7 @@ void FrameBufferSoft::drawMediaSource() buffer[pos++] = (uInt32) myAvgPalette[v][w]; } } - screenofsY += myScreen->w; + screenofsY += myPitch; } bufofsY += width; } @@ -616,12 +628,15 @@ void FrameBufferSoft::enablePhosphor(bool enable) switch(myScreen->format->BitsPerPixel) { case 16: + myPitch = myScreen->pitch/2; myRenderType = kPhosphor_16; break; case 24: + myPitch = myScreen->pitch/3; myRenderType = kPhosphor_24; break; case 32: + myPitch = myScreen->pitch/4; myRenderType = kPhosphor_32; break; default: diff --git a/stella/src/common/FrameBufferSoft.hxx b/stella/src/common/FrameBufferSoft.hxx index e1e8bda67..a7196a28b 100644 --- a/stella/src/common/FrameBufferSoft.hxx +++ b/stella/src/common/FrameBufferSoft.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: FrameBufferSoft.hxx,v 1.29 2006-01-15 16:31:01 stephena Exp $ +// $Id: FrameBufferSoft.hxx,v 1.30 2006-01-15 22:43:21 stephena Exp $ //============================================================================ #ifndef FRAMEBUFFER_SOFT_HXX @@ -35,7 +35,7 @@ class RectList; This class implements an SDL software framebuffer. @author Stephen Anthony - @version $Id: FrameBufferSoft.hxx,v 1.29 2006-01-15 16:31:01 stephena Exp $ + @version $Id: FrameBufferSoft.hxx,v 1.30 2006-01-15 22:43:21 stephena Exp $ */ class FrameBufferSoft : public FrameBuffer { @@ -204,6 +204,8 @@ class FrameBufferSoft : public FrameBuffer RectList* myOverlayRectList; private: + int myPitch; + enum RenderType { kSoftZoom, kPhosphor_16,