[OpenJDK 2D-Dev] Openjdk java2d rasterizer JEP for pisces (marlin) enhancements ?
Jim Graham
james.graham at oracle.com
Tue Feb 24 17:45:28 UTC 2015
Ah, wait, those constructors do copy the arrays without having to
iterate the segments and grow the arrays, but they don't trim them. I'm
trying to remember if there was a specific reason that we decided not to
trim the arrays in those constructors, but the only "advantage" I can
think of is that the new copy will have the same potential spare room
for growth that the original had. But that is of questionable value so
we should probably just patch the existing "construct from a Shape"
constructors to trim the arrays to the required length instead...
...jim
On 2/24/15 9:33 AM, Jim Graham wrote:
> Hi Laurent,
>
> On 2/24/15 6:51 AM, Laurent Bourgès wrote:
>> FastPath2D would be public API. Perhaps that should be a separate
>> discussion
>>
>>
>> FastPath2D is only a improvement of the Path2D class to trim arrays in
>> the clone() method but there is another solution: provide a new Path2D
>> constructor with given data arrays.
>> I agree it is another topic but really used by marlin to avoid too many
>> array resizing.
>
> Why not just use new Path2D.Float(oldpath2d)? It trims the arrays of
> the source Path2D with minimal allocation waste...
>
> ...jim
More information about the 2d-dev
mailing list