[libbluray-devel] BDRootWindow: delay overlay opening until something visible has been drawn

hpi1 git at videolan.org
Tue Aug 9 11:13:58 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Aug  9 12:05:26 2016 +0300| [d73ff7c06a614c9241ff2653e333bfbc1124fbc0] | committer: hpi1

BDRootWindow: delay overlay opening until something visible has been drawn

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

 src/libbluray/bdj/java/java/awt/BDRootWindow.java | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/libbluray/bdj/java/java/awt/BDRootWindow.java b/src/libbluray/bdj/java/java/awt/BDRootWindow.java
index 7a0e533..ff9b257 100644
--- a/src/libbluray/bdj/java/java/awt/BDRootWindow.java
+++ b/src/libbluray/bdj/java/java/awt/BDRootWindow.java
@@ -82,6 +82,13 @@ public class BDRootWindow extends Frame {
         return null;
     }
 
+    private boolean isBackBufferClear() {
+        int v = 0;
+        for (int i = 0; i < height * width; i++)
+            v |= backBuffer[i];
+        return v == 0;
+    }
+
     public void notifyChanged() {
         if (!isVisible()) {
             logger.error("sync(): not visible");
@@ -113,6 +120,13 @@ public class BDRootWindow extends Frame {
 
             if (!a.isEmpty()) {
                 if (!overlay_open) {
+
+                    /* delay opening overlay until something has been drawn */
+                    if (isBackBufferClear()) {
+                        logger.info("sync() ignored (overlay not open, empty overlay)");
+                        return;
+                    }
+
                     Libbluray.updateGraphic(getWidth(), getHeight(), null);
                     overlay_open = true;
                     a = new Area(getWidth(), getHeight()); /* force full plane update */



More information about the libbluray-devel mailing list