<Swing Dev> [9] Review request for 8153522: Update JLightweightFrame to allow non-integer (and X/Y) scales

Semyon Sadetsky semyon.sadetsky at oracle.com
Fri Oct 28 06:59:54 UTC 2016


On 10/25/2016 8:17 PM, Alexandr Scherbatiy wrote:

>
> 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.
Please review the updated webrev: 
http://cr.openjdk.java.net/~ssadetsky/8153522/webrev.01/
>
> Thanks,
> Alexandr.
>
>>
>> --Semyon
>>
>




More information about the swing-dev mailing list