Paul TOTH Regions are used to define window shape (form or any other win control). There are several API functions to do that - most simple are rectangle and round rectangle regions.
For more complex, irregular shapes you have to define it by array of rectangles. And you have to do that every time window changes its size.
So when you drag to resize above functions will be repeatedly called during that process. So speed counts. If nothing else globally defined fixed size array is allocated only once.
Again, I haven't looked at that code closely so I don't know how well it is written and I don't know what are possible bottlenecks there.
x, y, w, h are they single or double?
ReplyDelete/sub
ReplyDelete/sub
ReplyDeleteDorin Duminica 4 * SizeOf(Integer) * 50001 = 80.016 I've discovered that looking at TDS infos
ReplyDeleteFMX.Forms.Border.Win data size is exactly 80.016
github.com - Delphi
That's a very interesting project. Thanks for sharing.
ReplyDeleteNote. Typo in the above formula. You have 50,001 instead of 5,001. But I get your point
Paul TOTH interesting that it's using ints rather than floats
ReplyDeleteAttila Kovacs you could just clone it with https://github.com/tothpaul/Delphi.git
ReplyDeleteDorin Duminica AFAIK that array is used to create Windows region from bitmap on Windows and API requires integer coordinates.
ReplyDeleteDalija Prasnikar right, I missed the Win suffix, makes sense, thanks!
ReplyDeleteit should be a local dynamic array of TRect not a global var.
ReplyDeleteAttila Kovacs on the main page you can download everystring as a single ZIP...but you can't download a branch AFAIK
ReplyDeletegithub.com - tothpaul/Delphi
Paul TOTH There is however question of usage frequency. If called too often that might pose a problem. But I haven't looked at that code closely.
ReplyDeleteDalija Prasnikar the variable is used by CreateRegionDataFromBitmap called only by CreateRegionFromBitmap, called only by TWindowBorderWin.RecreateRegion, called only by TWindowBorderWin.Resize...not sure what it is about...
ReplyDeletedocwiki.embarcadero.com - FMX.Forms.TForm.Border - RAD Studio API Documentation
Paul TOTH Regions are used to define window shape (form or any other win control). There are several API functions to do that - most simple are rectangle and round rectangle regions.
ReplyDeleteFor more complex, irregular shapes you have to define it by array of rectangles. And you have to do that every time window changes its size.
So when you drag to resize above functions will be repeatedly called during that process. So speed counts. If nothing else globally defined fixed size array is allocated only once.
Again, I haven't looked at that code closely so I don't know how well it is written and I don't know what are possible bottlenecks there.
Attila Kovacs Multithreading is not an issue because this is UI related code.
ReplyDelete