[OpenJDK 2D-Dev] Review Request: Small tweak in the DrawImage.java

Jim Graham james.graham at oracle.com
Thu Nov 12 20:46:02 UTC 2015

Hi Sergey,

I think the added logic is fine, but I would hesitate removing all of 
those lines with comments simply because:

- In terms of code generated it is no more efficient to do the tests up 
above or down below.

- Your question below does not indicate enough investigation to remove 
that big long reminder, even if it is true that other pipelines need to 
have similar tests.  Keep in mind that this is a reminder of why not to 
remove those checks even if they look like they don't really help 
anything and the amount of work it would take to eliminate them should 
we want to do that in the future...


On 11/12/2015 5:45 AM, Sergey Bylokhov wrote:
> Hello.
> Can somebody take a look to the small enhancement for DrawImage.java.
> I will file a new CR if the proposed change will be approved:
> http://cr.openjdk.java.net/~serb/perf/DrawImageItself.01/src/java.desktop/share/classes/sun/java2d/pipe/DrawImage.java.sdiff.html
> The goal is to minimize the calls to Blit.Blit/BlitBG() if we know that
> it will be noop.
> The reasons to the fix:
>   - Not all blits are fast when the source and destination are the same.
> For example ByteBinary variants are quite slow.
>   - In case of d3d and ogl such blit change the whole state of the
> render context and can slowdown the rendering to another destination.
> Notes:
>   - In the common situation one additional statement "srcData ==
> dstData" will be executed.
>   - The comment about the 4783274 was removed, because I am not sure we
> really should copy this check from this particular method to all java
> blits?
>   - Probably some other checks can be added as well? What about
> clipRegion.intersectsQuickCheckXYXY(dx,dy,dx+w,dy+h)?

More information about the 2d-dev mailing list