OK, second pass at FrameBufferGP2X class.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1168 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-12-03 01:13:45 +00:00
parent 8ef6d7032e
commit f48ea59ca6
4 changed files with 157 additions and 163 deletions

View File

@ -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.36 2006-11-04 19:38:24 stephena Exp $
// $Id: FrameBufferSoft.hxx,v 1.37 2006-12-03 01:13:44 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.36 2006-11-04 19:38:24 stephena Exp $
@version $Id: FrameBufferSoft.hxx,v 1.37 2006-12-03 01:13:44 stephena Exp $
*/
class FrameBufferSoft : public FrameBuffer
{
@ -185,7 +185,7 @@ class FrameBufferSoft : public FrameBuffer
@param x X coordinate to translate
@param y Y coordinate to translate
*/
inline virtual void translateCoords(Int32* x, Int32* y);
virtual void translateCoords(Int32* x, Int32* y);
/**
This method adds a dirty rectangle

View File

@ -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: FrameBuffer.cxx,v 1.102 2006-12-02 23:25:54 stephena Exp $
// $Id: FrameBuffer.cxx,v 1.103 2006-12-03 01:13:45 stephena Exp $
//============================================================================
#include <sstream>
@ -64,17 +64,17 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height,
myFrameRate = myOSystem->frameRate();
// Now (re)initialize the SDL video system
// These things only have to be done one per FrameBuffer creation
if(!isAlreadyInitialized)
{
Uint32 initflags = SDL_INIT_VIDEO | SDL_INIT_TIMER;
if(SDL_Init(initflags) < 0)
return;
}
setWindowIcon();
// Erase old contents
cls();
// Set window title and icon
setWindowTitle(title);
setWindowIcon();
// Query the desktop size
// This is really the job of SDL
@ -85,13 +85,13 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height,
// Set fullscreen flag
mySDLFlags = myOSystem->settings().getBool("fullscreen") ? SDL_FULLSCREEN : 0;
// Set window title
setWindowTitle(title);
// Get the aspect ratio for the display if it's been enabled
theAspectRatio = 1.0;
if(useAspect)
setAspectRatio();
if(useAspect) setAspectRatio();
}
// Erase old contents
cls();
// Set the available scalers for this framebuffer, based on current eventhandler
// state and the maximum size of a window for the current desktop
@ -106,14 +106,14 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height,
// And refresh the display
myOSystem->eventHandler().refreshDisplay();
// Set palette for GUI
for(int i = 0; i < kNumColors-256; i++)
myDefPalette[i+256] = mapRGB(ourGUIColors[i][0], ourGUIColors[i][1], ourGUIColors[i][2]);
// Enable unicode so we can see translated key events
// (lowercase vs. uppercase characters)
SDL_EnableUNICODE(1);
// Set palette for GUI
for(int i = 0; i < kNumColors-256; i++)
myDefPalette[i+256] = mapRGB(ourGUIColors[i][0], ourGUIColors[i][1], ourGUIColors[i][2]);
// Erase any messages from a previous run
myMessage.counter = 0;

View File

@ -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: FrameBufferGP2X.cxx,v 1.1 2006-12-02 23:25:54 stephena Exp $
// $Id: FrameBufferGP2X.cxx,v 1.2 2006-12-03 01:13:45 stephena Exp $
//============================================================================
#include <SDL.h>
@ -93,6 +93,7 @@ bool FrameBufferGP2X::createScreen()
cerr << "ERROR: Unable to open SDL window: " << SDL_GetError() << endl;
return false;
}
myPitch = myScreen->pitch/2;
// Erase old rects, since they've probably been scaled for
// a different sized screen
@ -114,8 +115,6 @@ void FrameBufferGP2X::drawMediaSource()
uInt32 width = mediasrc.width();
uInt32 height = mediasrc.height();
// switch((int)myRenderType) // use switch/case, since we'll eventually have filters
// {
if(!myUsePhosphor)
{
struct Rectangle
@ -196,7 +195,6 @@ void FrameBufferGP2X::drawMediaSource()
{
current.y = active.y;
current.height = active.height + 1;
++activeIndex;
}
// Is it impossible for this active rectangle to be merged?
@ -221,7 +219,6 @@ void FrameBufferGP2X::drawMediaSource()
for(uInt16 s = activeIndex; s < activeCount; ++s)
{
Rectangle& active = activeRectangles[s];
SDL_Rect temp;
temp.x = active.x * screenMultiple << 1;
temp.y = active.y * screenMultiple;
@ -246,7 +243,6 @@ void FrameBufferGP2X::drawMediaSource()
for(uInt16 t = 0; t < activeCount; ++t)
{
Rectangle& active = activeRectangles[t];
SDL_Rect temp;
temp.x = active.x * screenMultiple << 1;
temp.y = active.y * screenMultiple;
@ -258,7 +254,6 @@ void FrameBufferGP2X::drawMediaSource()
}
}
else
// case kPhosphor_16:
{
// Since phosphor mode updates the whole screen,
// we might as well use SDL_Flip (see postFrameUpdate)
@ -296,7 +291,6 @@ else
}
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGP2X::preFrameUpdate()

View File

@ -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: FrameBufferGP2X.hxx,v 1.1 2006-12-02 23:25:55 stephena Exp $
// $Id: FrameBufferGP2X.hxx,v 1.2 2006-12-03 01:13:45 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_GP2X_HXX
@ -35,7 +35,7 @@ class RectList;
This class implements an SDL hardware framebuffer.
@author Stephen Anthony
@version $Id: FrameBufferGP2X.hxx,v 1.1 2006-12-02 23:25:55 stephena Exp $
@version $Id: FrameBufferGP2X.hxx,v 1.2 2006-12-03 01:13:45 stephena Exp $
*/
class FrameBufferGP2X : public FrameBuffer
{
@ -185,7 +185,7 @@ class FrameBufferGP2X : public FrameBuffer
@param x X coordinate to translate
@param y Y coordinate to translate
*/
inline virtual void translateCoords(Int32* x, Int32* y);
virtual void translateCoords(Int32* x, Int32* y);
/**
This method adds a dirty rectangle