Skip to content

Instantly share code, notes, and snippets.

@tuttlem
Created November 28, 2012 13:38
Show Gist options
  • Save tuttlem/4161348 to your computer and use it in GitHub Desktop.
Save tuttlem/4161348 to your computer and use it in GitHub Desktop.
FlipBackBuffer
FlipBackBuffer PROC hWin:DWORD
LOCAL hDC:HDC
LOCAL ps:PAINTSTRUCT
; start painting the window
invoke BeginPaint, hWin, ADDR ps
mov hDC, eax
; work out the dimensions to blit
mov eax, clientRect.right
sub eax, clientRect.left
mov ebx, clientRect.bottom
sub ebx, clientRect.top
; write the memory buffer to the front buffer
invoke BitBlt, hDC, 0, 0, eax, ebx, memDC, 0, 0, SRCCOPY
; we're done
invoke EndPaint, hWin, ADDR ps
xor eax, eax
ret
FlipBackBuffer ENDP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment