Windows Port: Replace the backlight kludge in the DirectDraw display method with the new ColorspaceApplyIntensityToBuffer32(). (Related to commits f5c9a36
, 3a000b6
and 74ba49e.)
- Also fixes a build problem in MSVC. (Regression from commit 74ba49e.)
This commit is contained in:
parent
74ba49e168
commit
a3a577f2e9
|
@ -1985,18 +1985,10 @@ static void DoDisplay(bool firstTime)
|
|||
if(ddhw || ddsw)
|
||||
{
|
||||
const NDSDisplayInfo &displayInfo = GPU->GetDisplayInfo();
|
||||
const size_t pixCount = displayInfo.customWidth * displayInfo.customHeight;
|
||||
|
||||
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);
|
||||
}
|
||||
ColorspaceApplyIntensityToBuffer32<false, false>(video.buffer, pixCount, displayInfo.backlightIntensity[NDSDisplayID_Main]);
|
||||
ColorspaceApplyIntensityToBuffer32<false, false>(video.buffer + pixCount, pixCount, displayInfo.backlightIntensity[NDSDisplayID_Touch]);
|
||||
}
|
||||
|
||||
if(firstTime)
|
||||
|
|
|
@ -601,14 +601,15 @@ void ColorspaceApplyIntensityToBuffer16(u16 *dst, size_t pixCount, float intensi
|
|||
}
|
||||
}
|
||||
|
||||
#pragma LOOPVECTORIZE_DISABLE
|
||||
|
||||
#endif // USEMANUALVECTORIZATION
|
||||
|
||||
if (intensity > 0.999f)
|
||||
{
|
||||
if (SWAP_RB)
|
||||
{
|
||||
#ifdef USEMANUALVECTORIZATION
|
||||
#pragma LOOPVECTORIZE_DISABLE
|
||||
#endif
|
||||
for (; i < pixCount; i++)
|
||||
{
|
||||
dst[i] = COLOR5551_SWAP_RB(dst[i]);
|
||||
|
@ -619,6 +620,9 @@ void ColorspaceApplyIntensityToBuffer16(u16 *dst, size_t pixCount, float intensi
|
|||
}
|
||||
else if (intensity < 0.001f)
|
||||
{
|
||||
#ifdef USEMANUALVECTORIZATION
|
||||
#pragma LOOPVECTORIZE_DISABLE
|
||||
#endif
|
||||
for (; i < pixCount; i++)
|
||||
{
|
||||
dst[i] = dst[i] & 0x8000;
|
||||
|
@ -628,7 +632,9 @@ void ColorspaceApplyIntensityToBuffer16(u16 *dst, size_t pixCount, float intensi
|
|||
}
|
||||
|
||||
const u16 intensity_u16 = (u16)(intensity * (float)(0xFFFF));
|
||||
|
||||
#ifdef USEMANUALVECTORIZATION
|
||||
#pragma LOOPVECTORIZE_DISABLE
|
||||
#endif
|
||||
for (; i < pixCount; i++)
|
||||
{
|
||||
u16 outColor = (SWAP_RB) ? COLOR5551_SWAP_RB(dst[i]) : dst[i];
|
||||
|
@ -680,14 +686,15 @@ void ColorspaceApplyIntensityToBuffer32(u32 *dst, size_t pixCount, float intensi
|
|||
}
|
||||
}
|
||||
|
||||
#pragma LOOPVECTORIZE_DISABLE
|
||||
|
||||
#endif // USEMANUALVECTORIZATION
|
||||
|
||||
if (intensity > 0.999f)
|
||||
{
|
||||
if (SWAP_RB)
|
||||
{
|
||||
#ifdef USEMANUALVECTORIZATION
|
||||
#pragma LOOPVECTORIZE_DISABLE
|
||||
#endif
|
||||
for (; i < pixCount; i++)
|
||||
{
|
||||
FragmentColor dstColor;
|
||||
|
@ -703,6 +710,9 @@ void ColorspaceApplyIntensityToBuffer32(u32 *dst, size_t pixCount, float intensi
|
|||
}
|
||||
else if (intensity < 0.001f)
|
||||
{
|
||||
#ifdef USEMANUALVECTORIZATION
|
||||
#pragma LOOPVECTORIZE_DISABLE
|
||||
#endif
|
||||
for (; i < pixCount; i++)
|
||||
{
|
||||
dst[i] = dst[i] & 0xFF000000;
|
||||
|
@ -715,6 +725,9 @@ void ColorspaceApplyIntensityToBuffer32(u32 *dst, size_t pixCount, float intensi
|
|||
|
||||
if (SWAP_RB)
|
||||
{
|
||||
#ifdef USEMANUALVECTORIZATION
|
||||
#pragma LOOPVECTORIZE_DISABLE
|
||||
#endif
|
||||
for (; i < pixCount; i++)
|
||||
{
|
||||
FragmentColor dstColor;
|
||||
|
@ -728,6 +741,9 @@ void ColorspaceApplyIntensityToBuffer32(u32 *dst, size_t pixCount, float intensi
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef USEMANUALVECTORIZATION
|
||||
#pragma LOOPVECTORIZE_DISABLE
|
||||
#endif
|
||||
for (; i < pixCount; i++)
|
||||
{
|
||||
FragmentColor &outColor = (FragmentColor &)dst[i];
|
||||
|
|
Loading…
Reference in New Issue