From a266b8239d71587217e9ab11b00c8f9c0aba83f8 Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 3 Jul 2009 18:01:59 +0000 Subject: [PATCH] gpu: fix a couple of obj final pixel rendering regressions --- desmume/src/GPU.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp index bd700c10a..6b552f473 100644 --- a/desmume/src/GPU.cpp +++ b/desmume/src/GPU.cpp @@ -752,7 +752,7 @@ void SetupFinalPixelBlitter (GPU *gpu) } -/* Sets up LCD control variables for Display Engines A and B for quick reading */ +//Sets up LCD control variables for Display Engines A and B for quick reading void GPU_setVideoProp(GPU * gpu, u32 p) { struct _DISPCNT * cnt; @@ -1105,23 +1105,26 @@ static void _master_setFinalOBJColor(GPU *gpu, u32 passing, u8 *dst, u16 color, return; } - //note that the fadein and fadeout is done here before blending, - //so that a fade and blending can be applied at the same time - bool forceBlendingForNormal = false; - if(windowEffect) - switch(FUNC) - { - case Increase: color = fadeInColors[gpu->BLDY_EVY][color&0x7FFF]; break; - case Decrease: color = fadeOutColors[gpu->BLDY_EVY][color&0x7FFF]; break; - - //only when blend color effect is selected, ordinarily opaque sprites are blended with the color effect params - case Blend: forceBlendingForNormal = (gpu->BLDCNT & 0x10)!=0; break; - } - //this inspects the layer beneath the sprite to see if the current blend flags make it a candidate for blending int bg_under = gpu->bgPixels[x]; bool allowBlend = ((bg_under != 4) && (gpu->BLDCNT & (0x100 << bg_under))); + bool sourceEffectSelected = (gpu->BLDCNT & 0x10)!=0; + + //note that the fadein and fadeout is done here before blending, + //so that a fade and blending can be applied at the same time + bool forceBlendingForNormal = false; + if(windowEffect && sourceEffectSelected) + switch(FUNC) + { + case Increase: if(!allowBlend) color = fadeInColors[gpu->BLDY_EVY][color&0x7FFF]; break; + case Decrease: if(!allowBlend) color = fadeOutColors[gpu->BLDY_EVY][color&0x7FFF]; break; + + //only when blend color effect is selected, ordinarily opaque sprites are blended with the color effect params + case Blend: forceBlendingForNormal = true; break; + } + + if(allowBlend) { u16 backColor = T2ReadWord(dst,passing);