Hollywood bridge and double buffer

Discuss GUI programming with the RapaGUI plugin here

Hollywood bridge and double buffer

Postby lazi » Fri Apr 07, 2017 11:58 pm

There is something wrong if RapaGUI has a double buffered Hollywood display.
Here are two minimal examples:

1. Resizes correctly
Code: Select all
@REQUIRE "RapaGUI"
@DISPLAY 1,{Width = 320, Height = 200 }
@BGPIC 1,"logo.png"
@DISPLAY 2,{width = 320, Height = 16, color=$404040}

gui$=[[<?xml version="1.0" encoding="UTF-8"?>
      <application id="test" icon="Slarti.info">
         <window id="mainwindow"  title="test"  activate="true">

               <vgroup>
                   <hgroup>
                      <hollywood id="timeline" hide="false" display="2" fixwidth="false" fixheight="true"/>
                      <button id="btn_msperpxplus" weight="5">-</button>
                      <button id="btn_msperpxminus" weight="5">+</button>
                   </hgroup>
               </vgroup>

           </window>
        </application>
    ]]

moai.CreateApp(gui$)

Repeat
   WaitEvent
Forever

Image

2. If you resize it, the Hollywood display trashed with gui gfx. The only difference is the BeginDoubleBuffer() after moai.CreateApp().

@REQUIRE "RapaGUI"
@DISPLAY 1,{Width = 320, Height = 200 }
@BGPIC 1,"logo.png"
@DISPLAY 2,{width = 320, Height = 16, color=$404040}

gui$=[[<?xml version="1.0" encoding="UTF-8"?>
<application id="test" icon="Slarti.info">
<window id="mainwindow" title="test" activate="true">

<vgroup>
<hgroup>
<hollywood id="timeline" hide="false" display="2" fixwidth="false" fixheight="true"/>
<button id="btn_msperpxplus" weight="5">-</button>
<button id="btn_msperpxminus" weight="5">+</button>
</hgroup>
</vgroup>

</window>
</application>
]]

moai.CreateApp(gui$)

SelectDisplay(2)
BeginDoubleBuffer()
SelectDisplay(1)

Repeat
WaitEvent
Forever

Image
User avatar
lazi
 
Posts: 218
Joined: Fri Feb 25, 2011 12:08 am

Re: Hollywood bridge and double buffer

Postby airsoftsoftwair » Sun Apr 09, 2017 2:53 pm

I'm sorry, but that was a Hollywood bug. Fixed now. As a workaround, just enable autoscaling for this display and everything should work.
User avatar
airsoftsoftwair
 
Posts: 2025
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Hollywood bridge and double buffer

Postby lazi » Sun Apr 09, 2017 6:17 pm

When the doublebuffer is not set, resize the window makes the bridged display size change.
When autoscale is enabled, the display size will not change, but the original size is scaled.

How does it work after the fix? Which is the intended way?

I wish that without autoscale, the display's size in pixels will change.

Hope it was understandable :)
User avatar
lazi
 
Posts: 218
Joined: Fri Feb 25, 2011 12:08 am

Re: Hollywood bridge and double buffer

Postby lazi » Sun Apr 09, 2017 10:52 pm

The workaround that seems to solve it currently is that the frame drawing part is wrapped inside of a BeginDoublebuffer() - EndDoubleBuffer() frame.
Tested that it double the time of the loop, but overall can't be seen.
User avatar
lazi
 
Posts: 218
Joined: Fri Feb 25, 2011 12:08 am

Re: Hollywood bridge and double buffer

Postby airsoftsoftwair » Tue Apr 11, 2017 11:57 am

lazi wrote:When the doublebuffer is not set, resize the window makes the bridged display size change.
When autoscale is enabled, the display size will not change, but the original size is scaled.

How does it work after the fix? Which is the intended way?

I wish that without autoscale, the display's size in pixels will change.


Hmm, right, so my autoscale workaround is not a real fix. The general problem is that Hollywood itself is rather inconsistent here. If you resize a real Hollywood display that is in double-buffering mode, the size of the double-buffer won't change. I don't remember why I implemented it like that in the first place and maybe this should be changed, but that's the way it has been all the way back since Hollywood 2.0. So if you want the double-buffer size to change on a non-autoscaled display, you have to call EndDoubleBuffer() and then BeginDoubleBuffer() again to achieve that whenever the display size changes.

Concerning RapaGUI, you could also call EndDoubleBuffer() and then BeginDoubleBuffer() whenever the size of the embedded display changes. Then it should work.
User avatar
airsoftsoftwair
 
Posts: 2025
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Hollywood bridge and double buffer

Postby lazi » Sat Apr 15, 2017 2:25 pm

It will be enough if I can get SizeWindow() event from a RapaGUI bridged window, but I can't find a way for that.
Is there any possibility to know when a RapaGUI window/Area size changes?
User avatar
lazi
 
Posts: 218
Joined: Fri Feb 25, 2011 12:08 am

Re: Hollywood bridge and double buffer

Postby airsoftsoftwair » Mon Apr 17, 2017 11:13 pm

Are you using multiple Hollywood displays in your RapaGUI window? With a single Hollywood display the "SizeWindow" event should work...
User avatar
airsoftsoftwair
 
Posts: 2025
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Hollywood bridge and double buffer

Postby lazi » Tue Apr 18, 2017 7:06 am

Yes.
And as I recall this is something that we discussed before. Sorry to bring it up again. My memory is short and selective :)
User avatar
lazi
 
Posts: 218
Joined: Fri Feb 25, 2011 12:08 am


Return to RapaGUI

Who is online

Users browsing this forum: No registered users and 1 guest

cron