Optimisation to frame draw code, only draw frames that change

This commit is contained in:
pagefault
2005-07-11 13:16:26 +00:00
parent 9ef907edf9
commit fd80c0f0d6
2 changed files with 32 additions and 3 deletions

View File

@@ -28,6 +28,26 @@ EXTSYM _2xSaISuperEagleLineW, _2xSaISuper2xSaILineW,newengen,cfield,HalfTrans
EXTSYM GUIOn2,FilteredGUI,SpecialLine,vidbufferofsb,HalfTransB,HalfTransC
ALIGN32
section .data
NEWSYM frametot, dd 0
section .text
NEWSYM CheckFrame
pushad
xor eax,eax
mov ebx,[vidbuffer]
add ebx,16*2+256*2+32*2
add ebx,8*288*2
mov ecx,62000
.loopit
add eax,[ebx]
add ebx,4
dec ecx
jnz .loopit
mov [frametot],eax
popad
ret
SECTION .bss
NEWSYM AddEndBytes, resd 1 ; Number of bytes between each line

View File

@@ -28,7 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define DWORD unsigned long
typedef enum { FALSE = 0, TRUE = !FALSE } BOOL;
extern void CheckFrame();
// VIDEO VARIABLES
extern unsigned char cvidmode;
extern SDL_Surface *surface;
@@ -40,6 +40,8 @@ extern void LinuxExit();
extern unsigned int vidbuffer;
extern DWORD converta;
extern unsigned char curblank;
extern int frametot;
int prevtot = 0;
void UpdateVFrame(void);
BOOL sw_start(int width, int height, int req_depth, int FullScreen)
@@ -133,9 +135,16 @@ void sw_drawwin()
// the value of newengen is equal to 1.
// (see ProcessTransparencies in newgfx16.asm
// for ZSNES' current transparency code)
UpdateVFrame();
if (curblank != 0) return;
prevtot = frametot;
CheckFrame();
UpdateVFrame();
if (prevtot == frametot) { return; }
if (curblank != 0) return;
LockSurface();
ScreenPtr = vidbuffer;