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