flat assembler
Message board for the users of flat assembler.

Index > Windows > dib and blinking problem

Author
Thread Post new topic Reply to topic
dev_89



Joined: 24 Feb 2013
Posts: 8
dev_89 24 Feb 2013, 08:34
i made a template and used dib sections to draw the images and everything works fine except when i click and drag the dialog there is a little blinking all over the dialog.
i'm using a timer to draw the images then in the WM_PAINT message i'm using bitblt to copy everything from the buffer to main window.
is this little blinking normal in drag mode?
Post 24 Feb 2013, 08:34
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 24 Feb 2013, 19:05
maybe you should take care of vsync. i don't know if it is needed in windows applications, but it may be a similar problem.
Post 24 Feb 2013, 19:05
View user's profile Send private message Visit poster's website Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 24 Feb 2013, 23:22
dev_89, what is the window style (CS_*) in WNDCLASS/WNDCLASSEX you are using? Perhaps Windows is needlessly erasing the window background, only for you to paint over it immediately. Can you share out your source code?
Post 24 Feb 2013, 23:22
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Spool



Joined: 08 Jan 2013
Posts: 151
Spool 25 Feb 2013, 05:24
[ Post removed by author. ]


Last edited by Spool on 17 Mar 2013, 10:42; edited 1 time in total
Post 25 Feb 2013, 05:24
View user's profile Send private message Reply with quote
dev_89



Joined: 24 Feb 2013
Posts: 8
dev_89 25 Feb 2013, 09:45
here is my code.
this code gets called only when windows sends WM_PAINT message:
Code:
proc CpyGFX

local ps PAINTSTRUCT

invoke BeginPaint,[App.hwnd],addr ps
invoke BitBlt,[App.hdc],0,0,ScreenWidth,ScreenHeight,[CanvasDc],0,0,SRCCOPY
invoke EndPaint,[App.hwnd],addr ps
ret

endp  
    

and here is the dialog style:

1 DIALOG 0, 0, 250, 150
STYLE DS_CENTER | WS_POPUP | WS_CLIPCHILDREN

and here is the timer code that draws everything to the canvas buffer:
Code:
proc DrawGFX

local rc RECT

pushad
;clean up all of the buffers
mov edi,[CanvasBuf] 
mov ecx,ScreenWidth * ScreenHeight
mov ebx,ecx
xor eax,eax
repe stosd
mov edi,[CanvasInfoBuf]
mov ecx,ebx
xor eax,eax
repe stosd
mov edi,[CanvasBdBuf]
mov ecx,ebx
xor eax,eax
repe stosd
;draw everything to the buffers
stdcall DrawBitmapImg,0,0,LogoM,[CanvasBuf]
stdcall SetText,100,100,PrText,1,Text1
call DrawBlood
.if byte [InfoF] = 1
call DrawInfo
.endif
;refresh the main window
invoke GetClientRect,[App.hwnd],addr rc
invoke RedrawWindow,[App.hwnd],addr rc,0,RDW_INVALIDATE
popad
ret

endp
    
Post 25 Feb 2013, 09:45
View user's profile Send private message Reply with quote
dev_89



Joined: 24 Feb 2013
Posts: 8
dev_89 25 Feb 2013, 15:28
i just been able to get rid of the flicker on the dialog by handling WM_ERASEBKGND and return true but flicker on the controls still exists.
Post 25 Feb 2013, 15:28
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4020
Location: vpcmpistri
bitRAKE 26 Feb 2013, 08:00
Are you updating the window twice: WM_PAINT and WM_ERASEBKGND. I like to use just WM_ERASEBKGND because it's passed a valid hDC. Also, setting the window background color to 0 - so windows doesn't trying to paint it a color.
Post 26 Feb 2013, 08:00
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.