Git Product home page Git Product logo

Comments (16)

lainz avatar lainz commented on July 22, 2024 1

I noticed the bug is here:

procedure TCustomBGRAVirtualScreen.BGRASetSize(AWidth, AHeight: integer);
begin
  if (FBGRA <> nil) {and ((AWidth <> FBGRA.Width) or (AHeight <> FBGRA.Height))} then
  begin
    FBGRA.SetSize(AWidth, AHeight);
    RedrawBitmapContent;
    FDiscardedRect := EmptyRect;
  end;
end;

and ((AWidth <> FBGRA.Width) or (AHeight <> FBGRA.Height))

Commenting that code works. Still waiting for your input.

from bgracontrols.

lainz avatar lainz commented on July 22, 2024 1

Hi, seems that BGRAVirtualScreen don't discard bitmap if the width of the control doesn't change... even if I want it to discard.
Check \bgracontrols\test\test_bgravirtualscreen_blur

Hi. I don't see this example in the repository.

In dev-bgracontrols branch.

from bgracontrols.

circular17 avatar circular17 commented on July 22, 2024 1

Hi Leandro,

It is on purpose that BGRASetSize function doesn't change the content if the size is the same. Consider a button, unless it is resized, most of the time, we don't want to redraw it.

So please don't change BGRASetSize function this way. Are there any other approach, like calling DiscardBitmap function in the OnResize event of the form?

Regards

from bgracontrols.

lainz avatar lainz commented on July 22, 2024 1

Thanks, it works fine on latest Lazarus.

from bgracontrols.

lainz avatar lainz commented on July 22, 2024

Instructions: open the demo, and resize the window, the bottom virtual screen is resized and repainted correctly, but the static bgravirtualscreen at the top left are not repainted.

from bgracontrols.

rchastain avatar rchastain commented on July 22, 2024

Hi, seems that BGRAVirtualScreen don't discard bitmap if the width of the control doesn't change... even if I want it to discard.

Check \bgracontrols\test\test_bgravirtualscreen_blur

Hi. I don't see this example in the repository.

from bgracontrols.

lainz avatar lainz commented on July 22, 2024

Hi, but you've tested the demo? It has DiscardBitmap on resize.

procedure TForm1.FormResize(Sender: TObject);
var
  i: integer;
  vs: TBGRAVirtualScreen;
begin
  for i:=0 to Self.ControlCount-1 do
  begin
    if (Self.Controls[i] is TBGRAVirtualScreen) then
    begin
      vs := (Self.Controls[i] as TBGRAVirtualScreen);
      vs.DiscardBitmap;
    end;
  end;
end;

from bgracontrols.

circular17 avatar circular17 commented on July 22, 2024

Ah ok, there was a misunderstanding. I thought you expected it to discard automatically on resize.

I haven't tested the project yet. From the code you've cited, it seems there is a call to DiscardBitmap that normally would redraw the content.

I will dig deeper into it.

from bgracontrols.

lainz avatar lainz commented on July 22, 2024

The discard code on resize was wrong. I've fixed it, still buggy... now the bug is when resizing it don't update the bitmap, only when the resize is done..

from bgracontrols.

circular17 avatar circular17 commented on July 22, 2024

Hi Leandro,

Indeed, I came to the same conclusion, that it was cycling the main controls of the form, whereas the panels you're considering are inside the first virtual screen.

After that, I don't notice the problem of delayed update you're mentionning.

Regards

from bgracontrols.

lainz avatar lainz commented on July 22, 2024

Maybe because I'm using Windows. Or because I'm using Lazarus 2.2.6

from bgracontrols.

lainz avatar lainz commented on July 22, 2024

This is a video showing the problem, notice that the top left virtual screen are not updated until I release the mouse:
https://github.com/bgrabitmap/bgracontrols/assets/4131395/146aac96-1d5d-41c2-9c86-309574dd206b

from bgracontrols.

circular17 avatar circular17 commented on July 22, 2024

Indeed, I can see the fixed panels are not update.

I tried it on Windows 11 and Lazarus 3.0. It is laggy but updates all panels.

from bgracontrols.

lainz avatar lainz commented on July 22, 2024

Maybe we can add a boolean that triggers the update without checking width and height like I showed in previous comments.

Something like "optimized Discard" if set to true is like

If fbgra <> nil and optimized Discard and width and height...

By default is true. And if set to false it will discard anyways no matter the width and height.

That makes it run smoothly.

from bgracontrols.

lainz avatar lainz commented on July 22, 2024

Oh I see, I will try on latest lazarus first.

from bgracontrols.

circular17 avatar circular17 commented on July 22, 2024

Glad it is all well for you

from bgracontrols.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.