[libbluray-devel] Delay opening of overlay until something is drawn.

hpi1 git at videolan.org
Sun May 26 12:21:14 CEST 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu May 23 16:56:54 2013 +0300| [4a1ac78ce1d4fca5582a2d1320442cac2f2a8402] | committer: hpi1

Delay opening of overlay until something is drawn.
Move all updateGraphics() calls to BDRootWindow.

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=4a1ac78ce1d4fca5582a2d1320442cac2f2a8402
---

 src/libbluray/bdj/java/java/awt/BDRootWindow.java  |   26 +++++++++++++++++---
 src/libbluray/bdj/java/org/videolan/BDJLoader.java |    3 ++-
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/src/libbluray/bdj/java/java/awt/BDRootWindow.java b/src/libbluray/bdj/java/java/awt/BDRootWindow.java
index c30a305..75604b5 100644
--- a/src/libbluray/bdj/java/java/awt/BDRootWindow.java
+++ b/src/libbluray/bdj/java/java/awt/BDRootWindow.java
@@ -47,10 +47,6 @@ public class BDRootWindow extends Frame {
                 }
             }
             super.setBounds(x, y, width, height);
-
-            Libbluray.updateGraphic(width, height, null);
-
-            dirty.add(new Rectangle(0, 0, width - 1, height - 1));
         }
     }
 
@@ -90,6 +86,11 @@ public class BDRootWindow extends Frame {
             dirty.clear();
 
             if (!a.isEmpty()) {
+                if (!overlay_open) {
+                    Libbluray.updateGraphic(getWidth(), getHeight(), null);
+                    overlay_open = true;
+                    a = new Area(getWidth(), getHeight()); /* force full plane update */
+                }
                 Libbluray.updateGraphic(getWidth(), getHeight(), backBuffer, a.x0, a.y0, a.x1, a.y1);
             }
         }
@@ -114,6 +115,22 @@ public class BDRootWindow extends Frame {
         private int changeCount;
     }
 
+    private void close() {
+        if (overlay_open) {
+            Libbluray.updateGraphic(0, 0, null);
+            overlay_open = false;
+        }
+    }
+
+    public void setVisible(boolean visible) {
+
+        super.setVisible(visible);
+
+        if (!visible) {
+            close();
+        }
+    }
+
     public void dispose()
     {
         if (isVisible()) {
@@ -138,6 +155,7 @@ public class BDRootWindow extends Frame {
     private int changeCount = 0;
     private Timer timer = new Timer();
     private TimerTask timerTask = null;
+    private boolean overlay_open = false;
 
     private static final long serialVersionUID = -8325961861529007953L;
 }
diff --git a/src/libbluray/bdj/java/org/videolan/BDJLoader.java b/src/libbluray/bdj/java/org/videolan/BDJLoader.java
index 991d255..8f77242 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJLoader.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJLoader.java
@@ -215,7 +215,8 @@ public class BDJLoader {
             }
             ((BDJAppsDatabase)db).newDatabase(null, null);
 
-            Libbluray.updateGraphic(0, 0, null);
+            //GUIManager.shutdown() does not work with J2ME (window can't be opened again)
+            GUIManager.getInstance().setVisible(false);
 
             return true;
         } catch (Throwable e) {



More information about the libbluray-devel mailing list