2015-04-08 20:02 GMT+02:00 karl ramberg karlramberg@gmail.com:
Confirmed.
Karl
On Wed, Apr 8, 2015 at 5:33 PM, Nicolai Hess nicolaihess@web.de wrote:
In order to reproduce it, draw a rectangle with radial gradient fill, with direction and normal, both of length 1.
This is not the reason why it crashes. It happens for other values as well:
|form canvas fill direction normal| direction := 4@0. normal := 0@2. form := Form extent:300@300 depth:32. canvas := form getCanvas. fill := GradientFillStyle new colorRamp:{0 -> Color white . 0.5 -> Color green . 1 -> Color blue};origin:400@400 ;direction:direction;normal:normal;radial:true;yourself. canvas fillRectangle: (0@0 extent:800@800) fillStyle: fill. Display getCanvas drawImage: form at: 300@300
This uses a different value for direction and normal and the fill is defined for a larger area (800x800) -> CRASH
Maybe, this is a rare bug, because, normally you don't create a small gradient t o fill a large area. But a vm crash is not nice, I would like to get this fixed.
I am not sure what is the exact cause, but it may come from a signed integer overflwo, It looks like Balloon uses fixed point arithmetik (binary scaling). This fixed point representation (16.16 bit fixed point represented in a 32 integer) tend to overflow, especially for operations like computing the squared length of a vector x*x+y*y -> overflow -> result is a negative number.
Possible solutions: downscale prior to the multiplication -> lost of precision use a larger datatype for intermediate results.
It looks like B2D uses the first option (look at senders of accurateLengthOfwith and squaredLenghtOfwith Maybe there is something wrong with the other code that multiplies the values, or the 16.16 bit fixed point is just not large enough for some fills?
Any ideas?
Nicolai
This one works (no vm crash): |form canvas fill direction normal| direction := 1@0. normal := 0@0. form := Form extent:300@300 depth:32. canvas := form getCanvas. fill := GradientFillStyle new colorRamp:{0 -> Color white . 0.5 -> Color green . 1 -> Color blue};origin:150@150 ;direction:direction;normal:normal;radial:true;yourself. canvas fillRectangle: (50@50 extent:200@200) fillStyle: fill. Display getCanvas drawImage: form at: 300@300.
direction := 1@0. normal := 0@0. -> OK
direction := 0@0. normal := 0@1. -> OK
direction := 1@0. normal := 0@1. -> VM-Crash (Pharo and Squeak)
Pharo: VM Version: Cog VM 4.0.0 (release) from Feb 16 2015 Compiler: gcc 4.6.2 Interpreter Build: NBCoInterpreter NativeBoost-CogPlugin-EstebanLorenzano.21 uuid: 4d9b9bdf-2dfa-4c0b-99eb-5b110dadc697 Feb 16 2015 Cogit Build: NBCogit NativeBoost-CogPlugin-EstebanLorenzano.21 uuid: 4d9b9bdf-2dfa-4c0b-99eb-5b110dadc697 Feb 16 2015 Source Version: https://github.com/pharo-project/pharo-vm.git Commit: 55fbd0b0279998a4a33852f5afb3d213986cc3ae Date: 2015-02-16 17:54:00 +0100 By: Esteban Lorenzano estebanlm@gmail.com Jenkins build #14895
Current byte code: -1 Primitive index: 117 Smalltalk stack dump: 0x24c830 M BalloonEngine>copyLoopFaster 0x6b09b80: a(n) BalloonEngine 0x24c848 M BalloonEngine>copyBits 0x6b09b80: a(n) BalloonEngine 0x24c860 M BalloonEngine>postFlushIfNeeded 0x6b09b80: a(n) BalloonEngine 0x24c884 I BalloonEngine>drawRectangle:fill:borderWidth:borderColor:transform: 0x6b09b80: a(n) BalloonEngine 0x24c8b8 I BalloonCanvas>drawRectangle:color:borderWidth:borderColor: 0x6b099c0: a(n) BalloonCanvas 0x24c8e8 I BalloonCanvas>fillRectangle:basicFillStyle: 0x6b099c0: a(n) BalloonCanvas
Squeak: VM Version: Cog VM 4.0.0 (release) from Aug 22 2013 Compiler: gcc 3.4.4 (cygming special, gdc 0.12, using dmd 0.125) Interpreter Build: CoInterpreter VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 Aug 22 2013 Cogit Build: StackToRegisterMappingCogit VMMaker.oscog-eem.333 uuid: 84da9cb8-7f30-4cb7-b4fb-239a11f63b54 Aug 22 2013 Source Version: VM: r2776 http://www.squeakvm.org/svn/squeak/branches/Cog Plugins: r2545 http://squeakvm.org/svn/squeak/trunk/platforms/Cross/plugins
Current byte code: -1 Primitive index: 117
nicolai
On 15.04.2015, at 13:34, Nicolai Hess nicolaihess@web.de wrote:
|form canvas fill direction normal| direction := 4@0. normal := 0@2. form := Form extent:300@300 depth:32. canvas := form getCanvas. fill := GradientFillStyle new colorRamp:{0 -> Color white . 0.5 -> Color green . 1 -> Color blue};origin:400@400;direction:direction;normal:normal;radial:true;yourself. canvas fillRectangle: (0@0 extent:800@800) fillStyle: fill. Display getCanvas drawImage: form at: 300@300
This uses a different value for direction and normal and the fill is defined for a larger area (800x800) -> CRASH
Maybe, this is a rare bug, because, normally you don't create a small gradient t o fill a large area. But a vm crash is not nice, I would like to get this fixed.
I am not sure what is the exact cause, but it may come from a signed integer overflwo, It looks like Balloon uses fixed point arithmetik (binary scaling). This fixed point representation (16.16 bit fixed point represented in a 32 integer) tend to overflow, especially for operations like computing the squared length of a vector x*x+y*y -> overflow -> result is a negative number.
Possible solutions: downscale prior to the multiplication -> lost of precision use a larger datatype for intermediate results.
It looks like B2D uses the first option (look at senders of accurateLengthOfwith and squaredLenghtOfwith Maybe there is something wrong with the other code that multiplies the values, or the 16.16 bit fixed point is just not large enough for some fills?
Any ideas?
No idea, but just as a datapoint:
The code works fine in SqueakJS (if you enlarge the form to actually show the ellipse centered at 400@400):
Also no idea why the gradient repeats after 260 pixels ...
- Bert -
2015-04-15 23:53 GMT+02:00 Bert Freudenberg bert@freudenbergs.de:
On 15.04.2015, at 13:34, Nicolai Hess nicolaihess@web.de wrote:
|form canvas fill direction normal| direction := 4@0. normal := 0@2. form := Form extent:300@300 depth:32. canvas := form getCanvas. fill := GradientFillStyle new colorRamp:{0 -> Color white . 0.5 -> Color green . 1 -> Color blue};origin:400@400 ;direction:direction;normal:normal;radial:true;yourself. canvas fillRectangle: (0@0 extent:800@800) fillStyle: fill. Display getCanvas drawImage: form at: 300@300
This uses a different value for direction and normal and the fill is defined for a larger area (800x800) -> CRASH
Maybe, this is a rare bug, because, normally you don't create a small gradient t o fill a large area. But a vm crash is not nice, I would like to get this fixed.
I am not sure what is the exact cause, but it may come from a signed integer overflwo, It looks like Balloon uses fixed point arithmetik (binary scaling). This fixed point representation (16.16 bit fixed point represented in a 32 integer) tend to overflow, especially for operations like computing the squared length of a vector x*x+y*y -> overflow -> result is a negative number.
Possible solutions: downscale prior to the multiplication -> lost of precision use a larger datatype for intermediate results.
It looks like B2D uses the first option (look at senders of accurateLengthOfwith and squaredLenghtOfwith Maybe there is something wrong with the other code that multiplies the values, or the 16.16 bit fixed point is just not large enough for some fills?
Any ideas?
No idea, but just as a datapoint:
The code works fine in SqueakJS (if you enlarge the form to actually show the ellipse centered at 400@400):
Also no idea why the gradient repeats after 260 pixels ...
This looks like some "wrap-around" , what happens if the fill is in the upper left quarter? will the fill appear 4 times? How would JS react on a wrong array access? Throwing an exception?
- Bert -
On 15.04.2015, at 23:53, Nicolai Hess nicolaihess@web.de wrote:
2015-04-15 23:53 GMT+02:00 Bert Freudenberg bert@freudenbergs.de:
No idea, but just as a datapoint:
The code works fine in SqueakJS (if you enlarge the form to actually show the ellipse centered at 400@400):
<PastedGraphic-8.png>
Also no idea why the gradient repeats after 260 pixels ...
This looks like some "wrap-around" , what happens if the fill is in the upper left quarter? will the fill appear 4 times?
It appears to repeat vertically only.
You can easily try it for yourself. Just go to this URL, open a workspace, and paste your code in:
How would JS react on a wrong array access? Throwing an exception?
No. It's just a no-op.
- Bert -
2015-04-16 20:18 GMT+02:00 Bert Freudenberg bert@freudenbergs.de:
On 15.04.2015, at 23:53, Nicolai Hess nicolaihess@web.de wrote:
2015-04-15 23:53 GMT+02:00 Bert Freudenberg bert@freudenbergs.de:
No idea, but just as a datapoint:
The code works fine in SqueakJS (if you enlarge the form to actually
show the ellipse centered at 400@400):
<PastedGraphic-8.png>
Also no idea why the gradient repeats after 260 pixels ...
This looks like some "wrap-around" , what happens if the fill is in the
upper left
quarter? will the fill appear 4 times?
It appears to repeat vertically only.
You can easily try it for yourself. Just go to this URL, open a workspace, and paste your code in:
That is not really easy:) I can not copy and paste into squeakjs. And with german keyboard layout I can not even tpye an @ sign. (Firefox on Windows 7)
Does copy and paste work for other systems / browser?
How would JS react on a wrong array access? Throwing an exception?
No. It's just a no-op.
- Bert -
On 16.04.2015, at 11:33, Nicolai Hess nicolaihess@web.de wrote:
2015-04-16 20:18 GMT+02:00 Bert Freudenberg <bert@freudenbergs.de mailto:bert@freudenbergs.de>:
On 15.04.2015, at 23:53, Nicolai Hess <nicolaihess@web.de mailto:nicolaihess@web.de> wrote:
2015-04-15 23:53 GMT+02:00 Bert Freudenberg <bert@freudenbergs.de mailto:bert@freudenbergs.de>:
No idea, but just as a datapoint:
The code works fine in SqueakJS (if you enlarge the form to actually show the ellipse centered at 400@400):
<PastedGraphic-8.png>
Also no idea why the gradient repeats after 260 pixels ...
This looks like some "wrap-around" , what happens if the fill is in the upper left quarter? will the fill appear 4 times?
It appears to repeat vertically only.
You can easily try it for yourself. Just go to this URL, open a workspace, and paste your code in:
That is not really easy:) I can not copy and paste into squeakjs. And with german keyboard layout I can not even tpye an @ sign. (Firefox on Windows 7)
Does copy and paste work for other systems / browser?
Ah, Chrome works best so far. Sorry. Patches welcome ;^)
http://tinyurl.com/mks6psd http://tinyurl.com/mks6psd
How would JS react on a wrong array access? Throwing an exception?
No. It's just a no-op.
- Bert -
- Bert -
2015-04-16 20:43 GMT+02:00 Bert Freudenberg bert@freudenbergs.de:
On 16.04.2015, at 11:33, Nicolai Hess nicolaihess@web.de wrote:
(Firefox on Windows 7)
Does copy and paste work for other systems / browser?
Ah, Chrome works best so far. Sorry. Patches welcome ;^)
Yes, that works much better.
More strange squeakjs results (repeats for times) :
|form canvas fill direction normal| direction := 200@0. normal := 0@1. form := Form extent:600@600 depth:32. canvas := form getCanvas. fill := GradientFillStyle new colorRamp:{0 -> Color white . 0.5 -> Color green . 1 -> Color blue};origin:300@300 ;direction:direction;normal:normal;radial:true;yourself. canvas fillRectangle: (0@0 extent:600@600) fillStyle: fill. Display getCanvas drawImage: form at: 300@300.
And If I swap direction and normal direction := 1@0. normal := 0@200.
squeakjs does not response anymore !
nicolai
How would JS react on a wrong array access? Throwing an exception?
No. It's just a no-op.
- Bert -
- Bert -
I was hoping to get a debugger running this simulated in RSqueakVM, but it just runs and draws. Is this what you were expecting?
http://forum.world.st/file/n4820054/balloon-crash.png
-- View this message in context: http://forum.world.st/vm-crash-from-BalloonEngine-maybe-B2DPlugin-or-BitBltP... Sent from the Squeak VM mailing list archive at Nabble.com.
2015-04-16 21:45 GMT+02:00 timfelgentreff timfelgentreff@gmail.com:
I was hoping to get a debugger running this simulated in RSqueakVM, but it just runs and draws. Is this what you were expecting?
Yes, this is the expected result.
-- View this message in context: http://forum.world.st/vm-crash-from-BalloonEngine-maybe-B2DPlugin-or-BitBltP... Sent from the Squeak VM mailing list archive at Nabble.com.
2015-04-16 20:43 GMT+02:00 Bert Freudenberg bert@freudenbergs.de:
On 16.04.2015, at 11:33, Nicolai Hess nicolaihess@web.de wrote:
2015-04-16 20:18 GMT+02:00 Bert Freudenberg bert@freudenbergs.de:
On 15.04.2015, at 23:53, Nicolai Hess nicolaihess@web.de wrote:
2015-04-15 23:53 GMT+02:00 Bert Freudenberg bert@freudenbergs.de:
No idea, but just as a datapoint:
The code works fine in SqueakJS (if you enlarge the form to actually
show the ellipse centered at 400@400):
<PastedGraphic-8.png>
Also no idea why the gradient repeats after 260 pixels ...
This looks like some "wrap-around" , what happens if the fill is in the
upper left
quarter? will the fill appear 4 times?
It appears to repeat vertically only.
You can easily try it for yourself. Just go to this URL, open a workspace, and paste your code in:
That is not really easy:) I can not copy and paste into squeakjs. And with german keyboard layout I can not even tpye an @ sign. (Firefox on Windows 7)
Does copy and paste work for other systems / browser?
Ah, Chrome works best so far. Sorry. Patches welcome ;^)
Hi Bert,
following observation:
in squeak.js, document.onkeypress = function(evt) { if (!display.vm) return true; // check for ctrl-x/c/v/r if (/[CXVR]/.test(String.fromCharCode(evt.charCode + 64)))
this test never holds (at least not with firefox on windows). The charCode is always the same, regardless whether ctrl-key is pressed or not, so it always handles those shortcuts as squeak-shortcuts (ctrl+v is handled as "paste author initials", not as "paste text to browser window") (this is not an issue for chrome, because it does not use keypress, but the keydown events for cut&paste)
changing this to
if (evt.ctrlKey && /[cxvr]/.test(String.fromCharCode(evt.charCode))) makes it working.
another issue is, that in firefox on windows, the "paste event" is never fired for non-editable htmlelements (it works for textareas and inputfields). But we can make the whole document "editable" with document.body.contentEditable = true (maybe it is enough to do this for the canvas elemement).
with this changes, copy , cut & paste are working in firefox (only tested on windows).
about typing '@' sign with german keyboard layout, I commented at the bugtracker issue https://github.com/bertfreudenberg/SqueakJS/issues/24
nicolai
How would JS react on a wrong array access? Throwing an exception?
No. It's just a no-op.
- Bert -
- Bert -
On 03.01.2016, at 14:32, Nicolai Hess nicolaihess@gmail.com wrote:
Hi Bert,
following observation:
in squeak.js, document.onkeypress = function(evt) { if (!display.vm) return true; // check for ctrl-x/c/v/r if (/[CXVR]/.test(String.fromCharCode(evt.charCode + 64)))
this test never holds (at least not with firefox on windows). The charCode is always the same, regardless whether ctrl-key is pressed or not, so it always handles those shortcuts as squeak-shortcuts (ctrl+v is handled as "paste author initials", not as "paste text to browser window") (this is not an issue for chrome, because it does not use keypress, but the keydown events for cut&paste)
changing this to
if (evt.ctrlKey && /[cxvr]/.test(String.fromCharCode(evt.charCode)))
makes it working.
another issue is, that in firefox on windows, the "paste event" is never fired for non-editable htmlelements (it works for textareas and inputfields). But we can make the whole document "editable" with document.body.contentEditable = true (maybe it is enough to do this for the canvas elemement).
with this changes, copy , cut & paste are working in firefox (only tested on windows).
We may have to make this browser-dependent :(
If we make the canvas content-editable then on iOS the browser will zoom into the canvas as soon as you tap it … which OTOH may not be worse than what we have now (but I do remember some problem which led me to disabling it again).
Fabio started working on real keyboard support for touch devices but it’s not finished yet, see https://github.com/bertfreudenberg/SqueakJS/pull/42
- Bert -
2016-01-04 21:51 GMT+01:00 Bert Freudenberg bert@freudenbergs.de:
On 03.01.2016, at 14:32, Nicolai Hess nicolaihess@gmail.com wrote:
Hi Bert,
following observation:
in squeak.js, document.onkeypress = function(evt) { if (!display.vm) return true; // check for ctrl-x/c/v/r if (/[CXVR]/.test(String.fromCharCode(evt.charCode + 64)))
this test never holds (at least not with firefox on windows). The charCode is always the same, regardless whether ctrl-key is pressed
or not, so it always handles those
shortcuts as squeak-shortcuts (ctrl+v is handled as "paste author
initials", not as "paste text to browser window")
(this is not an issue for chrome, because it does not use keypress, but
the keydown events for cut&paste)
changing this to
if (evt.ctrlKey &&
/[cxvr]/.test(String.fromCharCode(evt.charCode)))
makes it working.
another issue is, that in firefox on windows, the "paste event" is never
fired for non-editable htmlelements (it works for textareas and inputfields).
But we can make the whole document "editable" with document.body.contentEditable = true (maybe it is enough to do this for the canvas elemement).
with this changes, copy , cut & paste are working in firefox (only
tested on windows).
We may have to make this browser-dependent :(
I was afraid of that. Maybe this "trick" will work:
http://andrewduthie.com/2015/08/29/capturing-a-paste-event-in-firefox/ adding somewhere a nonvisible div area with contentEditable=true.
If we make the canvas content-editable then on iOS the browser will zoom into the canvas as soon as you tap it … which OTOH may not be worse than what we have now (but I do remember some problem which led me to disabling it again).
Fabio started working on real keyboard support for touch devices but it’s not finished yet, see https://github.com/bertfreudenberg/SqueakJS/pull/42
looks interesting.
- Bert -
vm-dev@lists.squeakfoundation.org