Date   

Re: Problem with ellipsefill on Android using BBCSDL 1.00a

lettersquash <j.r.freestone@...>
 

Oops, posts coming thick and fast, I didn't see this:
Please note that if you edit these lines 'in situ' the change will only last for the current session.  As soon as you restart BBCBasic it will revert to the standard library.  For any 'serious' testing I would copy both 'ellipse.bbc' (the library) and 'ellipses.bbc' (the demo program) into the @usr$ folder and edit the copied ellipses.bbc to load the library from @usr$ rather than @lib$.  That way you can make changes which will 'stick'.
So, you never know...


Re: Problem with ellipsefill on Android using BBCSDL 1.00a

lettersquash <j.r.freestone@...>
 

I changed all the relevant fifth params to 4. Unfortunately, this cures the issue only 'empirically'. If I choose a different number of ellipses (I made the "A%*PI/20" and "MOD20" to use a % variable instead of 20), the angles change and ellipses still fail at particular angles.


Re: Problem with ellipsefill on Android using BBCSDL 1.00a

gav
 

Thanks for the clarification. Copied to @usr$ and those changes fixed it on my phone.

Gavin



Sent from Samsung Mobile on O2

-------- Original message --------
From: Richard Russell <news@...>
Date: 08/02/2019 11:51 (GMT+00:00)
To: bb4w@groups.io
Subject: Re: [bb4w] Problem with ellipsefill on Android using BBCSDL 1.00a

On Fri, Feb 8, 2019 at 11:15 AM, gav wrote:
Can someone tell the exactly where to change the line segment value from 3 to 4 please so I can check if that helps.
There are eight  calls to bezierColor() in the PROCellipsefill section of the ellipse.bbc library:

      SYS "GFX_bezierColor",@memhdc%,v%%,   w%%,   4,3,Z%
      SYS "GFX_bezierColor",@memhdc%,v%%+6, w%%+6, 4,3,Z%
      SYS "GFX_bezierColor",@memhdc%,v%%+12,w%%+12,4,3,Z%
      SYS "GFX_bezierColor",@memhdc%,v%%+18,w%%+18,4,3,Z%
      SWAP Z%,@hpal%!(@vdu%?67*4)
      SWAP @vdu%?65,@vdu%?67
      PLOT 143,X%,Y%
      SYS "GFX_bezierColor",@memhdc%,v%%,   w%%,   4,3,Z%
      SYS "GFX_bezierColor",@memhdc%,v%%+6, w%%+6, 4,3,Z%
      SYS "GFX_bezierColor",@memhdc%,v%%+12,w%%+12,4,3,Z%
      SYS "GFX_bezierColor",@memhdc%,v%%+18,w%%+18,4,3,Z%

Please note that if you edit these lines 'in situ' the change will only last for the current session.  As soon as you restart BBCBasic it will revert to the standard library.  For any 'serious' testing I would copy both 'ellipse.bbc' (the library) and 'ellipses.bbc' (the demo program) into the @usr$ folder and edit the copied ellipses.bbc to load the library from @usr$ rather than @lib$.  That way you can make changes which will 'stick'.


Re: Problem with ellipsefill on Android using BBCSDL 1.00a

Richard Russell
 

On Fri, Feb 8, 2019 at 11:15 AM, gav wrote:
Can someone tell the exactly where to change the line segment value from 3 to 4 please so I can check if that helps.
There are eight  calls to bezierColor() in the PROCellipsefill section of the ellipse.bbc library:

      SYS "GFX_bezierColor",@memhdc%,v%%,   w%%,   4,3,Z%
      SYS "GFX_bezierColor",@memhdc%,v%%+6, w%%+6, 4,3,Z%
      SYS "GFX_bezierColor",@memhdc%,v%%+12,w%%+12,4,3,Z%
      SYS "GFX_bezierColor",@memhdc%,v%%+18,w%%+18,4,3,Z%
      SWAP Z%,@hpal%!(@vdu%?67*4)
      SWAP @vdu%?65,@vdu%?67
      PLOT 143,X%,Y%
      SYS "GFX_bezierColor",@memhdc%,v%%,   w%%,   4,3,Z%
      SYS "GFX_bezierColor",@memhdc%,v%%+6, w%%+6, 4,3,Z%
      SYS "GFX_bezierColor",@memhdc%,v%%+12,w%%+12,4,3,Z%
      SYS "GFX_bezierColor",@memhdc%,v%%+18,w%%+18,4,3,Z%

Please note that if you edit these lines 'in situ' the change will only last for the current session.  As soon as you restart BBCBasic it will revert to the standard library.  For any 'serious' testing I would copy both 'ellipse.bbc' (the library) and 'ellipses.bbc' (the demo program) into the @usr$ folder and edit the copied ellipses.bbc to load the library from @usr$ rather than @lib$.  That way you can make changes which will 'stick'.


Re: Problem with ellipsefill on Android using BBCSDL 1.00a

gav
 

Sorry for the blank message earlier. I was about to reply when I got called away and somehow my post was sent.

I must admit that I've only been following this thread at a distance and I've not been monitoring the finer details of the suggested fixes, due to an illness in the family.

Can someone tell the exactly where to change the line segment value from 3 to 4 please so I can check if that helps. What file is to be changed the program or the ellipses library? And which line?

I'm currently sat waiting in a hospital car park so can try the edit out while I'm here.

Thanks

Gavin



Sent from Samsung Mobile on O2

-------- Original message --------
From: Richard Russell <news@...>
Date: 08/02/2019 10:11 (GMT+00:00)
To: bb4w@groups.io
Subject: Re: [bb4w] Problem with ellipsefill on Android using BBCSDL 1.00a

On Fri, Feb 8, 2019 at 09:45 AM, Ken Orr wrote:
I am afraid it fails on "modern" android and Windows too.
Before or after the change from 3 line segments to 4?  Failure on Windows is likely to be unrelated, unless (very unusually) your display is configured for 16-bit colour.  You might want to check whether any updated graphics drivers are available for your PC.

  I have attached screenshots of ellipses.bbc
No you haven't, because attachments are not supported (I always access the group using its web interface, not by email)!  If you want to show screenshots please upload them to a suitable public web space and post a link.


Re: Problem with ellipsefill on Android using BBCSDL 1.00a

Richard Russell
 

On Fri, Feb 8, 2019 at 09:45 AM, Ken Orr wrote:
I am afraid it fails on "modern" android and Windows too.
Before or after the change from 3 line segments to 4?  Failure on Windows is likely to be unrelated, unless (very unusually) your display is configured for 16-bit colour.  You might want to check whether any updated graphics drivers are available for your PC.

  I have attached screenshots of ellipses.bbc
No you haven't, because attachments are not supported (I always access the group using its web interface, not by email)!  If you want to show screenshots please upload them to a suitable public web space and post a link.


Re: Problem with ellipsefill on Android using BBCSDL 1.00a

LifesVoyager
 

FYI

Running Android 8.1.0 on a XiaoMi phone,  ellipses.BBC works perfectly


Re: Problem with ellipsefill on Android using BBCSDL 1.00a

Richard Russell
 

On Fri, Feb 8, 2019 at 07:19 AM, Jon Welch wrote:
Perhaps Gavin and others can confirm if their devices work with this change.
I see a post from him, but it's empty so we don't know one way or the other!

Thanks for all your help Richard in getting to the bottom of this problem.
Sadly we haven't got to the "bottom" of anything!  There's no 'science' in increasing the number of line segments, if it has an effect it's presumably a fluke and just as likely to make things worse rather than better.  If a couple more members report that it helps I'll release a new version with that change to make it easier for others to test.  But I'd need a lot of feedback before feeling confident enough to call it a fix, albeit an empirical one.


Re: Problem with ellipsefill on Android using BBCSDL 1.00a

Ken Orr
 

Hi Richard,

I am afraid it fails on "modern" android and Windows too.  I have attached screenshots of ellipses.bbc of my acer laptop  (Acer Aspire 7736z-4088) running Windows 10 on BBCSD20 1.00a  and of my Moto e4 (running Android 7.1.1) on BBCSDL20 1.00b.

Ken

On 07/02/2019 16:57, Richard Russell wrote:
On Thu, Feb 7, 2019 at 12:59 PM, lettersquash wrote:
I also get improved elipses, but with occasional ones (mainly near-horizontal aspect, but one or two near vertical) that fail and cause the background to flash when these come round to be drawn again.
It sounds as though the ellipses are not forming 'closed curves' at those specific angles, allowing the flood-fill to leak through.  I'm not aware of similar problems on any of the desktop platforms (Windows, MacOS, Linux, Raspberry Pi) or on iOS so this seems to be an Android-specific thing, albeit that it works perfectly on all the Android devices I have here (at least six).

I'd be interested to learn if it is failing on any relatively modern device, because even Android 5.1 (Lollipop) is pretty ancient.


Re: Problem with ellipsefill on Android using BBCSDL 1.00a

Jon Welch
 

Changing the fifth parameter from 3 to 4 seems to have cured it. I no longer have any leaks !

Perhaps Gavin and others can confirm if their devices work with this change.

Thanks for all your help Richard in getting to the bottom of this problem.


Re: Problem with ellipsefill on Android using BBCSDL 1.00a

Richard Russell
 

On Thu, Feb 7, 2019 at 08:10 PM, Jon Welch wrote:
Looks like it's a bug in the OS then
But via what mechanism?  As you know the 2D 'drawing' routines (specifically the bezierColor function in this case) are in the SDL2_gfx library which is statically linked with BBCSDL, not part of Android.  So it's not clear to me how differences in the 'OS' can affect what pixels are plotted, even though the evidence would suggest that is exactly what is happening.

I do hope you will continue to investigate, perhaps by trying to devise a workaround if that is the only solution.  Out of curiosity, what is the effect of changing the number of line segments that are used to draw the Bezier curves (fifth parameter of bezierColor)?  Does increasing it from 3 to 4 (or more) make the problem better, worse, or no difference?  Can you tell (perhaps by changing the colours) whether the 'holes' are within the Bezier curves or between them?  If they are between them there is more opportunity for patching them.

If the problem cannot be fixed I will obviously have to remove the angled ellipse library from BBCSDL because it is not acceptable to include a library which isn't genuinely 'cross platform'.


Re: Problem with ellipsefill on Android using BBCSDL 1.00a

gav
 

Installed 1.00b on Samsung S9plus (Android 8.0.0) although it's due to do an update at 5am tonight.

When the ellipses are drawn at the horizontal angle the background changes to same colour as though the flood fill is leaking through.

Gavin

Sent from Samsung Mobile on O2

-------- Original message --------
From: Richard Russell <news@...>
Date: 06/02/2019 17:58 (GMT+00:00)
To: bb4w@groups.io
Subject: Re: [bb4w] Problem with ellipsefill on Android using BBCSDL 1.00a

On Tue, Feb 5, 2019 at 10:53 PM, Richard Russell wrote:
2. The bounding curve has a 'hole' through which the flood fill can leak (it only needs to be one pixel).
To the extent that I have been able to analyze the problem here, it would appear that this is the cause.  The question then arises: why does the bounding curve (ellipse) have holes through which the flood-fill leaks, and why is it happening on your specific Android device but not generally?  I'm pretty confident that nothing in BBC BASIC is to blame, so I fear it may point to a bug in Samsung's implementation of OpenGL ES 1.1 on your Galaxy S7 phone.

Does anybody here have a Samsung Galaxy S8 or S9?  If so, can they please check whether the 'ellipses' demo works correctly or not?


Re: Problem with ellipsefill on Android using BBCSDL 1.00a

Jon Welch
 

My S7 is running Android 8.0 and I can confirm that some ellipses have holes allowing the flood-fill to leak through.

Looks like it's a bug in the OS then :(


Re: Problem with ellipsefill on Android using BBCSDL 1.00a

Richard Russell
 

On Thu, Feb 7, 2019 at 12:59 PM, lettersquash wrote:
I also get improved elipses, but with occasional ones (mainly near-horizontal aspect, but one or two near vertical) that fail and cause the background to flash when these come round to be drawn again.
It sounds as though the ellipses are not forming 'closed curves' at those specific angles, allowing the flood-fill to leak through.  I'm not aware of similar problems on any of the desktop platforms (Windows, MacOS, Linux, Raspberry Pi) or on iOS so this seems to be an Android-specific thing, albeit that it works perfectly on all the Android devices I have here (at least six).

I'd be interested to learn if it is failing on any relatively modern device, because even Android 5.1 (Lollipop) is pretty ancient.


Re: Problem with SWAP on Android using BBCSDL

Richard Russell
 

On Thu, Feb 7, 2019 at 01:04 PM, DaveinSpain wrote:
I have been experimenting with RECTANGLE SWAP
Is it implemented?
No.  It's not a 'standard' BBC BASIC feature anyway: it's something I added in BB4W (because I could) but it's not present in any other version, including Acorn versions and BBCSDL.  I've never seen it used in a program so I didn't think it would be missed.


Problem with SWAP on Android using BBCSDL

DaveinSpain
 

Hi Richard
I have been experimenting with RECTANGLE SWAP
Is it implemented? SWAP on it's own works and so does RECTANGLE FILL
Dave N


Re: Problem with ellipsefill on Android using BBCSDL 1.00a

lettersquash <j.r.freestone@...>
 
Edited

Hi Richard and Jon,
Just a bit more info in case it's of help. I've installed the 1.00b since this last tweak on two Android devices. On my phone, cheap Chinese Homtom HT Pro3, with Android 5.1? (5.something anyway), I also get improved elipses, but with occasional ones (mainly near-horizontal aspect, but one or two near vertical) that fail and cause the background to flash when these come round to be drawn again. On my other device, a Galaxy Tab (model SM-T210) running Android 4.4.2, they are drawn perfectly. At least, I assume so, I haven't had time to actually read the code yet, but I'm guessing they aren't meant to stay on the screen forming a daisy shape - on this machine they are drawn, undrawn (or the screen is cleared, but presumably that wouldn't have failed and I saw you mention reversing colours with GCOL3...) and then the next drawn. On my phone, they're not undrawn, so you end up with a multi-coloured daisy. Very pretty. ;)

Before updating, my phone showed mostly outlines IIRC. I'm not sure I tried elipses.bbc on the Tab before this update.
HTH
JF


Re: Problem with ellipsefill on Android using BBCSDL 1.00a

Jon Welch
 

Thanks for looking this further.

I only got as far as the colour being returned from the border@ellipse function was different between the windows and android version (probably due to my device only having 16 bit graphics). Windows returned FF000014 (when setting the colour to 20), but my device returned FF000010 instead. But setting the colour to 16 in the SetRenderDrawColor line still didn't work properly.

Anyway, I have just installed version 1.00b and it is a lot better in that the ellipses are now being filled but I am still getting a flashing screen background.

I will continue to investigate and report back.

Thanks again.


Re: Problem with ellipsefill on Android using BBCSDL 1.00a

Richard Russell
 

On Wed, Feb 6, 2019 at 05:58 PM, Richard Russell wrote:
why is it happening on your specific Android device but not generally?
That remains a mystery, but I've added a workaround to the ellipse library which should - if my limited understanding of what is happening is correct - force your device to conform!  Please install version 1.00b from the usual place (only the Android edition has changed) and let me know if it fixes the problem.


Re: Solved

Richard Russell
 

On Wed, Feb 6, 2019 at 06:36 PM, Leslie Baker wrote:

I then installed the three 32 bit libraries and it worked ok.

Please bear in mind that I now supply both 32-bit and 64-bit Linux editions of BBCSDL (the 64-bit edition is no longer 'experimental' as it was for a long time) so there is no longer any need to mess around with loading 32-bit libraries on 64-bit Linux.  Compatibility obviously suffers somewhat, but getting used to writing 64-bit-compatible BBC BASIC programs is no bad thing (the MacOS edition is now 64-bit only and that's the direction things are moving).

There are notes on 32-bit vs 64-bit compatibility issues in the 'differences' document here.