Opened 11 years ago

Closed 5 years ago

#2945 closed bug (fixed)

BGradient draws junk when endpoints are not fully defined

Reported by: sdeken Owned by: aldeck
Priority: normal Milestone: R1
Component: Kits/Interface Kit Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

To reproduce: Construct, for example, a radial gradient with two defined endpoints:

BPoint center(50, 50);
float radius = 50.0;
BGradientRadial g(center, radius);
g.AddColor((rgb_color){ 255, 255, 255, 255 }, 0.0);
g.AddColor((rgb_color){ 255, 0, 0, 255 }, 10.0);
FillEllipse(center, radius, radius, g);    

Actual result: Part of the center portion of the ellipse is filled with a transition from white to red, but the remainder is filled with concentric bands of random color.

Expected result: Part of the center portion of the ellipse is filled with a transition from white to red, and the remainder of the ellipse is filled with red.

Change History (5)

comment:1 by stippi, 10 years ago

Owner: changed from axeld to stippi
Status: newassigned

comment:2 by stippi, 10 years ago

Status: assignednew

comment:3 by aldeck, 7 years ago

Owner: changed from stippi to aldeck
Status: newin-progress

Spotted the problem while working on a webkit bug. Color stops positions are in the range 0-255. If the first color stop position is > 0, then the begining of the gradient array is left uninitialized. Respectively for the last stop if it's not at 255.

Will fix soon. Btw what's the opinion about making the range 0.0f - 1.0f ? it's already a float.

Also, an out of range value (v < 0 or v > 255) crashes the app server. We need some validity checking.

in reply to:  3 comment:4 by axeld, 7 years ago

Replying to aldeck:

Will fix soon. Btw what's the opinion about making the range 0.0f - 1.0f ? it's already a float.

Makes sense to me, at least.

Also, an out of range value (v < 0 or v > 255) crashes the app server. We need some validity checking.

Sounds like it :-)

comment:5 by pulkomandy, 5 years ago

Resolution: fixed
Status: in-progressclosed

Fixed in hrev48447.

Note: See TracTickets for help on using tickets.