[libbluray-devel] Updated setting frame buffer dirty area
hpi1
git at videolan.org
Tue Apr 23 22:04:56 CEST 2013
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Apr 23 15:26:03 2013 +0300| [32b89b037aa01aa2f3bbbf1a97fcf46c1ad50e4a] | committer: hpi1
Updated setting frame buffer dirty area
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=32b89b037aa01aa2f3bbbf1a97fcf46c1ad50e4a
---
.../bdj/java-j2me/java/awt/BDGraphics.java | 28 ++------------------
.../bdj/java-j2se/java/awt/BDGraphics.java | 9 +++++++
src/libbluray/bdj/java/java/awt/BDRootWindow.java | 3 +--
3 files changed, 12 insertions(+), 28 deletions(-)
diff --git a/src/libbluray/bdj/java-j2me/java/awt/BDGraphics.java b/src/libbluray/bdj/java-j2me/java/awt/BDGraphics.java
index b430fb5..c55af5d 100644
--- a/src/libbluray/bdj/java-j2me/java/awt/BDGraphics.java
+++ b/src/libbluray/bdj/java-j2me/java/awt/BDGraphics.java
@@ -84,14 +84,6 @@ class BDGraphics extends Graphics2D implements ConstrainableGraphics {
actualClip = g.clip;
clip = g.clip;
constrainedRect = g.constrainedRect;
-
- //public Recangle getDirtyRect() {
- //return dirty;
- //}
- //dirty.x = width;
- //dirty.y = height;
- //dirty.width = 0;
- //dirty.height = 0;
}
BDGraphics(BDRootWindow window) {
@@ -135,11 +127,6 @@ class BDGraphics extends Graphics2D implements ConstrainableGraphics {
fontMetrics = BDFontMetrics.getFontMetrics(font);
composite = AlphaComposite.SrcOver;
setupClip();
-
- dirty.x = width;
- dirty.y = height;
- dirty.width = 0;
- dirty.height = 0;
}
public Graphics create() {
@@ -295,10 +282,7 @@ class BDGraphics extends Graphics2D implements ConstrainableGraphics {
private void drawPointN(int x, int y, int rgb) {
- if (x < dirty.x) dirty.x = x;
- else if (x > dirty.width) dirty.width = x;
- if (y < dirty.y) dirty.y = y;
- else if (y > dirty.height) dirty.height = y;
+ dirty.add(x, y);
if (xorColor != null) {
backBuffer[y * width + x] ^= xorColor.getRGB() ^ rgb;
@@ -350,10 +334,7 @@ class BDGraphics extends Graphics2D implements ConstrainableGraphics {
for (int i = 0; i < h; i++)
Arrays.fill(backBuffer, (y + i) * width + x, (y + i) * width + x + w, rgb);
- if (x < dirty.x) dirty.x = x;
- else if (x + w > dirty.width) dirty.width = x + w;
- if (y < dirty.y) dirty.y = y;
- else if (y + h > dirty.height) dirty.height = y + h;
+ dirty.add(rect);
}
public void fillRect(int x, int y, int w, int h) {
@@ -369,11 +350,6 @@ class BDGraphics extends Graphics2D implements ConstrainableGraphics {
for (int Y = y; Y < (y + h); Y++)
for (int X = x; X < (x + w); X++)
drawPointN(X, Y, rgb);
-
- if (x < dirty.x) dirty.x = x;
- else if (x + w > dirty.width) dirty.width = x + w;
- if (y < dirty.y) dirty.y = y;
- else if (y + h > dirty.height) dirty.height = y + h;
}
public void drawRect(int x, int y, int w, int h) {
diff --git a/src/libbluray/bdj/java-j2se/java/awt/BDGraphics.java b/src/libbluray/bdj/java-j2se/java/awt/BDGraphics.java
index 918c511..4fb9005 100644
--- a/src/libbluray/bdj/java-j2se/java/awt/BDGraphics.java
+++ b/src/libbluray/bdj/java-j2se/java/awt/BDGraphics.java
@@ -44,6 +44,7 @@ class BDGraphics extends Graphics2D implements ConstrainableGraphics {
private int width;
private int height;
private int[] backBuffer;
+ private Rectangle dirty;
private GraphicsConfiguration gc;
private Color foreground;
private Color background;
@@ -74,6 +75,7 @@ class BDGraphics extends Graphics2D implements ConstrainableGraphics {
BDGraphics(BDGraphics g) {
backBuffer = g.backBuffer;
+ dirty = g.dirty;
width = g.width;
height = g.height;
gc = g.gc;
@@ -95,6 +97,7 @@ class BDGraphics extends Graphics2D implements ConstrainableGraphics {
width = window.getWidth();
height = window.getHeight();
backBuffer = window.getBdBackBuffer();
+ dirty = window.getDirtyRect();
gc = window.getGraphicsConfiguration();
foreground = window.getForeground();
background = window.getBackground();
@@ -121,6 +124,7 @@ class BDGraphics extends Graphics2D implements ConstrainableGraphics {
width = image.getWidth();
height = image.getHeight();
backBuffer = image.getBdBackBuffer();
+ dirty = image.getDirtyRect();
gc = image.getGraphicsConfiguration();
Component component = image.getComponent();
@@ -362,6 +366,9 @@ class BDGraphics extends Graphics2D implements ConstrainableGraphics {
}
private void drawPointN(int x, int y, int rgb) {
+
+ dirty.add(x, y);
+
if (xorColor != null) {
backBuffer[y * width + x] ^= xorColor.getRGB() ^ rgb;
return;
@@ -405,6 +412,8 @@ class BDGraphics extends Graphics2D implements ConstrainableGraphics {
int rgb = background.getRGB();
for (int i = 0; i < h; i++)
Arrays.fill(backBuffer, (y + i) * width + x, (y + i) * width + x + w, rgb);
+
+ dirty.add(rect);
}
public void fillRect(int x, int y, int w, int h) {
diff --git a/src/libbluray/bdj/java/java/awt/BDRootWindow.java b/src/libbluray/bdj/java/java/awt/BDRootWindow.java
index 78b1441..1f8829d 100644
--- a/src/libbluray/bdj/java/java/awt/BDRootWindow.java
+++ b/src/libbluray/bdj/java/java/awt/BDRootWindow.java
@@ -43,7 +43,6 @@ public class BDRootWindow extends Frame {
if ((width > 0) && (height > 0)) {
if ((backBuffer == null) || (getWidth() * getHeight() < width * height)) {
backBuffer = new int[width * height];
- dirty = new Rectangle(0, 0, width, height);
Arrays.fill(backBuffer, 0);
}
}
@@ -51,7 +50,7 @@ public class BDRootWindow extends Frame {
Libbluray.updateGraphic(width, height, null);
- dirty.setBounds(0, 0, width, height);
+ dirty.setBounds(0, 0, width - 1, height - 1);
}
}
More information about the libbluray-devel
mailing list