Recent

Author Topic: BGRAVirtualScreen - weird behaviors  (Read 471 times)

backprop

  • Full Member
  • ***
  • Posts: 202
BGRAVirtualScreen - weird behaviors
« on: March 05, 2026, 08:20:04 am »
BGRAVirtualScreen have very strange behavior...

Look attached test projects T1 and T2. And look closely the difference in the code...
They have the same functional code, except some "minor" difference. But T1 is 4 time faster than T2!

That "minor" difference is the way components are coded:

T1:
Code: Pascal  [Select][+][-]
  1. initialization
  2.   {$I unit1.lrs}

T2:

Code: Pascal  [Select][+][-]
  1. implementation
  2.  
  3. {$R *.lfm}
  4.  

Result of this "small difference" is 4x difference in execution speed! T1 is faster, but T2 is project created from ground with Lazarus 4.6. And looking deeper in the code, I have noticed internal bitmap is always resized and that happens always when the component's size is different or changed between on redraw calls. But since in T2, internal bitmap is always sized to 0 after finishing drawing in some reason, resizing happens all the time!

How I get to this? I used some old project which I wanted to upgrade with BGRA components and starting new project I noticed excessive speed difference...

All this definitely makes quite a bit of headache. Implementation is definitely weird... And with auto-stretch "feature" I mentioned while ago it really creates more headache than usefulness...
« Last Edit: March 05, 2026, 08:32:00 am by backprop »

backprop

  • Full Member
  • ***
  • Posts: 202
Re: BGRAVirtualScreen - weird behaviors
« Reply #1 on: March 07, 2026, 03:33:51 am »
No comment nor solution about this for more than 24h ?!? Well, I though so, there no solution on internet, thus searching and asking AI is useless... ;)

Well, looking at code more carefully, I have found solution... Removing caption property content from BGRAVirtualScreen fixing the problem and now all is 4x faster!

Anyway, I would suggest to BGRAVirtualScreen creators to look deeply in the code and fix this, or at least document all.Printing caption text on internal bitmap is too costly and anyway is useless when application running. I would also suggest to redesign code regarding setting size of internal bitmap all the time.

 

TinyPortal © 2005-2018