I think, the GDI api LineDDA don't works correct. Look at this. The black line was made with MoveToEx/LineTo and the blue line was made with LineDDA and callback procedure:

Here is my code (in XProfan with inlineassembler XPIA):
Does someone know what's goeing wrong?
Best regards,
Nordwind64

Here is my code (in XProfan with inlineassembler XPIA):
{$iq}
Declare x&,y&,text$
Cls
If 0
AsmInclude
LineDDAProc proc ;#################################################################################################
mov eax,
mov ebx,
mov ecx,
invoke SetPixel,ecx,eax,ebx,0FF0000h
mov eax,1
ret 12
LineDDAProc endp
AsmEnd
EndIf
AsmStart LinePoints(%HDC)
invoke MoveToEx,para1,40,40,0
invoke LineTo,para1,400,150
invoke LineDDA,40,40,400,150,addr LineDDAProc,para1
AsmEnd
WaitInput
End
Does someone know what's goeing wrong?
Best regards,
Nordwind64
You're trashing EBX?
Thank you f0dder!
You're right. Silly bug... This one works correct:
You're right. Silly bug... This one works correct:
LineDDAProc proc ;#################################################################################################
push ebp
mov ebp,esp
push eax
push ebx
push ecx
mov eax,
mov ebx,
mov ecx,
invoke SetPixel,ecx,eax,ebx,0FF0000h
pop ecx
pop ebx
pop eax
pop ebp
ret 12
LineDDAProc endp
Happens to us all from time to time :)
Remember: register preservation in callbacks.
You don't need to preserve EAX,ECX,EDX so you can get by without any preservation at all... you don't even need to trash registers, you can directly re-push "dword ptr ESP+xx" :)
Remember: register preservation in callbacks.
You don't need to preserve EAX,ECX,EDX so you can get by without any preservation at all... you don't even need to trash registers, you can directly re-push "dword ptr ESP+xx" :)
Hi.
...only an examplecode 8)
Regards, Nordwind
you don't even need to trash registers, you can directly re-push "dword ptr ESP+xx"
...only an examplecode 8)
Regards, Nordwind