Page 1 of 1

Hollywood bridge and double buffer

Posted: Fri Apr 07, 2017 11:58 pm
by lazi
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

Re: Hollywood bridge and double buffer

Posted: Sun Apr 09, 2017 2:53 pm
by airsoftsoftwair
I'm sorry, but that was a Hollywood bug. Fixed now. As a workaround, just enable autoscaling for this display and everything should work.

Re: Hollywood bridge and double buffer

Posted: Sun Apr 09, 2017 6:17 pm
by lazi
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 :)

Re: Hollywood bridge and double buffer

Posted: Sun Apr 09, 2017 10:52 pm
by lazi
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.

Re: Hollywood bridge and double buffer

Posted: Tue Apr 11, 2017 11:57 am
by airsoftsoftwair
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.

Re: Hollywood bridge and double buffer

Posted: Sat Apr 15, 2017 2:25 pm
by lazi
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?

Re: Hollywood bridge and double buffer

Posted: Mon Apr 17, 2017 11:13 pm
by airsoftsoftwair
Are you using multiple Hollywood displays in your RapaGUI window? With a single Hollywood display the "SizeWindow" event should work...

Re: Hollywood bridge and double buffer

Posted: Tue Apr 18, 2017 7:06 am
by lazi
Yes.
And as I recall this is something that we discussed before. Sorry to bring it up again. My memory is short and selective :)