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:
Karl Tauber
2020-12-18 13:25:04 +01:00
parent 956001dbd7
commit 435068515a
10 changed files with 33 additions and 17 deletions

View File

@@ -218,7 +218,7 @@ public class FlatDatePickerUI
FlatUIUtils.paintParentBackground( g, c );
Graphics2D g2 = (Graphics2D) g;
FlatUIUtils.setRenderingHints( g2 );
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g2 );
int width = c.getWidth();
int height = c.getHeight();
@@ -252,6 +252,8 @@ public class FlatDatePickerUI
g2.fill( new Rectangle2D.Float( lx, focusWidth, lw, height - 1 - (focusWidth * 2) ) );
paint( g, c );
FlatUIUtils.resetRenderingHints( g2, oldRenderingHints );
}
//---- class DefaultEditor ------------------------------------------------

View File

@@ -146,7 +146,7 @@ public class FlatTaskPaneUI
if( color == null )
return;
FlatUIUtils.setRenderingHints( (Graphics2D) g );
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
g.setColor( color );
@@ -155,6 +155,8 @@ public class FlatTaskPaneUI
path.append( new Rectangle2D.Float( x, y, width, height ), false );
path.append( new Rectangle2D.Float( x + lineWidth, y, width - (lineWidth * 2), height - lineWidth ), false );
((Graphics2D)g).fill( path );
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
}
@Override
@@ -179,9 +181,11 @@ public class FlatTaskPaneUI
{
@Override
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
FlatUIUtils.setRenderingHints( (Graphics2D) g );
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
super.paintBorder( c, g, x, y, width, height );
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
}
@Override