mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-28 07:28:20 -04:00
small improvement on redraw heap load
This commit is contained in:
parent
e1cbde1d44
commit
303411a0b3
@ -45,12 +45,12 @@
|
||||
<visualElement>
|
||||
<elementName>VDD</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="520" y="260"/>
|
||||
<pos x="520" y="280"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Ground</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="520" y="580"/>
|
||||
<pos x="520" y="560"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>NFET</elementName>
|
||||
@ -156,12 +156,18 @@
|
||||
</elementAttributes>
|
||||
<pos x="580" y="520"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>VDD</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="380" y="280"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Ground</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="380" y="440"/>
|
||||
</visualElement>
|
||||
</visualElements>
|
||||
<wires>
|
||||
<wire>
|
||||
<p1 x="380" y="560"/>
|
||||
<p2 x="520" y="560"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="480"/>
|
||||
<p2 x="480" y="480"/>
|
||||
@ -182,10 +188,6 @@
|
||||
<p1 x="340" y="420"/>
|
||||
<p2 x="360" y="420"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="280"/>
|
||||
<p2 x="520" y="280"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="360"/>
|
||||
<p2 x="500" y="360"/>
|
||||
@ -219,8 +221,8 @@
|
||||
<p2 x="340" y="540"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="520" y="260"/>
|
||||
<p2 x="520" y="280"/>
|
||||
<p1 x="520" y="280"/>
|
||||
<p2 x="520" y="300"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="520" y="340"/>
|
||||
@ -238,14 +240,6 @@
|
||||
<p1 x="520" y="540"/>
|
||||
<p2 x="520" y="560"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="520" y="560"/>
|
||||
<p2 x="520" y="580"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="520" y="280"/>
|
||||
<p2 x="520" y="300"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="520" y="420"/>
|
||||
<p2 x="520" y="440"/>
|
||||
@ -264,7 +258,7 @@
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="420"/>
|
||||
<p2 x="380" y="560"/>
|
||||
<p2 x="380" y="440"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="360"/>
|
||||
|
@ -377,7 +377,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds alle the wires representing the given value to the highlighted list
|
||||
* Adds all the wires representing the given value to the highlighted list
|
||||
*
|
||||
* @param values the value
|
||||
*/
|
||||
@ -399,7 +399,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
||||
}
|
||||
|
||||
/**
|
||||
* Addes the given element to insert to the circuit
|
||||
* Adds the given element to insert to the circuit
|
||||
*
|
||||
* @param element the element to insert
|
||||
*/
|
||||
@ -415,14 +415,18 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
||||
protected void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
|
||||
if (hasChanged
|
||||
|| buffer == null
|
||||
boolean needsNewBuffer = buffer == null
|
||||
|| getWidth() != buffer.getWidth()
|
||||
|| getHeight() != buffer.getHeight()
|
||||
|| getHeight() != buffer.getHeight();
|
||||
|
||||
if (hasChanged
|
||||
|| needsNewBuffer
|
||||
|| highLighted.size() != highlightedPaintedSize) {
|
||||
|
||||
// long time = System.currentTimeMillis();
|
||||
buffer = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(getWidth(), getHeight());
|
||||
if (needsNewBuffer)
|
||||
buffer = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(getWidth(), getHeight());
|
||||
|
||||
Graphics2D gr2 = buffer.createGraphics();
|
||||
gr2.setColor(Color.WHITE);
|
||||
gr2.fillRect(0, 0, getWidth(), getHeight());
|
||||
|
Loading…
x
Reference in New Issue
Block a user