[OpenJDK Rasterizer] RFR: Marlin renderer #3

Laurent Bourgès bourges.laurent at gmail.com
Thu Jun 25 19:50:50 UTC 2015


Jim,

> I take it the comments are copied from StrictMath and so the code may not
always follow their guidelines (if you set CHECK_NAN to false for instance).

Yes you're right: comments should be updated. Float values are expected to
be in MIN/MAX integer domain including NaN and +/- Infinity.

Marlin use cases:
- ceil:
1/ addLine: it serves to check if points are within clip bbox (integer) and
compute first/ last crossings.
But later crossings are computed in endRendering from float maths but just
casted to int : it seems incorrect /inconsistent to me !

Maybe DDA or floor (val) or ceil (val + 0.5) should be used instead in both
places ?
But it will be slower... so DDA seems the only fast and probably correct
approach but It may be tricky too to implement properly. Do you know how to
do it well ?

However as coords are clipped to the integer domain, it is correct.

How to deal with a NaN coord ? I suppose no line should be renderered but
it may cause artefacts...

2/ Determine edgeBucket used range: correct too.

- Floor: it is used by NormalizingPathIterator to compute x/ adjust values
= 0.5 - fractional_part (coord).
Here the possible values may be in the full float domain !

Probably I should use a correct Floor impl as before or propose a new
method to compute the fractional part directly.
Fract = coord - floor (coord) = coord % 1f

Any idea?
Again how to deal with NaN / Inf values in this case ?

> I notice that CHECK_NAN is false, but you get the right result below. Do
you also get the right result for the Floor function?

It works well if CHECK_NAN is true so I will enable it back.

I tested also Floor but it is only correct for abs (values) <= MAX_INTEGER.

> You might want to add a unit test case for this.  Have you done that
before?

I started writing a test derived from CeilAndFloorTest (Math) and it works
well in the integer domain.

> Also, if you have write access to that bug, feel free to add your
comments.  Were you looking for a more direct dialog?  I could track
someone down for you to discuss with.  I've usually talked with Joe Darcy
about these things, but let me see if you has spare cycles for a
conversation first if you want to go that route...

I will first try adding comments... but probably I need help from Math
experts !

Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/graphics-rasterizer-dev/attachments/20150625/46362e86/attachment.html>


More information about the graphics-rasterizer-dev mailing list