[libbluray-devel] Lock frame buffer updates while drawing. Fixes tearing issues.
hpi1
git at videolan.org
Sun Jul 28 22:52:53 CEST 2013
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Jul 28 23:01:42 2013 +0300| [d462eb7db3cc49fc9a2ed149ebe36b75d9c0a08b] | committer: hpi1
Lock frame buffer updates while drawing. Fixes tearing issues.
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=d462eb7db3cc49fc9a2ed149ebe36b75d9c0a08b
---
.../bdj/java/java/awt/BDWindowGraphics.java | 105 +++++++++++++-------
1 file changed, 69 insertions(+), 36 deletions(-)
diff --git a/src/libbluray/bdj/java/java/awt/BDWindowGraphics.java b/src/libbluray/bdj/java/java/awt/BDWindowGraphics.java
index 1efc50b..4faaf4d 100644
--- a/src/libbluray/bdj/java/java/awt/BDWindowGraphics.java
+++ b/src/libbluray/bdj/java/java/awt/BDWindowGraphics.java
@@ -39,78 +39,108 @@ public class BDWindowGraphics extends BDGraphics {
}
public void clearRect(int x, int y, int w, int h) {
- super.clearRect(x, y, w, h);
- window.notifyChanged();
+ synchronized (window) {
+ super.clearRect(x, y, w, h);
+ window.notifyChanged();
+ }
}
public void fillRect(int x, int y, int w, int h) {
- super.fillRect(x, y, w, h);
- window.notifyChanged();
+ synchronized (window) {
+ super.fillRect(x, y, w, h);
+ window.notifyChanged();
+ }
}
public void drawRect(int x, int y, int w, int h) {
- super.drawRect(x, y, w, h);
- window.notifyChanged();
+ synchronized (window) {
+ super.drawRect(x, y, w, h);
+ window.notifyChanged();
+ }
}
public void drawLine(int x1, int y1, int x2, int y2) {
- super.drawLine(x1, y1, x2, y2);
- window.notifyChanged();
+ synchronized (window) {
+ super.drawLine(x1, y1, x2, y2);
+ window.notifyChanged();
+ }
}
public void copyArea(int x, int y, int w, int h, int dx, int dy) {
- super.copyArea(x, y, w, h, dx, dy);
- window.notifyChanged();
+ synchronized (window) {
+ super.copyArea(x, y, w, h, dx, dy);
+ window.notifyChanged();
+ }
}
public void drawPolyline(int xPoints[], int yPoints[], int nPoints) {
- super.drawPolyline(xPoints, yPoints, nPoints);
- window.notifyChanged();
+ synchronized (window) {
+ super.drawPolyline(xPoints, yPoints, nPoints);
+ window.notifyChanged();
+ }
}
public void drawPolygon(int xPoints[], int yPoints[], int nPoints) {
- super.drawPolygon(xPoints, yPoints, nPoints);
- window.notifyChanged();
+ synchronized (window) {
+ super.drawPolygon(xPoints, yPoints, nPoints);
+ window.notifyChanged();
+ }
}
public void fillPolygon(int xPoints[], int yPoints[], int nPoints) {
- super.fillPolygon(xPoints, yPoints, nPoints);
- window.notifyChanged();
+ synchronized (window) {
+ super.fillPolygon(xPoints, yPoints, nPoints);
+ window.notifyChanged();
+ }
}
public void drawOval(int x, int y, int w, int h) {
- super.drawOval(x, y, w, h);
- window.notifyChanged();
+ synchronized (window) {
+ super.drawOval(x, y, w, h);
+ window.notifyChanged();
+ }
}
public void fillOval(int x, int y, int w, int h) {
- super.fillOval(x, y, w, h);
- window.notifyChanged();
+ synchronized (window) {
+ super.fillOval(x, y, w, h);
+ window.notifyChanged();
+ }
}
public void drawArc(int x, int y, int w, int h, int startAngle, int endAngle) {
- super.drawArc(x, y, w, h, startAngle, endAngle);
- window.notifyChanged();
+ synchronized (window) {
+ super.drawArc(x, y, w, h, startAngle, endAngle);
+ window.notifyChanged();
+ }
}
public void fillArc(int x, int y, int w, int h, int startAngle, int endAngle) {
- super.fillArc(x, y, w, h, startAngle, endAngle);
- window.notifyChanged();
+ synchronized (window) {
+ super.fillArc(x, y, w, h, startAngle, endAngle);
+ window.notifyChanged();
+ }
}
public void drawRoundRect(int x, int y, int w, int h, int arcWidth, int arcHeight) {
- super.drawRoundRect(x, y, w, h, arcWidth, arcHeight);
- window.notifyChanged();
+ synchronized (window) {
+ super.drawRoundRect(x, y, w, h, arcWidth, arcHeight);
+ window.notifyChanged();
+ }
}
public void fillRoundRect(int x, int y, int w, int h, int arcWidth, int arcHeight) {
- super.fillRoundRect(x, y, w, h, arcWidth, arcHeight);
- window.notifyChanged();
+ synchronized (window) {
+ super.fillRoundRect(x, y, w, h, arcWidth, arcHeight);
+ window.notifyChanged();
+ }
}
public void drawStringN(long ftFace, String string, int x, int y, int rgb) {
- super.drawStringN(ftFace, string, x, y, rgb);
- window.notifyChanged();
+ synchronized (window) {
+ super.drawStringN(ftFace, string, x, y, rgb);
+ window.notifyChanged();
+ }
}
public void dispose() {
@@ -122,12 +152,15 @@ public class BDWindowGraphics extends BDGraphics {
int dx, int dy, int dw, int dh,
int sx, int sy, int sw, int sh,
Color bg, ImageObserver observer) {
- boolean complete = super.drawImageN(
- img, dx, dy, dw, dh, sx, sy, sw, sh,
- bg, observer);
- if (complete) {
- window.notifyChanged();
+
+ synchronized (window) {
+ boolean complete = super.drawImageN(
+ img, dx, dy, dw, dh, sx, sy, sw, sh,
+ bg, observer);
+ if (complete) {
+ window.notifyChanged();
+ }
+ return complete;
}
- return complete;
}
}
More information about the libbluray-devel
mailing list