Separated out RectList from FrameBufferSoft, since FrameBufferGP2X also

needs it.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1170 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-12-03 17:57:54 +00:00
parent b4531c331a
commit 67f631e697
7 changed files with 133 additions and 171 deletions

View File

@ -13,21 +13,19 @@
// 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.cxx,v 1.59 2006-12-02 00:43:49 stephena Exp $ // $Id: FrameBufferSoft.cxx,v 1.60 2006-12-03 17:57:54 stephena Exp $
//============================================================================ //============================================================================
#include <SDL.h> #include <SDL.h>
#include <SDL_syswm.h>
#include <sstream>
#include "Console.hxx" #include "Console.hxx"
#include "FrameBuffer.hxx"
#include "FrameBufferSoft.hxx"
#include "MediaSrc.hxx" #include "MediaSrc.hxx"
#include "Settings.hxx" #include "Settings.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Font.hxx" #include "Font.hxx"
#include "GuiUtils.hxx" #include "GuiUtils.hxx"
#include "RectList.hxx"
#include "FrameBufferSoft.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBufferSoft::FrameBufferSoft(OSystem* osystem) FrameBufferSoft::FrameBufferSoft(OSystem* osystem)
@ -93,9 +91,9 @@ void FrameBufferSoft::setScaler(Scaler scaler)
// Software framebuffer doesn't handle the fancy scaling modes // Software framebuffer doesn't handle the fancy scaling modes
myZoomLevel = scaler.zoom; myZoomLevel = scaler.zoom;
break; break;
default: // should never get here
default: myZoomLevel = 1;
break; // should never get here break;
} }
} }
@ -682,59 +680,3 @@ void FrameBufferSoft::cls()
SDL_UpdateRect(myScreen, 0, 0, 0, 0); SDL_UpdateRect(myScreen, 0, 0, 0, 0);
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RectList::RectList(Uint32 size)
{
currentSize = size;
currentRect = 0;
rectArray = new SDL_Rect[currentSize];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RectList::~RectList()
{
delete[] rectArray;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RectList::add(SDL_Rect* newRect)
{
if(currentRect >= currentSize)
{
currentSize = currentSize * 2;
SDL_Rect *temp = new SDL_Rect[currentSize];
for(Uint32 i = 0; i < currentRect; ++i)
temp[i] = rectArray[i];
delete[] rectArray;
rectArray = temp;
}
rectArray[currentRect].x = newRect->x;
rectArray[currentRect].y = newRect->y;
rectArray[currentRect].w = newRect->w;
rectArray[currentRect].h = newRect->h;
++currentRect;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SDL_Rect* RectList::rects()
{
return rectArray;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Uint32 RectList::numRects()
{
return currentRect;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RectList::start()
{
currentRect = 0;
}

View File

@ -13,21 +13,19 @@
// 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.37 2006-12-03 01:13:44 stephena Exp $ // $Id: FrameBufferSoft.hxx,v 1.38 2006-12-03 17:57:54 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_SOFT_HXX #ifndef FRAMEBUFFER_SOFT_HXX
#define FRAMEBUFFER_SOFT_HXX #define FRAMEBUFFER_SOFT_HXX
#include <SDL.h> #include <SDL.h>
#include <SDL_syswm.h>
class OSystem; class OSystem;
class GUI::Font; class GUI::Font;
class RectList; class RectList;
#include "bspf.hxx" #include "bspf.hxx"
#include "GuiUtils.hxx"
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
@ -35,7 +33,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.37 2006-12-03 01:13:44 stephena Exp $ @version $Id: FrameBufferSoft.hxx,v 1.38 2006-12-03 17:57:54 stephena Exp $
*/ */
class FrameBufferSoft : public FrameBuffer class FrameBufferSoft : public FrameBuffer
{ {
@ -227,22 +225,4 @@ class FrameBufferSoft : public FrameBuffer
RectList* myOverlayRectList; RectList* myOverlayRectList;
}; };
class RectList
{
public:
RectList(Uint32 size = 512);
~RectList();
void add(SDL_Rect* rect);
SDL_Rect* rects();
Uint32 numRects();
void start();
private:
Uint32 currentSize, currentRect;
SDL_Rect* rectArray;
};
#endif #endif

View File

@ -0,0 +1,76 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: RectList.cxx,v 1.1 2006-12-03 17:57:54 stephena Exp $
//============================================================================
#include <SDL.h>
#include "RectList.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RectList::RectList(Uint32 size)
{
currentSize = size;
currentRect = 0;
rectArray = new SDL_Rect[currentSize];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RectList::~RectList()
{
delete[] rectArray;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RectList::add(SDL_Rect* newRect)
{
if(currentRect >= currentSize)
{
currentSize = currentSize * 2;
SDL_Rect *temp = new SDL_Rect[currentSize];
for(Uint32 i = 0; i < currentRect; ++i)
temp[i] = rectArray[i];
delete[] rectArray;
rectArray = temp;
}
rectArray[currentRect].x = newRect->x;
rectArray[currentRect].y = newRect->y;
rectArray[currentRect].w = newRect->w;
rectArray[currentRect].h = newRect->h;
++currentRect;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SDL_Rect* RectList::rects()
{
return rectArray;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Uint32 RectList::numRects()
{
return currentRect;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RectList::start()
{
currentRect = 0;
}

View File

@ -0,0 +1,42 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: RectList.hxx,v 1.1 2006-12-03 17:57:54 stephena Exp $
//============================================================================
#ifndef RECTLIST_HXX
#define RECTLIST_HXX
#include <SDL.h>
class RectList
{
public:
RectList(Uint32 size = 512);
~RectList();
void add(SDL_Rect* rect);
SDL_Rect* rects();
Uint32 numRects();
void start();
private:
Uint32 currentSize, currentRect;
SDL_Rect* rectArray;
};
#endif

View File

@ -6,6 +6,7 @@ MODULE_OBJS := \
src/common/SoundSDL.o \ src/common/SoundSDL.o \
src/common/FrameBufferSoft.o \ src/common/FrameBufferSoft.o \
src/common/FrameBufferGL.o \ src/common/FrameBufferGL.o \
src/common/RectList.o \
src/common/Snapshot.o src/common/Snapshot.o
MODULE_DIRS += \ MODULE_DIRS += \

View File

@ -13,21 +13,18 @@
// 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.2 2006-12-03 01:13:45 stephena Exp $ // $Id: FrameBufferGP2X.cxx,v 1.3 2006-12-03 17:57:54 stephena Exp $
//============================================================================ //============================================================================
#include <SDL.h> #include <SDL.h>
#include <SDL_syswm.h>
#include <sstream>
#include "Console.hxx" #include "Console.hxx"
#include "FrameBuffer.hxx"
#include "FrameBufferGP2X.hxx"
#include "MediaSrc.hxx" #include "MediaSrc.hxx"
#include "Settings.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Font.hxx" #include "Font.hxx"
#include "GuiUtils.hxx" #include "GuiUtils.hxx"
#include "RectList.hxx"
#include "FrameBufferGP2X.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBufferGP2X::FrameBufferGP2X(OSystem* osystem) FrameBufferGP2X::FrameBufferGP2X(OSystem* osystem)
@ -495,59 +492,3 @@ void FrameBufferGP2X::showCursor(bool show)
// Never show the cursor // Never show the cursor
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RectList::RectList(Uint32 size)
{
currentSize = size;
currentRect = 0;
rectArray = new SDL_Rect[currentSize];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RectList::~RectList()
{
delete[] rectArray;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RectList::add(SDL_Rect* newRect)
{
if(currentRect >= currentSize)
{
currentSize = currentSize * 2;
SDL_Rect *temp = new SDL_Rect[currentSize];
for(Uint32 i = 0; i < currentRect; ++i)
temp[i] = rectArray[i];
delete[] rectArray;
rectArray = temp;
}
rectArray[currentRect].x = newRect->x;
rectArray[currentRect].y = newRect->y;
rectArray[currentRect].w = newRect->w;
rectArray[currentRect].h = newRect->h;
++currentRect;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SDL_Rect* RectList::rects()
{
return rectArray;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Uint32 RectList::numRects()
{
return currentRect;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RectList::start()
{
currentRect = 0;
}

View File

@ -13,29 +13,27 @@
// 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.2 2006-12-03 01:13:45 stephena Exp $ // $Id: FrameBufferGP2X.hxx,v 1.3 2006-12-03 17:57:54 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_GP2X_HXX #ifndef FRAMEBUFFER_GP2X_HXX
#define FRAMEBUFFER_GP2X_HXX #define FRAMEBUFFER_GP2X_HXX
#include <SDL.h> #include <SDL.h>
#include <SDL_syswm.h>
class OSystem; class OSystem;
class GUI::Font; class GUI::Font;
class RectList; class RectList;
#include "bspf.hxx" #include "bspf.hxx"
#include "GuiUtils.hxx"
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
/** /**
This class implements an SDL hardware framebuffer. This class implements an SDL hardware framebuffer for the GP2X device.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBufferGP2X.hxx,v 1.2 2006-12-03 01:13:45 stephena Exp $ @version $Id: FrameBufferGP2X.hxx,v 1.3 2006-12-03 17:57:54 stephena Exp $
*/ */
class FrameBufferGP2X : public FrameBuffer class FrameBufferGP2X : public FrameBuffer
{ {
@ -223,22 +221,4 @@ class FrameBufferGP2X : public FrameBuffer
RectList* myOverlayRectList; RectList* myOverlayRectList;
}; };
class RectList
{
public:
RectList(Uint32 size = 512);
~RectList();
void add(SDL_Rect* rect);
SDL_Rect* rects();
Uint32 numRects();
void start();
private:
Uint32 currentSize, currentRect;
SDL_Rect* rectArray;
};
#endif #endif