Fixed inconsistent Alt-p phosphor behaviour (fixes #196).

This commit is contained in:
Stephen Anthony 2017-08-19 19:48:41 -02:30
parent a9dd2b32cb
commit 6e55d98ad7
3 changed files with 10 additions and 14 deletions

View File

@ -424,32 +424,26 @@ void Console::setPalette(const string& type)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::togglePhosphor()
{
const string& phosphor = myProperties.get(Display_Phosphor);
int blend = atoi(myProperties.get(Display_PPBlend).c_str());
bool enable;
if(phosphor == "YES")
if(myOSystem.frameBuffer().tiaSurface().phosphorEnabled())
{
myProperties.set(Display_Phosphor, "No");
enable = false;
myOSystem.frameBuffer().tiaSurface().enablePhosphor(false);
myOSystem.frameBuffer().showMessage("Phosphor effect disabled");
}
else
{
myProperties.set(Display_Phosphor, "Yes");
enable = true;
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true);
myOSystem.frameBuffer().showMessage("Phosphor effect enabled");
}
myOSystem.frameBuffer().tiaSurface().enablePhosphor(enable, blend);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changePhosphor(int direction)
{
bool enable = myProperties.get(Display_Phosphor) == "YES";
int blend = atoi(myProperties.get(Display_PPBlend).c_str());
if(enable)
if(myOSystem.frameBuffer().tiaSurface().phosphorEnabled())
{
if(direction == +1) // increase blend
{
@ -478,7 +472,7 @@ void Console::changePhosphor(int direction)
val << blend;
myProperties.set(Display_PPBlend, val.str());
myOSystem.frameBuffer().showMessage("Phosphor blend " + val.str());
myOSystem.frameBuffer().tiaSurface().enablePhosphor(enable, blend);
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true, blend);
}
else
myOSystem.frameBuffer().showMessage("Phosphor effect disabled");

View File

@ -232,7 +232,8 @@ void TIASurface::enableScanlineInterpolation(bool enable)
void TIASurface::enablePhosphor(bool enable, int blend)
{
myUsePhosphor = enable;
myPhosphorPercent = blend / 100.0;
if(blend >= 0)
myPhosphorPercent = blend / 100.0;
myFilter = Filter(enable ? uInt8(myFilter) | 0x01 : uInt8(myFilter) & 0x10);
myTiaSurface->setDirty();

View File

@ -109,9 +109,10 @@ class TIASurface
void enableScanlineInterpolation(bool enable);
/**
Enable/disable phosphor effect.
Enable/disable/query phosphor effect.
*/
void enablePhosphor(bool enable, int blend);
void enablePhosphor(bool enable, int blend = -1);
bool phosphorEnabled() const { return myUsePhosphor; }
/**
Used to calculate an averaged color for the 'phosphor' effect.