[OpenJDK 2D-Dev] [9] Review Request: 8059942 Default implementation of DrawImage.renderImageXform() should be improved for d3d/ogl

Jim Graham james.graham at oracle.com
Tue Nov 11 02:43:33 UTC 2014

On 11/10/14 2:52 PM, Sergey Bylokhov wrote:
> Hi, Jim.
> To simply fill a span in the Region, I'll need to open Region.appendSpan() method,
>  but I do not want to do it.

No, that method should remain private.  All region objects should be 
fully constructed at all times when in the hands of calling code.

>  So I need to create my own EdgesSpanIterator, or totally eliminate 
this loop and
>  return Region object from the TransformHelper directly.

No, all you need is a method:

  * (describe edges array - 0,1 are y range, 2N,2N+1 are x ranges, 1 per 
y range)
  * (dxoff, dyoff are offsets that the edges array values are relative to)
static Region getInstance(int dxoff, int dyoff, int edges[]) {
     // copy loop from DrawImage.java here, but use direct manipulation
     // of the spans array instead of union operations.
     // You should be able to pre-allocate the spans array as well to
     // save on growth using appendSpan() et al.

That should take only a few minutes to write, then DrawImage simply does:

Region blitclip = Region.getInstance(dx1, dy1, edges);

> Probably some logic can be moved from TransformHelper to the java level
>(at least generation of edges array). Additionally it will be simpler to
>  check a performance improvement, because now it is not so obvious 
>  to the current percents improvement.

Unfortunately the exact calculations to compute the edges array depend 
on a lot of calculations done at the native level.  This would be a 
major repartitioning of the code...


More information about the 2d-dev mailing list