<Swing Dev> [13] RFR JDK-8213535:Windows HiDPI html lightweight tooltips are truncated

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Mon Jul 1 10:25:40 UTC 2019



On 15-Apr-19 11:36 PM, Sergey Bylokhov wrote:
> On 14/04/2019 22:24, Prasanta Sadhukhan wrote:
>>> Currently this rectangle is created based on the size of the 
>>> component, so this rectangle is smaller that the size.
>>> But it looks like after the fix the rectangle will be bigger. 
>>> Probably the bug exists in getPreferredSize() where we return small 
>>> size?
>>>
I have modified the fix to scale the size in getPreferredSize() as asked.
http://cr.openjdk.java.net/~psadhukhan/8213535/webrev.1/

Regards
Prasanta
>>> Can you please confirm that this check will always work as expected:
>>> 176             if 
>>> (!font.getTransform().equals(((Graphics2D)g).getTransform())) {
>>> 177                 AffineTransform tx = ((Graphics2D) 
>>> g).getTransform();
>>> 178                 double scaleX = tx.getScaleX();
>>> 179                 double scaleY = tx.getScaleY();
>>> 180                 paintTextR.width = (int) 
>>> Math.ceil(paintTextR.width * scaleX);
>>> 181                 paintTextR.height = (int) 
>>> Math.ceil(paintTextR.height * scaleY);
>>> 182             }
>>> 183             v.paint(g, paintTextR);
>>>
>> I have checked the regression tests for JToolTip with this fix 
>> without any issue.
>>> In what coordinate space the final paintTextR will be? I assume that 
>>> that the v.paint() expects coordinate in the users space.
>>>
>> Iguess the paintTextR will be in user space as BasicHTML.paint() says 
>> the rectangle as the region to render to.
>
> But your conversion "size*scale" will convert the size of the 
> component to the device space.
> It is still unclear how we will draw the text in the v.paint() in the 
> rectangle, which is bigger than the size of the related component?
>
>
>



More information about the swing-dev mailing list