On 10/10/16 11:55 AM, Sergey Bylokhov wrote:
On 10.10.16 21:31, Jim Graham wrote:
OK, but you only need a line width of 2.0 to cover the gap regardless of
scale.  Line width scales in user space so larger scales scale up the
line width along with the clip region being rendered.  With
STROKE_CONTROL on, 2.0 is plenty because the line is normalized (though
I'm not sure the test should assume that).  WITH STROKE_PURE, 2.0 is
precisely exactly the right amount.  Round-off error might theoretically
bite us, so maybe 2.01 just to be safe.

When I tried to use w=2/3/4/5 I got a situation when no lines are drawn to the 
image. I guess to paint something we need
to cover at least half of the pixel, this is not the case when line is w=2 and 
small scale is used.

I think I see the problem.

With STROKE_NORMALIZE and a very tiny scale and a small line width you will not reach the center of a pixel from the x,y=0.25 offset that our implementation normalizes lines to. At .1 scale you'd need to cover .25 units to reach that pixel center so you'd need a larger line width. Since only half of the line happens on either side of the line, a line width of 5 at .1 scale only draws .25 on either side and even though that reaches the pixel center, it doesn't light up the pixel center because that would be the right (or bottom) side of the fillable area and a pixel is not rendered if its center falls on the right or bottom edge of a fillable region, so you would need to go to 6 to see something at .1 scale. If you turn off NORMALIZE and use PURE, then the line would track along with the clip location.

I'm not sure why you are testing NORMALIZE behavior since the NORMALIZE behavior is not a formal spec since there are several ways to achieve its goals. The way we implement it 6 is enough for the lines to appear at .1 scale, but someone else might decide that normalizing lines to the pixel edges is better for some reason and then you'd need to have a line width of 11 to light up the pixels. Note that we use 0.5,0.5 for AA rendering because its needs are different, so our own implementation isn't even consistent about the bias used for NORMALIZE (though since you aren't testing AA, you will only encounter our 0.25 bias).

If you switch to PURE then 2 (or 2.01 to be safe) would suffice...

                                ...jim

Reply via email to