re #59 - abuse accelerated masterbrightness processor to crudely implement LCD backlight for DD display methods
This commit is contained in:
parent
f5c9a36930
commit
3a000b68fd
|
@ -1969,6 +1969,9 @@ static void DoDisplay(bool firstTime)
|
||||||
{
|
{
|
||||||
Lock lock (win_backbuffer_sync);
|
Lock lock (win_backbuffer_sync);
|
||||||
|
|
||||||
|
bool ddhw = (GetStyle()&DWS_DDRAW_HW)!=0;
|
||||||
|
bool ddsw = (GetStyle()&DWS_DDRAW_SW)!=0;
|
||||||
|
|
||||||
if(displayPostponeType && !displayNoPostponeNext && (displayPostponeType < 0 || timeGetTime() < displayPostponeUntil))
|
if(displayPostponeType && !displayNoPostponeNext && (displayPostponeType < 0 || timeGetTime() < displayPostponeUntil))
|
||||||
return;
|
return;
|
||||||
displayNoPostponeNext = false;
|
displayNoPostponeNext = false;
|
||||||
|
@ -1979,6 +1982,23 @@ static void DoDisplay(bool firstTime)
|
||||||
else
|
else
|
||||||
ColorspaceConvertBuffer888XTo8888Opaque<true, false>((u32*)video.srcBuffer, video.buffer, video.srcBufferSize / 4);
|
ColorspaceConvertBuffer888XTo8888Opaque<true, false>((u32*)video.srcBuffer, video.buffer, video.srcBufferSize / 4);
|
||||||
|
|
||||||
|
if(ddhw || ddsw)
|
||||||
|
{
|
||||||
|
const NDSDisplayInfo &displayInfo = GPU->GetDisplayInfo();
|
||||||
|
|
||||||
|
for(int screen=0;screen<2;screen++)
|
||||||
|
{
|
||||||
|
const GLfloat backlightIntensity = displayInfo.backlightIntensity[screen];
|
||||||
|
if(backlightIntensity == 1.0f) continue;
|
||||||
|
|
||||||
|
//abuse accelerated masterbrightness algorithm for this
|
||||||
|
const int factor = 16-backlightIntensity*16;
|
||||||
|
const u32 screenSize = 256*video.prescaleHD*192*video.prescaleHD;
|
||||||
|
u32* dst = video.buffer + screenSize*screen;
|
||||||
|
GPU->GetEngineMain()->ApplyMasterBrightness<NDSColorFormat_BGR888_Rev,false>(dst,screenSize,GPUMasterBrightMode_Down,(u8)factor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(firstTime)
|
if(firstTime)
|
||||||
{
|
{
|
||||||
//on single core systems, draw straight to the screen
|
//on single core systems, draw straight to the screen
|
||||||
|
@ -2016,9 +2036,8 @@ static void DoDisplay(bool firstTime)
|
||||||
aggDraw.hud->clear();
|
aggDraw.hud->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hw = (GetStyle()&DWS_DDRAW_HW)!=0;
|
|
||||||
bool sw = (GetStyle()&DWS_DDRAW_SW)!=0;
|
if(ddhw || ddsw)
|
||||||
if(hw || sw)
|
|
||||||
{
|
{
|
||||||
gldisplay.kill();
|
gldisplay.kill();
|
||||||
DD_DoDisplay();
|
DD_DoDisplay();
|
||||||
|
|
Loading…
Reference in New Issue