New issue
Advanced search Search tips
Starred by 4 users
Status: Fixed
Closed: Oct 16
Area: ----
Priority: Low
Type: Defect

Sign in to add a comment
Software 2pt Conical Gradient Bug When Circles just not Touching
Project Member Reported by, Apr 10 2014 Back to list
What steps will reproduce the problem?

Case 1: General code sketch to make top half of box disappear:

SkRect r = (0,0,100,100)

EndCenter = (50,50)
EndRadius = 100.0 / 3.0;
StartCenter = (EndCenter.x, EndCenter.y + EndRadius + 0.001);
StartRadius = 0.0;

Shader = CreateTwoPointConical(startCenter, StartRadius, EndCenter, EndRadius, ...) //can simply use two color gradients at 0 and 1 here

canvas.drawRect(r, paint);

Case2: To add mysterious lines below where circles touch, change the one line:

StartCenter = (EndCenter.x, EndCenter.y + EndRadius - 0.0001);

What is the expected output? What do you see instead?

For the first case, the expected result is to cut off the bottom part of the square where the start radius pops out of the large one and the top part of the square is completely drawn. In reality the bottom is getting chopped correctly but part of the top of the rect is also being chopped.

For case 2, depending on numerical issues, either the entire rect should be drawn with gradient inside large circle (if numeric comps put the small circle inside the large one), or to simply chop off bottom right at edge of circle. In reality we add a few extra rows of pixels below circle (compare this to case when the circle sits right on top of edge). 

Please use labels and text to provide additional information.

Project Member Comment 1 by, Dec 7 2015
Labels: Hotlist-Fixit
Project Member Comment 2 by, Mar 5 2016
over to the new gradient master
Project Member Comment 3 by, Oct 16
Status: Fixed
These corner cases are fixed after the sw gradient rewrite:
Sign in to add a comment