From 596d9dc628111a6bd0a28da688a6d6f133ed0c8f Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Wed, 19 Jan 2022 17:46:47 -0500 Subject: [PATCH] wow, removing the image buffer for components --- app/src/processing/app/ui/EditorHeader.java | 35 +-------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/app/src/processing/app/ui/EditorHeader.java b/app/src/processing/app/ui/EditorHeader.java index a179e8930..4360c3001 100644 --- a/app/src/processing/app/ui/EditorHeader.java +++ b/app/src/processing/app/ui/EditorHeader.java @@ -159,44 +159,13 @@ public class EditorHeader extends JComponent { public void paintComponent(Graphics g) { if (g == null) return; Sketch sketch = editor.getSketch(); - if (sketch == null) return; // possible? - - /* - Dimension size = getSize(); - if ((size.width != sizeW) || (size.height != sizeH)) { - // component has been resized - - if ((size.width > imageW) || (size.height > imageH)) { - // nix the image and recreate, it's too small - offscreen = null; - - } else { - // if the image is larger than necessary, no need to change - sizeW = size.width; - sizeH = size.height; - } - } - - if (offscreen == null) { - sizeW = size.width; - sizeH = size.height; - imageW = sizeW; - imageH = sizeH; - offscreen = Toolkit.offscreenGraphics(this, imageW, imageH); - } - - Graphics g = offscreen.getGraphics(); - */ - //System.out.println("is double: " + isDoubleBuffered()); + if (sketch == null) return; // is this even possible? g.setFont(font); // need to set this each time through if (fontAscent == 0) { fontAscent = (int) Toolkit.getAscent(g); } - //Graphics2D g2 = Toolkit.prepareGraphics(g); - //g.drawImage(gradient, 0, 0, imageW, imageH, this); - Graphics2D g2 = (Graphics2D) g; Dimension size = getSize(); g.drawImage(gradient, 0, 0, size.width, size.height, this); @@ -283,8 +252,6 @@ public class EditorHeader extends JComponent { trianglePath.lineTo((x1 + x2) / 2, ARROW_BOTTOM); trianglePath.closePath(); g2.fill(trianglePath); - - //screen.drawImage(offscreen, 0, 0, imageW, imageH, null); }