Fixed bug in text rendering when switching between fullscreen and windowed

mode in software mode.  This error is pretty serious; I'm surprised nobody
reported it before.  I'm probably going to do a 3.0.1 release just to
address this.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1938 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-02-11 23:26:07 +00:00
parent c12a2e6043
commit c9e1735527
2 changed files with 11 additions and 9 deletions

View File

@ -135,6 +135,10 @@ bool FrameBufferSoft::setVidMode(VideoMode& mode)
// a different sized screen // a different sized screen
myRectList->start(); myRectList->start();
// Any previously allocated surfaces have probably changed as well,
// so we should refresh them
resetSurfaces();
return true; return true;
} }
@ -534,7 +538,7 @@ FBSurfaceSoft::FBSurfaceSoft(const FrameBufferSoft& buffer, SDL_Surface* surface
myXOffset(0), myXOffset(0),
myYOffset(0) myYOffset(0)
{ {
recalc(); reload();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -648,14 +652,14 @@ void FBSurfaceSoft::drawChar(const GUI::Font* font, uInt8 chr,
uInt8* buf_ptr = buffer; uInt8* buf_ptr = buffer;
for(int x = 0; x < bbw; x++, mask >>= 1) for(int x = 0; x < bbw; x++, mask >>= 1)
{ {
if(ptr & mask) if(ptr & mask)
{ {
*buf_ptr++ = a; *buf_ptr++ = b; *buf_ptr++ = c; *buf_ptr++ = a; *buf_ptr++ = b; *buf_ptr++ = c;
} }
else else
buf_ptr += 3; buf_ptr += 3;
} }
} }
break; break;
} }
@ -663,7 +667,6 @@ void FBSurfaceSoft::drawChar(const GUI::Font* font, uInt8 chr,
{ {
// 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*)getBasePtr(tx + bbx, ty + desc.ascent - bby - bbh); uInt32* buffer = (uInt32*)getBasePtr(tx + bbx, ty + desc.ascent - bby - bbh);
for(int y = 0; y < bbh; y++, buffer += myPitch) for(int y = 0; y < bbh; y++, buffer += myPitch)
{ {
const uInt16 ptr = *tmp++; const uInt16 ptr = *tmp++;
@ -839,7 +842,7 @@ void FBSurfaceSoft::update()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceSoft::recalc() void FBSurfaceSoft::reload()
{ {
switch(mySurface->format->BytesPerPixel) switch(mySurface->format->BytesPerPixel)
{ {

View File

@ -204,10 +204,9 @@ class FBSurfaceSoft : public FBSurface
void translateCoords(Int32& x, Int32& y) const; void translateCoords(Int32& x, Int32& y) const;
void update(); void update();
void free() { } // Not required for software mode void free() { } // Not required for software mode
void reload() { } // Not required for software mode void reload();
private: private:
void recalc();
inline void* getBasePtr(uInt32 x, uInt32 y) { inline void* getBasePtr(uInt32 x, uInt32 y) {
return static_cast<void *>(static_cast<uInt8*>(mySurface->pixels) + return static_cast<void *>(static_cast<uInt8*>(mySurface->pixels) +
(myYOffset + y) * mySurface->pitch + (myXOffset + x) * (myYOffset + y) * mySurface->pitch + (myXOffset + x) *