|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@300This uses a different value for direction and normal and the fill is defined for a larger area (800x800) -> CRASHMaybe, this is a rare bug, because, normally you don't create a small gradient t ofill a large area. But a vm crash is not nice, I would like to get thisfixed.
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) tendto overflow, especially for operations like computing the squared length of a vectorx*x+y*y -> overflow -> result is a negative number.Possible solutions:downscale prior to the multiplication -> lost of precisionuse a larger datatype for intermediate results.It looks like B2D uses the first option (look at senders of
accurateLengthOfwithandsquaredLenghtOfwithMaybe there is something wrong with the other code thatmultiplies the values, or the 16.16 bit fixed point is just notlarge enough for some fills?Any ideas?