On 9/29/2016 10:55 AM, Semyon Sadetsky wrote:
Hello,

Please review fix for JDK9:

bug: https://bugs.openjdk.java.net/browse/JDK-8153522

webrev: http://cr.openjdk.java.net/~ssadetsky/8153522/webrev.00/

LightweightFrame Swing embedding API is updated for capability with floating point scale to make JavaFX SwingNode correctly shown on Windows platform.

Backward API compatibility is preserved but methods with old signatures are marked as deprecated.

JLightweightFrame

 155                     new Rectangle(0, 0,
156 (int)Math.round(bbImage.getWidth() / scaleFactorX), 157 (int)Math.round(bbImage.getHeight() / scaleFactorY)));

 303             int startX = (int)(x * scaleX);
 304             int startY = (int)(y * scaleY);
 305             int width  = (int)((x + w) * scaleX + 0.5) - startX;
 306             int height = (int)((y + h) * scaleY + 0.5) - startY;

The usual rule is to use Math.floor() for the top left corner of a region and Math.ceil() for for the right bottom corner.

171 imageBufferReset(data, x, y, width, height, linestride, (int)scaleX);

May be it is better to use Math.round() here for the scale rounding.

Thanks,
Alexandr.


--Semyon


Reply via email to