Changed behaviour of 'gl_fsmax' argument again. It's now a boolean,

which only applies to TIA mode (in fullscreen, of course).

Some code/debugging cleanups across the various FrameBuffer classes.

Finally fixed software rendering mode crashes.  It now works just as
well as OpenGL mode, with all dialog positioning working the same in
both.

Reactivated OpenGL filtering (GL_LINEAR and GL_NEAREST).  Only the TIA
image can be changed; the UI dialogs are always using GL_NEAREST).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1579 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-12-28 21:01:55 +00:00
parent 829375de34
commit 3f81dd2c93
17 changed files with 165 additions and 249 deletions

View File

@ -605,8 +605,8 @@
</tr> </tr>
<tr> <tr>
<td><pre>-gl_fsmax &lt;never|always|ui|tia&gt;</pre></td> <td><pre>-gl_fsmax &lt;0|1&gt;</pre></td>
<td>OpenGL mode only. Stretch fullscreen image while in the given mode.</td> <td>OpenGL mode only. Stretch TIA image while in fullscreen mode.</td>
</tr> </tr>
<tr> <tr>

View File

@ -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: FrameBufferGL.cxx,v 1.126 2008-12-27 23:27:32 stephena Exp $ // $Id: FrameBufferGL.cxx,v 1.127 2008-12-28 21:01:55 stephena Exp $
//============================================================================ //============================================================================
#ifdef DISPLAY_OPENGL #ifdef DISPLAY_OPENGL
@ -74,8 +74,6 @@ FrameBufferGL::FrameBufferGL(OSystem* osystem)
: FrameBuffer(osystem), : FrameBuffer(osystem),
myTiaSurface(NULL), myTiaSurface(NULL),
myFilterParamName("GL_NEAREST"), myFilterParamName("GL_NEAREST"),
myWidthScaleFactor(1.0),
myHeightScaleFactor(1.0),
myHaveTexRectEXT(false), myHaveTexRectEXT(false),
myDirtyFlag(true) myDirtyFlag(true)
{ {
@ -188,8 +186,6 @@ bool FrameBufferGL::loadFuncs()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferGL::initSubsystem(VideoMode& mode) bool FrameBufferGL::initSubsystem(VideoMode& mode)
{ {
cerr << "FrameBufferGL::initSubsystem\n";
mySDLFlags |= SDL_OPENGL; mySDLFlags |= SDL_OPENGL;
// Set up the OpenGL attributes // Set up the OpenGL attributes
@ -244,8 +240,6 @@ string FrameBufferGL::about() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferGL::setVidMode(VideoMode& mode) bool FrameBufferGL::setVidMode(VideoMode& mode)
{ {
cerr << "setVidMode: w = " << mode.screen_w << ", h = " << mode.screen_h << endl;
bool inUIMode = bool inUIMode =
myOSystem->eventHandler().state() == EventHandler::S_LAUNCHER || myOSystem->eventHandler().state() == EventHandler::S_LAUNCHER ||
myOSystem->eventHandler().state() == EventHandler::S_DEBUGGER; myOSystem->eventHandler().state() == EventHandler::S_DEBUGGER;
@ -254,32 +248,19 @@ cerr << "setVidMode: w = " << mode.screen_w << ", h = " << mode.screen_h << endl
uInt32 baseWidth = mode.image_w / mode.gfxmode.zoom; uInt32 baseWidth = mode.image_w / mode.gfxmode.zoom;
uInt32 baseHeight = mode.image_h / mode.gfxmode.zoom; uInt32 baseHeight = mode.image_h / mode.gfxmode.zoom;
// FIXME - look at actual videomode type // Aspect ratio and fullscreen stretching only applies to the TIA
// Normally, we just scale to the given zoom level if(!inUIMode)
myWidthScaleFactor = (float) mode.gfxmode.zoom;
myHeightScaleFactor = (float) mode.gfxmode.zoom;
// Activate aspect ratio correction in TIA mode
int iaspect = myOSystem->settings().getInt("gl_aspect");
if(!inUIMode && iaspect < 100)
{ {
float aspectFactor = float(iaspect) / 100.0; // Aspect ratio
myWidthScaleFactor *= aspectFactor; int aspect = myOSystem->settings().getInt("gl_aspect");
mode.image_w = (uInt16)(float(mode.image_w) * aspectFactor); if(aspect < 100)
} mode.image_w = (uInt16)(float(mode.image_w * aspect) / 100.0);
// Activate stretching if its been requested in fullscreen mode // Fullscreen mode stretching
if(fullScreen() && myOSystem->settings().getBool("gl_fsmax") &&
(mode.image_w < mode.screen_w) && (mode.image_h < mode.screen_h))
{
float stretchFactor = 1.0; float stretchFactor = 1.0;
if(fullScreen() && (mode.image_w < mode.screen_w) &&
(mode.image_h < mode.screen_h))
{
const string& gl_fsmax = myOSystem->settings().getString("gl_fsmax");
// Only stretch in certain modes
if((gl_fsmax == "always") ||
(inUIMode && gl_fsmax == "ui") ||
(!inUIMode && gl_fsmax == "tia"))
{
float scaleX = float(mode.image_w) / mode.screen_w; float scaleX = float(mode.image_w) / mode.screen_w;
float scaleY = float(mode.image_h) / mode.screen_h; float scaleY = float(mode.image_h) / mode.screen_h;
@ -287,14 +268,13 @@ cerr << "setVidMode: w = " << mode.screen_w << ", h = " << mode.screen_h << endl
stretchFactor = float(mode.screen_w) / mode.image_w; stretchFactor = float(mode.screen_w) / mode.image_w;
else else
stretchFactor = float(mode.screen_h) / mode.image_h; stretchFactor = float(mode.screen_h) / mode.image_h;
}
}
myWidthScaleFactor *= stretchFactor;
myHeightScaleFactor *= stretchFactor;
// Now re-calculate the dimensions
mode.image_w = (Uint16) (stretchFactor * mode.image_w); mode.image_w = (Uint16) (stretchFactor * mode.image_w);
mode.image_h = (Uint16) (stretchFactor * mode.image_h); mode.image_h = (Uint16) (stretchFactor * mode.image_h);
}
}
// Now re-calculate the dimensions
if(!fullScreen()) mode.screen_w = mode.image_w; if(!fullScreen()) mode.screen_w = mode.image_w;
mode.image_x = (mode.screen_w - mode.image_w) >> 1; mode.image_x = (mode.screen_w - mode.image_w) >> 1;
mode.image_y = (mode.screen_h - mode.image_h) >> 1; mode.image_y = (mode.screen_h - mode.image_h) >> 1;
@ -390,6 +370,7 @@ cerr << "dimensions: " << (fullScreen() ? "(full)" : "") << endl
myTiaSurface = new FBSurfaceGL(*this, baseWidth>>1, baseHeight, myTiaSurface = new FBSurfaceGL(*this, baseWidth>>1, baseHeight,
mode.image_w, mode.image_h); mode.image_w, mode.image_h);
myTiaSurface->setPos(mode.image_x, mode.image_y); myTiaSurface->setPos(mode.image_x, mode.image_y);
myTiaSurface->setFilter(myOSystem->settings().getString("gl_filter"));
} }
// Make sure any old parts of the screen are erased // Make sure any old parts of the screen are erased
@ -474,14 +455,11 @@ void FrameBufferGL::drawMediaSource(bool fullRedraw)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::postFrameUpdate() void FrameBufferGL::postFrameUpdate()
{ {
//static int FCOUNT = 0;
if(myDirtyFlag) if(myDirtyFlag)
{ {
// Now show all changes made to the texture // Now show all changes made to the texture
SDL_GL_SwapBuffers(); SDL_GL_SwapBuffers();
myDirtyFlag = false; myDirtyFlag = false;
//cerr << FCOUNT++ % 2 << " : SWAP buffers" << endl;
//cerr << "--------------------------------------------------------------------" << endl;
} }
} }
@ -494,34 +472,6 @@ void FrameBufferGL::enablePhosphor(bool enable, int blend)
myRedrawEntireFrame = true; myRedrawEntireFrame = true;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::toggleFilter()
{
/*
if(myBuffer.filter == GL_NEAREST)
{
myBuffer.filter = GL_LINEAR;
myOSystem->settings().setString("gl_filter", "linear");
showMessage("Filtering: GL_LINEAR");
}
else
{
myBuffer.filter = GL_NEAREST;
myOSystem->settings().setString("gl_filter", "nearest");
showMessage("Filtering: GL_NEAREST");
}
p_glBindTexture(myBuffer.target, myBuffer.texture);
p_glTexParameteri(myBuffer.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
p_glTexParameteri(myBuffer.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
p_glTexParameteri(myBuffer.target, GL_TEXTURE_MAG_FILTER, myBuffer.filter);
p_glTexParameteri(myBuffer.target, GL_TEXTURE_MIN_FILTER, myBuffer.filter);
// The filtering has changed, so redraw the entire screen
myRedrawEntireFrame = true;
*/
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FBSurface* FrameBufferGL::createSurface(int w, int h, bool isBase) const FBSurface* FrameBufferGL::createSurface(int w, int h, bool isBase) const
{ {
@ -561,8 +511,6 @@ FBSurfaceGL::FBSurfaceGL(FrameBufferGL& buffer,
myWidth(scaleWidth), myWidth(scaleWidth),
myHeight(scaleHeight) myHeight(scaleHeight)
{ {
//cerr << " FBSurfaceGL::FBSurfaceGL: w = " << baseWidth << ", h = " << baseHeight << " : " << this << endl;
// Fill buffer struct with valid data // Fill buffer struct with valid data
// This changes depending on the texturing used // This changes depending on the texturing used
myTexCoord[0] = 0.0f; myTexCoord[0] = 0.0f;
@ -612,8 +560,6 @@ FBSurfaceGL::FBSurfaceGL(FrameBufferGL& buffer,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FBSurfaceGL::~FBSurfaceGL() FBSurfaceGL::~FBSurfaceGL()
{ {
//cerr << " FBSurfaceGL::~FBSurfaceGL(): myTexID = " << myTexID << " @ " << this << endl;
if(myTexture) if(myTexture)
SDL_FreeSurface(myTexture); SDL_FreeSurface(myTexture);
@ -720,6 +666,8 @@ void FBSurfaceGL::drawBitmap(uInt32* bitmap, Int32 tx, Int32 ty,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceGL::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h) void FBSurfaceGL::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
{ {
// OpenGL mode doesn't make use of dirty rectangles
// It's faster to just update the entire surface
mySurfaceIsDirty = true; mySurfaceIsDirty = true;
} }
@ -740,8 +688,6 @@ void FBSurfaceGL::setPos(uInt32 x, uInt32 y)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceGL::setWidth(uInt32 w) void FBSurfaceGL::setWidth(uInt32 w)
{ {
//cerr << " BEFORE: w = " << myWidth <<", texcoord[2] = " << myTexCoord[2] << endl;
// This method can't be used with 'scaled' surface (aka TIA surfaces) // This method can't be used with 'scaled' surface (aka TIA surfaces)
// That shouldn't really matter, though, as all the UI stuff isn't scaled, // That shouldn't really matter, though, as all the UI stuff isn't scaled,
// and it's the only thing that uses it // and it's the only thing that uses it
@ -751,15 +697,11 @@ void FBSurfaceGL::setWidth(uInt32 w)
myTexCoord[2] = (GLfloat) myWidth; myTexCoord[2] = (GLfloat) myWidth;
else else
myTexCoord[2] = (GLfloat) myWidth / myTexWidth; myTexCoord[2] = (GLfloat) myWidth / myTexWidth;
//cerr << " AFTER: w = " << myWidth <<", texcoord[2] = " << myTexCoord[2] << endl;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceGL::setHeight(uInt32 h) void FBSurfaceGL::setHeight(uInt32 h)
{ {
//cerr << " BEFORE: h = " << myHeight <<", texcoord[3] = " << myTexCoord[3] << endl;
// This method can't be used with 'scaled' surface (aka TIA surfaces) // This method can't be used with 'scaled' surface (aka TIA surfaces)
// That shouldn't really matter, though, as all the UI stuff isn't scaled, // That shouldn't really matter, though, as all the UI stuff isn't scaled,
// and it's the only thing that uses it // and it's the only thing that uses it
@ -769,22 +711,13 @@ void FBSurfaceGL::setHeight(uInt32 h)
myTexCoord[3] = (GLfloat) myHeight; myTexCoord[3] = (GLfloat) myHeight;
else else
myTexCoord[3] = (GLfloat) myHeight / myTexHeight; myTexCoord[3] = (GLfloat) myHeight / myTexHeight;
//cerr << " AFTER: h = " << myHeight <<", texcoord[3] = " << myTexCoord[3] << endl;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceGL::translateCoords(Int32& x, Int32& y) const void FBSurfaceGL::translateCoords(Int32& x, Int32& y) const
{ {
#if 1 x -= myXOrig;
x = x - myXOrig; y -= myYOrig;
y = y - myYOrig;
#else
// Wow, what a mess :)
const GUI::Rect& image = myFB.imageRect();
x = (Int32) ((x - myXOrig - image.x()) / myWidthScaleFactor);
y = (Int32) ((y - myXOrig - image.y()) / myHeightScaleFactor);
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -792,8 +725,6 @@ void FBSurfaceGL::update()
{ {
if(mySurfaceIsDirty) if(mySurfaceIsDirty)
{ {
//cerr << " --> FBSurfaceGL::update(): w = " << myWidth << ", h = " << myHeight << endl;
// Texturemap complete texture to surface so we have free scaling // Texturemap complete texture to surface so we have free scaling
// and antialiasing // and antialiasing
p_glBindTexture(myTexTarget, myTexID); p_glBindTexture(myTexTarget, myTexID);
@ -823,8 +754,6 @@ void FBSurfaceGL::update()
void FBSurfaceGL::free() void FBSurfaceGL::free()
{ {
p_glDeleteTextures(1, &myTexID); p_glDeleteTextures(1, &myTexID);
//cerr << " ==> FBSurfaceGL::free(): myTexID = " << myTexID << " @ " << this << endl;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -839,26 +768,10 @@ void FBSurfaceGL::reload()
// Basically, all that needs to be done is to re-call glTexImage2D with a // Basically, all that needs to be done is to re-call glTexImage2D with a
// new texture ID, so that's what we do here // new texture ID, so that's what we do here
/*
// Create an OpenGL texture from the SDL texture
const string& filter = myOSystem->settings().getString("gl_filter");
if(filter == "linear")
{
myBuffer.filter = GL_LINEAR;
myFilterParamName = "GL_LINEAR";
}
else if(filter == "nearest")
{
myBuffer.filter = GL_NEAREST;
myFilterParamName = "GL_NEAREST";
}
*/
p_glGenTextures(1, &myTexID); p_glGenTextures(1, &myTexID);
p_glBindTexture(myTexTarget, myTexID); p_glBindTexture(myTexTarget, myTexID);
p_glTexParameteri(myTexTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); p_glTexParameteri(myTexTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
p_glTexParameteri(myTexTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); p_glTexParameteri(myTexTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
// p_glTexParameteri(myTexTarget, GL_TEXTURE_MIN_FILTER, myBuffer.filter);
// p_glTexParameteri(myTexTarget, GL_TEXTURE_MAG_FILTER, myBuffer.filter);
p_glTexParameteri(myTexTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST); p_glTexParameteri(myTexTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
p_glTexParameteri(myTexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST); p_glTexParameteri(myTexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@ -868,10 +781,35 @@ void FBSurfaceGL::reload()
GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, myTexture->pixels); GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, myTexture->pixels);
p_glEnable(myTexTarget); p_glEnable(myTexTarget);
//cerr << " ==> FBSurfaceGL::reload(): myTexID = " << myTexID << " @ " << this << endl;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceGL::setFilter(const string& name)
{
// We only do GL_NEAREST or GL_LINEAR for now
GLint filter = GL_NEAREST;
if(name == "linear")
filter = GL_LINEAR;
p_glBindTexture(myTexTarget, myTexID);
p_glTexParameteri(myTexTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
p_glTexParameteri(myTexTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
p_glTexParameteri(myTexTarget, GL_TEXTURE_MIN_FILTER, filter);
p_glTexParameteri(myTexTarget, GL_TEXTURE_MAG_FILTER, filter);
// The filtering has changed, so redraw the entire screen
mySurfaceIsDirty = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferGL::myLibraryLoaded = false;
#endif // DISPLAY_OPENGL
#if 0 #if 0
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Surface* FrameBufferGL::createSurface(int width, int height) const GUI::Surface* FrameBufferGL::createSurface(int width, int height) const
@ -884,7 +822,6 @@ GUI::Surface* FrameBufferGL::createSurface(int width, int height) const
return data ? new GUI::Surface(width, height, data) : NULL; return data ? new GUI::Surface(width, height, data) : NULL;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::drawSurface(const GUI::Surface* surface, Int32 x, Int32 y) void FrameBufferGL::drawSurface(const GUI::Surface* surface, Int32 x, Int32 y)
{ {
@ -912,8 +849,3 @@ void FrameBufferGL::bytesToSurface(GUI::Surface* surface, int row,
*pixels++ = SDL_MapRGB(s->format, data[c], data[c+1], data[c+2]); *pixels++ = SDL_MapRGB(s->format, data[c], data[c+1], data[c+2]);
} }
#endif #endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferGL::myLibraryLoaded = false;
#endif // DISPLAY_OPENGL

View File

@ -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: FrameBufferGL.hxx,v 1.65 2008-12-27 23:27:32 stephena Exp $ // $Id: FrameBufferGL.hxx,v 1.66 2008-12-28 21:01:55 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_GL_HXX #ifndef FRAMEBUFFER_GL_HXX
@ -35,7 +35,7 @@ class FBSurfaceGL;
This class implements an SDL OpenGL framebuffer. This class implements an SDL OpenGL framebuffer.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBufferGL.hxx,v 1.65 2008-12-27 23:27:32 stephena Exp $ @version $Id: FrameBufferGL.hxx,v 1.66 2008-12-28 21:01:55 stephena Exp $
*/ */
class FrameBufferGL : public FrameBuffer class FrameBufferGL : public FrameBuffer
{ {
@ -126,12 +126,6 @@ class FrameBufferGL : public FrameBuffer
*/ */
FBSurface* createSurface(int w, int h, bool useBase = false) const; FBSurface* createSurface(int w, int h, bool useBase = false) const;
/**
Switches between the two filtering options in OpenGL.
Currently, these are GL_NEAREST and GL_LINEAR.
*/
void toggleFilter();
/** /**
This method should be called anytime the MediaSource needs to be redrawn This method should be called anytime the MediaSource needs to be redrawn
to the screen (full indicating that a full redraw is required). to the screen (full indicating that a full redraw is required).
@ -168,9 +162,6 @@ class FrameBufferGL : public FrameBuffer
// The name of the texture filtering to use // The name of the texture filtering to use
string myFilterParamName; string myFilterParamName;
// The amount by which to scale the image in each dimension in fullscreen mode
float myWidthScaleFactor, myHeightScaleFactor;
// Optional GL extensions that may increase performance // Optional GL extensions that may increase performance
bool myHaveTexRectEXT; bool myHaveTexRectEXT;
@ -185,7 +176,7 @@ class FrameBufferGL : public FrameBuffer
A surface suitable for OpenGL rendering mode. A surface suitable for OpenGL rendering mode.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBufferGL.hxx,v 1.65 2008-12-27 23:27:32 stephena Exp $ @version $Id: FrameBufferGL.hxx,v 1.66 2008-12-28 21:01:55 stephena Exp $
*/ */
class FBSurfaceGL : public FBSurface class FBSurfaceGL : public FBSurface
{ {
@ -215,6 +206,8 @@ class FBSurfaceGL : public FBSurface
void reload(); void reload();
private: private:
void setFilter(const string& name);
inline void* pixels() const { return myTexture->pixels; } inline void* pixels() const { return myTexture->pixels; }
inline uInt32 pitch() const { return myPitch; } inline uInt32 pitch() const { return myPitch; }
@ -231,15 +224,12 @@ class FBSurfaceGL : public FBSurface
SDL_Surface* myTexture; SDL_Surface* myTexture;
GLuint myTexID; GLuint myTexID;
GLenum myTexTarget;
GLsizei myTexWidth; GLsizei myTexWidth;
GLsizei myTexHeight; GLsizei myTexHeight;
GLfloat myTexCoord[4]; GLfloat myTexCoord[4];
GLenum myTexTarget; uInt32 myXOrig, myYOrig, myWidth, myHeight;
GLint myTexFilter;
uInt32 myXOrig, myYOrig;
uInt32 myWidth, myHeight;
bool mySurfaceIsDirty; bool mySurfaceIsDirty;
uInt32 myPitch; uInt32 myPitch;
}; };

View File

@ -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.cxx,v 1.85 2008-12-27 23:27:32 stephena Exp $ // $Id: FrameBufferSoft.cxx,v 1.86 2008-12-28 21:01:55 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -102,19 +102,32 @@ bool FrameBufferSoft::setVidMode(VideoMode& mode)
myFormat = myScreen->format; myFormat = myScreen->format;
myBytesPerPixel = myFormat->BytesPerPixel; myBytesPerPixel = myFormat->BytesPerPixel;
// Make sure drawMediaSource() knows which renderer to use
switch(myBytesPerPixel)
{
case 2: // 16-bit
myPitch = myScreen->pitch >> 1;
myRenderType = myUsePhosphor ? kPhosphor_16 : kSoftZoom_16;
break;
case 3: // 24-bit
myPitch = myScreen->pitch;
myRenderType = myUsePhosphor ? kPhosphor_24 : kSoftZoom_24;
break;
case 4: // 32-bit
myPitch = myScreen->pitch >> 2;
myRenderType = myUsePhosphor ? kPhosphor_32 : kSoftZoom_32;
break;
}
myBaseOffset = mode.image_y * myPitch + mode.image_x;
// If software mode can open the given screen, it will always be in the // If software mode can open the given screen, it will always be in the
// requested format, or not at all; we only update mode when the screen // requested format, or not at all; we only update mode when the screen
// is successfully created // is successfully created
mode.screen_w = myScreen->w; mode.screen_w = myScreen->w;
mode.screen_h = myScreen->h; mode.screen_h = myScreen->h;
myZoomLevel = mode.gfxmode.zoom; myZoomLevel = mode.gfxmode.zoom;
// FIXME - look at gfxmode directly // FIXME - look at gfxmode directly
// Make sure drawMediaSource() knows which renderer to use
stateChanged(myOSystem->eventHandler().state());
myBaseOffset = mode.image_y * myPitch + mode.image_x;
// 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
myRectList->start(); myRectList->start();
@ -376,11 +389,12 @@ void FrameBufferSoft::postFrameUpdate()
{ {
if(myTiaDirty && !myInUIMode) if(myTiaDirty && !myInUIMode)
{ {
SDL_Flip(myScreen); SDL_UpdateRect(myScreen, 0, 0, 0, 0);
myTiaDirty = false; myTiaDirty = false;
} }
else if(myRectList->numRects() > 0) else if(myRectList->numRects() > 0)
{ {
//myRectList->print(myScreen->w, myScreen->h);
SDL_UpdateRects(myScreen, myRectList->numRects(), myRectList->rects()); SDL_UpdateRects(myScreen, myRectList->numRects(), myRectList->rects());
} }
myRectList->start(); myRectList->start();
@ -392,37 +406,26 @@ void FrameBufferSoft::enablePhosphor(bool enable, int blend)
myUsePhosphor = enable; myUsePhosphor = enable;
myPhosphorBlend = blend; myPhosphorBlend = blend;
stateChanged(myOSystem->eventHandler().state()); // Make sure drawMediaSource() knows which renderer to use
switch(myBytesPerPixel)
{
case 2: // 16-bit
myRenderType = myUsePhosphor ? kPhosphor_16 : kSoftZoom_16;
break;
case 3: // 24-bit
myRenderType = myUsePhosphor ? kPhosphor_24 : kSoftZoom_24;
break;
case 4: // 32-bit
myRenderType = myUsePhosphor ? kPhosphor_32 : kSoftZoom_32;
break;
}
myRedrawEntireFrame = true;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSoft::stateChanged(EventHandler::State state) void FrameBufferSoft::stateChanged(EventHandler::State state)
{ {
if(!myScreen) myRedrawEntireFrame = true;
return;
myInUIMode = (state == EventHandler::S_LAUNCHER ||
state == EventHandler::S_DEBUGGER);
// Make sure drawMediaSource() knows which renderer to use
switch(myBytesPerPixel)
{
case 2: // 16-bit
myPitch = myScreen->pitch >> 1;
myRenderType = myUsePhosphor ? kPhosphor_16 : kSoftZoom_16;
break;
case 3: // 24-bit
myPitch = myScreen->pitch;
myRenderType = myUsePhosphor ? kPhosphor_24 : kSoftZoom_24;
break;
case 4: // 32-bit
myPitch = myScreen->pitch >> 2;
myRenderType = myUsePhosphor ? kPhosphor_32 : kSoftZoom_32;
break;
}
// Have the changes take effect
refresh();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -594,7 +597,7 @@ void FBSurfaceSoft::drawChar(const GUI::Font* font, uInt8 chr,
case 2: case 2:
{ {
// Get buffer position where upper-left pixel of the character will be drawn // Get buffer position where upper-left pixel of the character will be drawn
uInt16* buffer = (uInt16*) mySurface->pixels + uInt16* buffer = (uInt16*) mySurface->pixels + myBaseOffset +
(ty + desc.ascent - bby - bbh) * myPitch + (ty + desc.ascent - bby - bbh) * myPitch +
tx + bbx; tx + bbx;
@ -654,7 +657,7 @@ void FBSurfaceSoft::drawChar(const GUI::Font* font, uInt8 chr,
case 4: case 4:
{ {
// Get buffer position where upper-left pixel of the character will be drawn // Get buffer position where upper-left pixel of the character will be drawn
uInt32* buffer = (uInt32*) mySurface->pixels + uInt32* buffer = (uInt32*) mySurface->pixels + myBaseOffset +
(ty + desc.ascent - bby - bbh) * myPitch + (ty + desc.ascent - bby - bbh) * myPitch +
tx + bbx; tx + bbx;
@ -702,6 +705,8 @@ void FBSurfaceSoft::drawBitmap(uInt32* bitmap, Int32 tx, Int32 ty,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceSoft::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h) void FBSurfaceSoft::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
{ {
//cerr << " -> addDirtyRect: x = " << x << ", y = " << y << ", w = " << w << ", h = " << h << endl;
// Base surfaces use dirty-rectangle updates, since they can be quite // Base surfaces use dirty-rectangle updates, since they can be quite
// large, and updating the entire surface each frame would be too slow // large, and updating the entire surface each frame would be too slow
// Non-base surfaces are usually smaller, and can be updated entirely // Non-base surfaces are usually smaller, and can be updated entirely
@ -824,6 +829,9 @@ void FBSurfaceSoft::recalc()
} }
#if 0 #if 0
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSoft::drawSurface(const GUI::Surface* surface, Int32 x, Int32 y) void FrameBufferSoft::drawSurface(const GUI::Surface* surface, Int32 x, Int32 y)

View File

@ -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.58 2008-12-27 23:27:32 stephena Exp $ // $Id: FrameBufferSoft.hxx,v 1.59 2008-12-28 21:01:55 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_SOFT_HXX #ifndef FRAMEBUFFER_SOFT_HXX
@ -32,7 +32,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.58 2008-12-27 23:27:32 stephena Exp $ @version $Id: FrameBufferSoft.hxx,v 1.59 2008-12-28 21:01:55 stephena Exp $
*/ */
class FrameBufferSoft : public FrameBuffer class FrameBufferSoft : public FrameBuffer
{ {
@ -114,12 +114,6 @@ class FrameBufferSoft : public FrameBuffer
*/ */
FBSurface* createSurface(int w, int h, bool useBase = false) const; FBSurface* createSurface(int w, int h, bool useBase = false) const;
/**
Switches between the filtering options in software mode.
Currently, none exist.
*/
void toggleFilter() { /* No filter added yet */ }
/** /**
This method should be called anytime the MediaSource needs to be redrawn This method should be called anytime the MediaSource needs to be redrawn
to the screen (full indicating that a full redraw is required). to the screen (full indicating that a full redraw is required).
@ -172,7 +166,7 @@ class FrameBufferSoft : public FrameBuffer
A surface suitable for software rendering mode. A surface suitable for software rendering mode.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBufferSoft.hxx,v 1.58 2008-12-27 23:27:32 stephena Exp $ @version $Id: FrameBufferSoft.hxx,v 1.59 2008-12-28 21:01:55 stephena Exp $
*/ */
class FBSurfaceSoft : public FBSurface class FBSurfaceSoft : public FBSurface
{ {

View File

@ -13,10 +13,11 @@
// 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: RectList.cxx,v 1.4 2008-02-06 13:45:19 stephena Exp $ // $Id: RectList.cxx,v 1.5 2008-12-28 21:01:55 stephena Exp $
//============================================================================ //============================================================================
#include <SDL.h> #include <SDL.h>
#include "bspf.hxx"
#include "RectList.hxx" #include "RectList.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -74,3 +75,21 @@ void RectList::start()
{ {
currentRect = 0; currentRect = 0;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RectList::print(int boundWidth, int boundHeight)
{
cerr << "RectList: rects = " << numRects() << endl;
for(Uint32 i = 0; i < currentRect; ++i)
{
cerr << "Rect " << i << endl
<< " x = " << rectArray[i].x << endl
<< " y = " << rectArray[i].y << endl
<< " w = " << rectArray[i].w << endl
<< " h = " << rectArray[i].h << endl;
if((rectArray[i].x + rectArray[i].w) > boundWidth ||
(rectArray[i].y + rectArray[i].h) > boundHeight)
cerr << " TOO LARGE" << endl;
cerr << endl;
}
}

View File

@ -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: RectList.hxx,v 1.4 2008-02-06 13:45:19 stephena Exp $ // $Id: RectList.hxx,v 1.5 2008-12-28 21:01:55 stephena Exp $
//============================================================================ //============================================================================
#ifndef RECTLIST_HXX #ifndef RECTLIST_HXX
@ -24,7 +24,7 @@
class RectList class RectList
{ {
public: public:
RectList(Uint32 size = 512); RectList(Uint32 size = 256);
~RectList(); ~RectList();
void add(SDL_Rect* rect); void add(SDL_Rect* rect);
@ -32,6 +32,7 @@ class RectList
SDL_Rect* rects(); SDL_Rect* rects();
Uint32 numRects(); Uint32 numRects();
void start(); void start();
void print(int boundWidth, int boundHeight);
private: private:
Uint32 currentSize, currentRect; Uint32 currentSize, currentRect;

View File

@ -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.148 2008-12-27 23:27:32 stephena Exp $ // $Id: FrameBuffer.cxx,v 1.149 2008-12-28 21:01:55 stephena Exp $
//============================================================================ //============================================================================
#include <algorithm> #include <algorithm>
@ -60,7 +60,6 @@ FrameBuffer::~FrameBuffer(void)
// Free all allocated surfaces // Free all allocated surfaces
while(!mySurfaceList.empty()) while(!mySurfaceList.empty())
{ {
//cerr << " delete id = " << (*mySurfaceList.begin()).first << ", " << (*mySurfaceList.begin()).second << endl;
delete (*mySurfaceList.begin()).second; delete (*mySurfaceList.begin()).second;
mySurfaceList.erase(mySurfaceList.begin()); mySurfaceList.erase(mySurfaceList.begin());
} }
@ -88,8 +87,6 @@ bool FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height)
mySDLFlags = 0; mySDLFlags = 0;
#endif #endif
cerr << " <== FrameBuffer::initialize: w = " << width << ", h = " << height << endl;
// Set the available video modes for this framebuffer // Set the available video modes for this framebuffer
setAvailableVidModes(width, height); setAvailableVidModes(width, height);
@ -372,8 +369,6 @@ inline void FrameBuffer::drawMessage()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::refresh() void FrameBuffer::refresh()
{ {
cerr << "FrameBuffer::refresh() : " << myOSystem->eventHandler().state() << endl;
// This method partly duplicates the behaviour in ::update() // This method partly duplicates the behaviour in ::update()
// Here, however, make sure to redraw *all* surfaces applicable to the // Here, however, make sure to redraw *all* surfaces applicable to the
// current EventHandler state // current EventHandler state
@ -592,8 +587,8 @@ bool FrameBuffer::changeVidMode(int direction)
if(saveModeChange) if(saveModeChange)
myOSystem->settings().setString("tia_filter", vidmode.gfxmode.name); myOSystem->settings().setString("tia_filter", vidmode.gfxmode.name);
myOSystem->eventHandler().handleResizeEvent(); myOSystem->eventHandler().handleResizeEvent(); // FIXME - this may no longer be required
refresh(); // _FIXME myOSystem->eventHandler().refreshDisplay(true); refresh();
} }
else else
return false; return false;

View File

@ -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.hxx,v 1.108 2008-12-27 23:27:32 stephena Exp $ // $Id: FrameBuffer.hxx,v 1.109 2008-12-28 21:01:55 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_HXX #ifndef FRAMEBUFFER_HXX
@ -91,7 +91,7 @@ enum {
turn drawn here as well. turn drawn here as well.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.108 2008-12-27 23:27:32 stephena Exp $ @version $Id: FrameBuffer.hxx,v 1.109 2008-12-28 21:01:55 stephena Exp $
*/ */
class FrameBuffer class FrameBuffer
{ {
@ -365,11 +365,6 @@ class FrameBuffer
*/ */
virtual FBSurface* createSurface(int w, int h, bool useBase = false) const = 0; virtual FBSurface* createSurface(int w, int h, bool useBase = false) const = 0;
/**
Switches between the filtering options in the video subsystem.
*/
virtual void toggleFilter() = 0;
/** /**
This method should be called anytime the MediaSource needs to be redrawn This method should be called anytime the MediaSource needs to be redrawn
to the screen (full indicating that a full redraw is required). to the screen (full indicating that a full redraw is required).
@ -549,7 +544,7 @@ class FrameBuffer
FrameBuffer type. FrameBuffer type.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.108 2008-12-27 23:27:32 stephena Exp $ @version $Id: FrameBuffer.hxx,v 1.109 2008-12-28 21:01:55 stephena Exp $
*/ */
// Text alignment modes for drawString() // Text alignment modes for drawString()
enum TextAlignment { enum TextAlignment {

View File

@ -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: Settings.cxx,v 1.149 2008-07-22 14:54:39 stephena Exp $ // $Id: Settings.cxx,v 1.150 2008-12-28 21:01:55 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -41,7 +41,7 @@ Settings::Settings(OSystem* osystem)
// OpenGL specific options // OpenGL specific options
setInternal("gl_filter", "nearest"); setInternal("gl_filter", "nearest");
setInternal("gl_aspect", "100"); setInternal("gl_aspect", "100");
setInternal("gl_fsmax", "never"); setInternal("gl_fsmax", "false");
setInternal("gl_lib", "libGL.so"); setInternal("gl_lib", "libGL.so");
setInternal("gl_vsync", "false"); setInternal("gl_vsync", "false");
setInternal("gl_texrect", "false"); setInternal("gl_texrect", "false");
@ -226,10 +226,6 @@ void Settings::validate()
i = getInt("gl_aspect"); i = getInt("gl_aspect");
if(i < 50 || i > 100) if(i < 50 || i > 100)
setInternal("gl_aspect", "100"); setInternal("gl_aspect", "100");
s = getString("gl_fsmax");
if(s != "never" && s != "ui" && s != "tia" && s != "always")
setInternal("gl_fsmax", "never");
#endif #endif
#ifdef SOUND_SUPPORT #ifdef SOUND_SUPPORT
@ -287,8 +283,7 @@ void Settings::usage()
<< " nearest Normal scaling (GL_NEAREST)\n" << " nearest Normal scaling (GL_NEAREST)\n"
<< " linear Blurred scaling (GL_LINEAR)\n" << " linear Blurred scaling (GL_LINEAR)\n"
<< " -gl_aspect <number> Scale the width by the given percentage\n" << " -gl_aspect <number> Scale the width by the given percentage\n"
<< " -gl_fsmax <never|always| Stretch GL image in fullscreen mode\n" << " -gl_fsmax <1|0> Stretch GL image in fullscreen emulation mode\n"
<< " ui|tia\n"
<< " -gl_vsync <1|0> Enable synchronize to vertical blank interrupt\n" << " -gl_vsync <1|0> Enable synchronize to vertical blank interrupt\n"
<< " -gl_texrect <1|0> Enable GL_TEXTURE_RECTANGLE extension\n" << " -gl_texrect <1|0> Enable GL_TEXTURE_RECTANGLE extension\n"
<< endl << endl

View File

@ -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: Dialog.cxx,v 1.72 2008-12-27 23:27:32 stephena Exp $ // $Id: Dialog.cxx,v 1.73 2008-12-28 21:01:55 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -249,7 +249,7 @@ void Dialog::drawDialog()
if(_dirty) if(_dirty)
{ {
cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl; // cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl;
s.fillRect(_x+1, _y+1, _w-2, _h-2, kDlgColor); s.fillRect(_x+1, _y+1, _w-2, _h-2, kDlgColor);
s.box(_x, _y, _w, _h, kColor, kShadowColor); s.box(_x, _y, _w, _h, kColor, kShadowColor);

View File

@ -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: DialogContainer.cxx,v 1.50 2008-12-27 23:27:32 stephena Exp $ // $Id: DialogContainer.cxx,v 1.51 2008-12-28 21:01:55 stephena Exp $
//============================================================================ //============================================================================
#include "OSystem.hxx" #include "OSystem.hxx"
@ -28,8 +28,7 @@
DialogContainer::DialogContainer(OSystem* osystem) DialogContainer::DialogContainer(OSystem* osystem)
: myOSystem(osystem), : myOSystem(osystem),
myBaseDialog(NULL), myBaseDialog(NULL),
myTime(0), myTime(0)
myRefreshFlag(false)
{ {
reset(); reset();
} }
@ -98,7 +97,6 @@ void DialogContainer::draw(bool full)
myDialogStack[i]->setDirty(); myDialogStack[i]->setDirty();
myDialogStack[i]->drawDialog(); myDialogStack[i]->drawDialog();
} }
myRefreshFlag = false;
} }
else if(!myDialogStack.empty()) else if(!myDialogStack.empty())
{ {
@ -109,7 +107,6 @@ void DialogContainer::draw(bool full)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DialogContainer::addDialog(Dialog* d) void DialogContainer::addDialog(Dialog* d)
{ {
cerr << "DialogContainer::addDialog : w = " << d->getWidth() << ", h = " << d->getHeight() << endl;
myDialogStack.push(d); myDialogStack.push(d);
d->open(); d->open();

View File

@ -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: DialogContainer.hxx,v 1.25 2008-12-27 23:27:32 stephena Exp $ // $Id: DialogContainer.hxx,v 1.26 2008-12-28 21:01:55 stephena Exp $
//============================================================================ //============================================================================
#ifndef DIALOG_CONTAINER_HXX #ifndef DIALOG_CONTAINER_HXX
@ -36,7 +36,7 @@ class OSystem;
a stack, and handles their events. a stack, and handles their events.
@author Stephen Anthony @author Stephen Anthony
@version $Id: DialogContainer.hxx,v 1.25 2008-12-27 23:27:32 stephena Exp $ @version $Id: DialogContainer.hxx,v 1.26 2008-12-28 21:01:55 stephena Exp $
*/ */
class DialogContainer class DialogContainer
{ {
@ -143,11 +143,6 @@ class DialogContainer
*/ */
void reStack(); void reStack();
/**
Redraw all dialogs on the stack.
*/
void refresh() { myRefreshFlag = true; }
/** /**
Return the bottom-most dialog of this container. Return the bottom-most dialog of this container.
*/ */
@ -171,9 +166,6 @@ class DialogContainer
// Indicates the most current time (in milliseconds) as set by updateTime() // Indicates the most current time (in milliseconds) as set by updateTime()
int myTime; int myTime;
// Indicates a full refresh of all dialogs is required
bool myRefreshFlag;
// For continuous 'key down' events // For continuous 'key down' events
struct { struct {
int ascii; int ascii;

View File

@ -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: OptionsDialog.cxx,v 1.74 2008-12-26 21:39:17 stephena Exp $ // $Id: OptionsDialog.cxx,v 1.75 2008-12-28 21:01:55 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -119,7 +119,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent,
int x = 0, y = 0, w, h; int x = 0, y = 0, w, h;
// Now create all the dialogs attached to each menu button // Now create all the dialogs attached to each menu button
w = 410; h = 300; w = 410; h = 275;
myVideoDialog = new VideoDialog(osystem, parent, font, x, y, w, h); myVideoDialog = new VideoDialog(osystem, parent, font, x, y, w, h);
w = 285; h = 200; w = 285; h = 200;

View File

@ -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: RomInfoWidget.cxx,v 1.9 2008-06-19 12:01:31 stephena Exp $ // $Id: RomInfoWidget.cxx,v 1.10 2008-12-28 21:01:55 stephena Exp $
//============================================================================ //============================================================================
#include <cstring> #include <cstring>
@ -68,6 +68,7 @@ void RomInfoWidget::loadConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomInfoWidget::setProperties(const Properties& props) void RomInfoWidget::setProperties(const Properties& props)
{ {
return;
myHaveProperties = true; myHaveProperties = true;
myProperties = props; myProperties = props;
@ -82,6 +83,7 @@ void RomInfoWidget::setProperties(const Properties& props)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomInfoWidget::clearProperties() void RomInfoWidget::clearProperties()
{ {
return;
myHaveProperties = myDrawSurface = false; myHaveProperties = myDrawSurface = false;
// Decide whether the information should be shown immediately // Decide whether the information should be shown immediately

View File

@ -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: VideoDialog.cxx,v 1.57 2008-12-26 21:39:17 stephena Exp $ // $Id: VideoDialog.cxx,v 1.58 2008-12-28 21:01:55 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -109,18 +109,6 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
wid.push_back(myGLFilterPopup); wid.push_back(myGLFilterPopup);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// GL FS stretch
items.clear();
items.push_back("Never", "never");
items.push_back("UI mode", "ui");
items.push_back("TIA mode", "tia");
items.push_back("Always", "always");
myGLStretchPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight,
items, "GL Stretch: ", lwidth);
wid.push_back(myGLStretchPopup);
ypos += lineHeight + 4;
// GL aspect ratio // GL aspect ratio
myAspectRatioSlider = myAspectRatioSlider =
new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight, new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight,
@ -160,6 +148,12 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
wid.push_back(myColorLossCheckbox); wid.push_back(myColorLossCheckbox);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// GL FS stretch
myGLStretchCheckbox = new CheckboxWidget(this, font, xpos, ypos,
"GL FS Stretch");
wid.push_back(myGLStretchCheckbox);
ypos += lineHeight + 4;
// Use sync to vblank in OpenGL // Use sync to vblank in OpenGL
myUseVSyncCheckbox = new CheckboxWidget(this, font, xpos, ypos, myUseVSyncCheckbox = new CheckboxWidget(this, font, xpos, ypos,
"GL VSync"); "GL VSync");
@ -190,9 +184,9 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
// Disable certain functions when we know they aren't present // Disable certain functions when we know they aren't present
#ifndef DISPLAY_GL #ifndef DISPLAY_GL
myGLFilterPopup->clearFlags(WIDGET_ENABLED); myGLFilterPopup->clearFlags(WIDGET_ENABLED);
myGLStretchPopup->clearFlags(WIDGET_ENABLED);
myAspectRatioSlider->clearFlags(WIDGET_ENABLED); myAspectRatioSlider->clearFlags(WIDGET_ENABLED);
myAspectRatioLabel->clearFlags(WIDGET_ENABLED); myAspectRatioLabel->clearFlags(WIDGET_ENABLED);
myGLStretchCheckbox->clearFlags(WIDGET_ENABLED);
myUseVSyncCheckbox->clearFlags(WIDGET_ENABLED); myUseVSyncCheckbox->clearFlags(WIDGET_ENABLED);
#endif #endif
#ifndef WINDOWED_SUPPORT #ifndef WINDOWED_SUPPORT
@ -242,11 +236,6 @@ void VideoDialog::loadConfig()
instance().settings().getString("gl_filter"), "linear"); instance().settings().getString("gl_filter"), "linear");
myGLFilterPopup->setEnabled(gl); myGLFilterPopup->setEnabled(gl);
// GL stretch setting
myGLStretchPopup->setSelected(
instance().settings().getString("gl_fsmax"), "never");
myGLStretchPopup->setEnabled(gl);
// GL aspect ratio setting // GL aspect ratio setting
myAspectRatioSlider->setValue(instance().settings().getInt("gl_aspect")); myAspectRatioSlider->setValue(instance().settings().getInt("gl_aspect"));
myAspectRatioSlider->setEnabled(gl); myAspectRatioSlider->setEnabled(gl);
@ -267,6 +256,9 @@ void VideoDialog::loadConfig()
// PAL color-loss effect // PAL color-loss effect
myColorLossCheckbox->setState(instance().settings().getBool("colorloss")); myColorLossCheckbox->setState(instance().settings().getBool("colorloss"));
// GL stretch setting (item is enabled/disabled in ::handleFullscreenChange)
myGLStretchCheckbox->setState(instance().settings().getBool("gl_fsmax"));
// Use sync to vertical blank (GL mode only) // Use sync to vertical blank (GL mode only)
myUseVSyncCheckbox->setState(instance().settings().getBool("gl_vsync")); myUseVSyncCheckbox->setState(instance().settings().getBool("gl_vsync"));
myUseVSyncCheckbox->setEnabled(gl); myUseVSyncCheckbox->setEnabled(gl);
@ -293,9 +285,6 @@ void VideoDialog::saveConfig()
// GL Filter setting // GL Filter setting
instance().settings().setString("gl_filter", myGLFilterPopup->getSelectedTag()); instance().settings().setString("gl_filter", myGLFilterPopup->getSelectedTag());
// GL stretch setting
instance().settings().setString("gl_fsmax", myGLStretchPopup->getSelectedTag());
// GL aspect ratio setting // GL aspect ratio setting
instance().settings().setString("gl_aspect", myAspectRatioLabel->getLabel()); instance().settings().setString("gl_aspect", myAspectRatioLabel->getLabel());
@ -315,6 +304,9 @@ void VideoDialog::saveConfig()
// PAL color-loss effect // PAL color-loss effect
instance().settings().setBool("colorloss", myColorLossCheckbox->getState()); instance().settings().setBool("colorloss", myColorLossCheckbox->getState());
// GL stretch setting
instance().settings().setBool("gl_fsmax", myGLStretchCheckbox->getState());
// Use sync to vertical blank (GL mode only) // Use sync to vertical blank (GL mode only)
instance().settings().setBool("gl_vsync", myUseVSyncCheckbox->getState()); instance().settings().setBool("gl_vsync", myUseVSyncCheckbox->getState());
@ -338,7 +330,6 @@ void VideoDialog::setDefaults()
myTIAPalettePopup->setSelected("standard", ""); myTIAPalettePopup->setSelected("standard", "");
myFSResPopup->setSelected("auto", ""); myFSResPopup->setSelected("auto", "");
myGLFilterPopup->setSelected("linear", ""); myGLFilterPopup->setSelected("linear", "");
myGLStretchPopup->setSelected("never", "");
myAspectRatioSlider->setValue(100); myAspectRatioSlider->setValue(100);
myAspectRatioLabel->setLabel("100"); myAspectRatioLabel->setLabel("100");
myFrameRateSlider->setValue(0); myFrameRateSlider->setValue(0);
@ -346,6 +337,7 @@ void VideoDialog::setDefaults()
myFullscreenCheckbox->setState(false); myFullscreenCheckbox->setState(false);
myColorLossCheckbox->setState(false); myColorLossCheckbox->setState(false);
myGLStretchCheckbox->setState(false);
myUseVSyncCheckbox->setState(true); myUseVSyncCheckbox->setState(true);
myCenterCheckbox->setState(true); myCenterCheckbox->setState(true);
@ -359,6 +351,10 @@ void VideoDialog::handleFullscreenChange(bool enable)
#ifdef WINDOWED_SUPPORT #ifdef WINDOWED_SUPPORT
myFSResPopup->setEnabled(enable); myFSResPopup->setEnabled(enable);
// GL stretch is only enabled in OpenGL mode
myGLStretchCheckbox->setEnabled(
enable && instance().frameBuffer().type() == kGLBuffer);
_dirty = true; _dirty = true;
#endif #endif
} }

View File

@ -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: VideoDialog.hxx,v 1.25 2008-12-26 21:39:17 stephena Exp $ // $Id: VideoDialog.hxx,v 1.26 2008-12-28 21:01:55 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -56,7 +56,6 @@ class VideoDialog : public Dialog
PopUpWidget* myTIAPalettePopup; PopUpWidget* myTIAPalettePopup;
PopUpWidget* myFSResPopup; PopUpWidget* myFSResPopup;
PopUpWidget* myGLFilterPopup; PopUpWidget* myGLFilterPopup;
PopUpWidget* myGLStretchPopup;
SliderWidget* myAspectRatioSlider; SliderWidget* myAspectRatioSlider;
StaticTextWidget* myAspectRatioLabel; StaticTextWidget* myAspectRatioLabel;
@ -64,6 +63,7 @@ class VideoDialog : public Dialog
StaticTextWidget* myFrameRateLabel; StaticTextWidget* myFrameRateLabel;
CheckboxWidget* myFullscreenCheckbox; CheckboxWidget* myFullscreenCheckbox;
CheckboxWidget* myColorLossCheckbox; CheckboxWidget* myColorLossCheckbox;
CheckboxWidget* myGLStretchCheckbox;
CheckboxWidget* myUseVSyncCheckbox; CheckboxWidget* myUseVSyncCheckbox;
CheckboxWidget* myCenterCheckbox; CheckboxWidget* myCenterCheckbox;