mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 22:47:13 -06:00
always reset our graphics rendering hints
(this is usually not necessary because each component gets its own instance of Graphics when painting, but resetting may avoid side effects if our paint methods are invoked directly)
This commit is contained in:
@@ -180,7 +180,7 @@ public class FlatPaintingStringTest
|
||||
@Override
|
||||
protected void paintComponent( Graphics g ) {
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
FlatUIUtils.setRenderingHints( g2 );
|
||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g2 );
|
||||
|
||||
// simulate component y position at a fraction
|
||||
if( scaleFactor > 1 && SystemInfo.isJava_9_orLater )
|
||||
@@ -241,6 +241,8 @@ public class FlatPaintingStringTest
|
||||
double textY = t.getTranslateY() + (y * t.getScaleY());
|
||||
setToolTipText( textY + " + " + yCorrection + " = " + (textY + yCorrection) );
|
||||
}
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g2, oldRenderingHints );
|
||||
}
|
||||
|
||||
private int scale( int value ) {
|
||||
|
||||
@@ -471,7 +471,7 @@ public class FlatPaintingTest
|
||||
@Override
|
||||
protected void paintComponent( Graphics g ) {
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
FlatUIUtils.setRenderingHints( g2 );
|
||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g2 );
|
||||
|
||||
g2.scale( scale, scale );
|
||||
g2.translate( 1, 1 );
|
||||
@@ -503,6 +503,8 @@ public class FlatPaintingTest
|
||||
g2d.setColor( Color.magenta );
|
||||
g2d.drawRect( x2 - gap, y2 - gap, width2 + (gap * 2) - 1, height2 + (gap * 2) - 1 );
|
||||
} );
|
||||
|
||||
FlatUIUtils.resetRenderingHints( g2, oldRenderingHints );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user