mirror of https://github.com/stella-emu/stella.git
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:
parent
8ef6d7032e
commit
f48ea59ca6
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// 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
|
#ifndef FRAMEBUFFER_SOFT_HXX
|
||||||
|
@ -35,7 +35,7 @@ class RectList;
|
||||||
This class implements an SDL software framebuffer.
|
This class implements an SDL software framebuffer.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@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
|
class FrameBufferSoft : public FrameBuffer
|
||||||
{
|
{
|
||||||
|
@ -185,7 +185,7 @@ class FrameBufferSoft : public FrameBuffer
|
||||||
@param x X coordinate to translate
|
@param x X coordinate to translate
|
||||||
@param y Y 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
|
This method adds a dirty rectangle
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// 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>
|
#include <sstream>
|
||||||
|
@ -64,17 +64,17 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height,
|
||||||
myFrameRate = myOSystem->frameRate();
|
myFrameRate = myOSystem->frameRate();
|
||||||
|
|
||||||
// Now (re)initialize the SDL video system
|
// Now (re)initialize the SDL video system
|
||||||
|
// These things only have to be done one per FrameBuffer creation
|
||||||
if(!isAlreadyInitialized)
|
if(!isAlreadyInitialized)
|
||||||
{
|
{
|
||||||
Uint32 initflags = SDL_INIT_VIDEO | SDL_INIT_TIMER;
|
Uint32 initflags = SDL_INIT_VIDEO | SDL_INIT_TIMER;
|
||||||
|
|
||||||
if(SDL_Init(initflags) < 0)
|
if(SDL_Init(initflags) < 0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
setWindowIcon();
|
|
||||||
|
|
||||||
// Erase old contents
|
// Set window title and icon
|
||||||
cls();
|
setWindowTitle(title);
|
||||||
|
setWindowIcon();
|
||||||
|
|
||||||
// Query the desktop size
|
// Query the desktop size
|
||||||
// This is really the job of SDL
|
// This is really the job of SDL
|
||||||
|
@ -85,13 +85,13 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height,
|
||||||
// Set fullscreen flag
|
// Set fullscreen flag
|
||||||
mySDLFlags = myOSystem->settings().getBool("fullscreen") ? SDL_FULLSCREEN : 0;
|
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
|
// Get the aspect ratio for the display if it's been enabled
|
||||||
theAspectRatio = 1.0;
|
theAspectRatio = 1.0;
|
||||||
if(useAspect)
|
if(useAspect) setAspectRatio();
|
||||||
setAspectRatio();
|
}
|
||||||
|
|
||||||
|
// Erase old contents
|
||||||
|
cls();
|
||||||
|
|
||||||
// Set the available scalers for this framebuffer, based on current eventhandler
|
// Set the available scalers for this framebuffer, based on current eventhandler
|
||||||
// state and the maximum size of a window for the current desktop
|
// 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
|
// And refresh the display
|
||||||
myOSystem->eventHandler().refreshDisplay();
|
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
|
// Enable unicode so we can see translated key events
|
||||||
// (lowercase vs. uppercase characters)
|
// (lowercase vs. uppercase characters)
|
||||||
SDL_EnableUNICODE(1);
|
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
|
// Erase any messages from a previous run
|
||||||
myMessage.counter = 0;
|
myMessage.counter = 0;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// 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>
|
#include <SDL.h>
|
||||||
|
@ -93,6 +93,7 @@ bool FrameBufferGP2X::createScreen()
|
||||||
cerr << "ERROR: Unable to open SDL window: " << SDL_GetError() << endl;
|
cerr << "ERROR: Unable to open SDL window: " << SDL_GetError() << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
myPitch = myScreen->pitch/2;
|
||||||
|
|
||||||
// Erase old rects, since they've probably been scaled for
|
// Erase old rects, since they've probably been scaled for
|
||||||
// a different sized screen
|
// a different sized screen
|
||||||
|
@ -114,8 +115,6 @@ void FrameBufferGP2X::drawMediaSource()
|
||||||
uInt32 width = mediasrc.width();
|
uInt32 width = mediasrc.width();
|
||||||
uInt32 height = mediasrc.height();
|
uInt32 height = mediasrc.height();
|
||||||
|
|
||||||
// switch((int)myRenderType) // use switch/case, since we'll eventually have filters
|
|
||||||
// {
|
|
||||||
if(!myUsePhosphor)
|
if(!myUsePhosphor)
|
||||||
{
|
{
|
||||||
struct Rectangle
|
struct Rectangle
|
||||||
|
@ -196,7 +195,6 @@ void FrameBufferGP2X::drawMediaSource()
|
||||||
{
|
{
|
||||||
current.y = active.y;
|
current.y = active.y;
|
||||||
current.height = active.height + 1;
|
current.height = active.height + 1;
|
||||||
|
|
||||||
++activeIndex;
|
++activeIndex;
|
||||||
}
|
}
|
||||||
// Is it impossible for this active rectangle to be merged?
|
// Is it impossible for this active rectangle to be merged?
|
||||||
|
@ -221,7 +219,6 @@ void FrameBufferGP2X::drawMediaSource()
|
||||||
for(uInt16 s = activeIndex; s < activeCount; ++s)
|
for(uInt16 s = activeIndex; s < activeCount; ++s)
|
||||||
{
|
{
|
||||||
Rectangle& active = activeRectangles[s];
|
Rectangle& active = activeRectangles[s];
|
||||||
|
|
||||||
SDL_Rect temp;
|
SDL_Rect temp;
|
||||||
temp.x = active.x * screenMultiple << 1;
|
temp.x = active.x * screenMultiple << 1;
|
||||||
temp.y = active.y * screenMultiple;
|
temp.y = active.y * screenMultiple;
|
||||||
|
@ -246,7 +243,6 @@ void FrameBufferGP2X::drawMediaSource()
|
||||||
for(uInt16 t = 0; t < activeCount; ++t)
|
for(uInt16 t = 0; t < activeCount; ++t)
|
||||||
{
|
{
|
||||||
Rectangle& active = activeRectangles[t];
|
Rectangle& active = activeRectangles[t];
|
||||||
|
|
||||||
SDL_Rect temp;
|
SDL_Rect temp;
|
||||||
temp.x = active.x * screenMultiple << 1;
|
temp.x = active.x * screenMultiple << 1;
|
||||||
temp.y = active.y * screenMultiple;
|
temp.y = active.y * screenMultiple;
|
||||||
|
@ -257,8 +253,7 @@ void FrameBufferGP2X::drawMediaSource()
|
||||||
SDL_FillRect(myScreen, &temp, myDefPalette[active.color]);
|
SDL_FillRect(myScreen, &temp, myDefPalette[active.color]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// case kPhosphor_16:
|
|
||||||
{
|
{
|
||||||
// Since phosphor mode updates the whole screen,
|
// Since phosphor mode updates the whole screen,
|
||||||
// we might as well use SDL_Flip (see postFrameUpdate)
|
// we might as well use SDL_Flip (see postFrameUpdate)
|
||||||
|
@ -295,7 +290,6 @@ else
|
||||||
bufofsY += width;
|
bufofsY += width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// 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
|
#ifndef FRAMEBUFFER_GP2X_HXX
|
||||||
|
@ -35,7 +35,7 @@ class RectList;
|
||||||
This class implements an SDL hardware framebuffer.
|
This class implements an SDL hardware framebuffer.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@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
|
class FrameBufferGP2X : public FrameBuffer
|
||||||
{
|
{
|
||||||
|
@ -185,7 +185,7 @@ class FrameBufferGP2X : public FrameBuffer
|
||||||
@param x X coordinate to translate
|
@param x X coordinate to translate
|
||||||
@param y Y 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
|
This method adds a dirty rectangle
|
||||||
|
|
Loading…
Reference in New Issue