abort of masterbrightness calculation if manipulation factor is 0

This commit is contained in:
mightymax 2007-01-10 13:04:39 +00:00
parent 9a65ce5c07
commit f75f24b53d
1 changed files with 7 additions and 0 deletions

View File

@ -403,6 +403,9 @@ static INLINE void GPU_ligne(Screen * screen, u16 l)
// Apply final brightness adjust (MASTER_BRIGHT) // Apply final brightness adjust (MASTER_BRIGHT)
// Reference: http://nocash.emubase.de/gbatek.htm#dsvideo (Under MASTER_BRIGHTNESS) // Reference: http://nocash.emubase.de/gbatek.htm#dsvideo (Under MASTER_BRIGHTNESS)
/* Mightymax> it should be more effective if the windowmanager applies brightness when drawing */
/* it will most likly take acceleration, while we are stuck here with CPU power */
switch ((gpu->MASTER_BRIGHT>>14)&3) switch ((gpu->MASTER_BRIGHT>>14)&3)
{ {
// Disabled // Disabled
@ -415,6 +418,8 @@ static INLINE void GPU_ligne(Screen * screen, u16 l)
unsigned int masterBrightFactor = gpu->MASTER_BRIGHT&31; unsigned int masterBrightFactor = gpu->MASTER_BRIGHT&31;
masterBrightFactor = masterBrightFactor > 16 ? 16 : masterBrightFactor; masterBrightFactor = masterBrightFactor > 16 ? 16 : masterBrightFactor;
if (!masterBrightFactor) break ; /* when we wont do anything, we dont need to loop */
for(i16 = 0; i16 < 256; ++i16) for(i16 = 0; i16 < 256; ++i16)
{ {
COLOR dstColor; COLOR dstColor;
@ -446,6 +451,8 @@ static INLINE void GPU_ligne(Screen * screen, u16 l)
unsigned int masterBrightFactor = gpu->MASTER_BRIGHT&31; unsigned int masterBrightFactor = gpu->MASTER_BRIGHT&31;
masterBrightFactor = masterBrightFactor > 16 ? 16 : masterBrightFactor; masterBrightFactor = masterBrightFactor > 16 ? 16 : masterBrightFactor;
if (!masterBrightFactor) break ; /* when we wont do anything, we dont need to loop */
for(i16 = 0; i16 < 256; ++i16) for(i16 = 0; i16 < 256; ++i16)
{ {
COLOR dstColor; COLOR dstColor;