[libbluray-devel] Fixed menus where button size changes: if new object is smaller than currently visible object, render background.

hpi1 git at videolan.org
Thu Dec 8 15:19:44 CET 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Dec  8 15:53:52 2011 +0200| [63e308d9c6ce1cd361fed713620fab16d67a84e1] | committer: hpi1

Fixed menus where button size changes: if new object is smaller than currently visible object, render background.
Fixes BD "Earth" menus.

FIXME:
If area to be wiped is partially drawn, overlapping button should be
redrawn after wipe. Currently background is not wiped if something
has been drawn there already.

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

 ChangeLog                                    |    1 +
 src/libbluray/decoders/graphics_controller.c |   29 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 258be26..f17b7c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 ????-??-??:
+ - Fixes to HDMV menu rendering
  - Optimized HDMV menu rendering
  - Support for sound effects in HDMV menus
  - Fixes to HDMV menu decoding
diff --git a/src/libbluray/decoders/graphics_controller.c b/src/libbluray/decoders/graphics_controller.c
index b141635..a68a742 100644
--- a/src/libbluray/decoders/graphics_controller.c
+++ b/src/libbluray/decoders/graphics_controller.c
@@ -209,6 +209,14 @@ static BD_PG_OBJECT *_find_object_for_button(PG_DISPLAY_SET *s,
  * util
  */
 
+static int _areas_overlap(BOG_DATA *a, BOG_DATA *b)
+{
+    return !(a->x + a->w <= b->x        ||
+             a->x        >= b->x + b->w ||
+             a->y + a->h <= b->y        ||
+             a->y        >= b->y + b->h);
+}
+
 static int _is_button_enabled(GRAPHICS_CONTROLLER *gc, BD_IG_PAGE *page, unsigned button_id)
 {
     unsigned ii;
@@ -670,6 +678,27 @@ static void _render_button(GRAPHICS_CONTROLLER *gc, BD_IG_BUTTON *button, BD_PG_
         return;
     }
 
+    /* new object is smaller than already drawn one ? -> need to render background */
+    if (bog_data->w > object->width ||
+        bog_data->h > object->height) {
+
+        /* make sure we won't wipe other buttons */
+        unsigned ii, skip = 0;
+        for (ii = 0; &gc->bog_data[ii] != bog_data; ii++) {
+            if (_areas_overlap(bog_data, &bog_data[ii]))
+                skip = 1;
+            /* FIXME: clean non-overlapping area */
+        }
+
+        GC_TRACE("object size changed, %sclearing background at %d,%d %dx%d\n",
+                 skip ? " ** NOT ** " : "",
+                 bog_data->x, bog_data->y, bog_data->w, bog_data->h);
+
+        if (!skip) {
+            _clear_bog_area(gc, bog_data);
+        }
+    }
+
     GC_TRACE("render button #%d using object #%d at %d,%d %dx%d\n",
              button->id, object->id,
              button->x_pos, button->y_pos, object->width, object->height);



More information about the libbluray-devel mailing list