diff mbox

[14/19] dvdspu: cleanup debug code

Message ID 1325628171-4803-7-git-send-email-rob@ti.com
State New
Headers show

Commit Message

Rob Clark Jan. 3, 2012, 10:02 p.m. UTC
Clean up debug code for drawing highlight rects which wasn't even
compiling previously.

TODO: might be nice if this could be controlled by properties or
env variables to make it possible to enable the debug code at
runtime.
---
See: https://bugzilla.gnome.org/show_bug.cgi?id=667223

 gst/dvdspu/gstspu-vobsub-render.c |   70 ++++++++++++++-----------------------
 1 files changed, 26 insertions(+), 44 deletions(-)
diff mbox

Patch

diff --git a/gst/dvdspu/gstspu-vobsub-render.c b/gst/dvdspu/gstspu-vobsub-render.c
index 66abd9f..83943e9 100644
--- a/gst/dvdspu/gstspu-vobsub-render.c
+++ b/gst/dvdspu/gstspu-vobsub-render.c
@@ -392,6 +392,27 @@  gstspu_vobsub_clear_comp_buffers (SpuState * state)
   state->vobsub.comp_last_x[1] = -1;
 }
 
+static void
+gstspu_vobsub_draw_highlight (SpuState * state,
+    GstBuffer * buf, SpuRect *rect)
+{
+  guint8 *cur;
+  gint16 pos;
+
+  cur = GST_BUFFER_DATA (buf) + state->Y_stride * rect->top;
+  for (pos = rect->left + 1; pos < rect->right; pos++)
+    cur[pos] = (cur[pos] / 2) + 0x8;
+  cur = GST_BUFFER_DATA (buf) + state->Y_stride * rect->bottom;
+  for (pos = rect->left + 1; pos < rect->right; pos++)
+    cur[pos] = (cur[pos] / 2) + 0x8;
+  cur = GST_BUFFER_DATA (buf) + state->Y_stride * rect->top;
+  for (pos = rect->top; pos <= rect->bottom; pos++) {
+    cur[rect->left] = (cur[rect->left] / 2) + 0x8;
+    cur[rect->right] = (cur[rect->right] / 2) + 0x8;
+    cur += state->Y_stride;
+  }
+}
+
 void
 gstspu_vobsub_render (GstDVDSpu * dvdspu, GstBuffer * buf)
 {
@@ -569,50 +590,11 @@  gstspu_vobsub_render (GstDVDSpu * dvdspu, GstBuffer * buf)
   }
 
   /* for debugging purposes, draw a faint rectangle at the edges of the disp_rect */
-#if 0
-  do {
-    guint8 *cur;
-    gint16 pos;
-
-    cur = GST_BUFFER_DATA (buf) + state->Y_stride * state->vobsub.disp_rect.top;
-    for (pos = state->vobsub.disp_rect.left + 1;
-        pos < state->vobsub.disp_rect.right; pos++)
-      cur[pos] = (cur[pos] / 2) + 0x8;
-    cur =
-        GST_BUFFER_DATA (buf) +
-        state->Y_stride * state->vobsub.disp_rect.bottom;
-    for (pos = state->vobsub.disp_rect.left + 1;
-        pos < state->vobsub.disp_rect.right; pos++)
-      cur[pos] = (cur[pos] / 2) + 0x8;
-    cur = GST_BUFFER_DATA (buf) + state->Y_stride * state->vobsub.disp_rect.top;
-    for (pos = state->vobsub.disp_rect.top;
-        pos <= state->vobsub.disp_rect.bottom; pos++) {
-      cur[state->vobsub.disp_rect.left] =
-          (cur[state->vobsub.disp_rect.left] / 2) + 0x8;
-      cur[state->vobsub.disp_rect.right] =
-          (cur[state->vobsub.disp_rect.right] / 2) + 0x8;
-      cur += state->Y_stride;
-    }
-  } while (0);
-#endif
+  if (FALSE) {
+    gstspu_vobsub_draw_highlight (state, buf, &state->vobsub.disp_rect);
+  }
   /* For debugging purposes, draw a faint rectangle around the highlight rect */
-#if 0
-  if (state->hl_rect.top != -1) {
-    guint8 *cur;
-    gint16 pos;
-
-    cur = GST_BUFFER_DATA (buf) + state->Y_stride * state->hl_rect.top;
-    for (pos = state->hl_rect.left + 1; pos < state->hl_rect.right; pos++)
-      cur[pos] = (cur[pos] / 2) + 0x8;
-    cur = GST_BUFFER_DATA (buf) + state->Y_stride * state->hl_rect.bottom;
-    for (pos = state->hl_rect.left + 1; pos < state->hl_rect.right; pos++)
-      cur[pos] = (cur[pos] / 2) + 0x8;
-    cur = GST_BUFFER_DATA (buf) + state->Y_stride * state->hl_rect.top;
-    for (pos = state->hl_rect.top; pos <= state->hl_rect.bottom; pos++) {
-      cur[state->hl_rect.left] = (cur[state->hl_rect.left] / 2) + 0x8;
-      cur[state->hl_rect.right] = (cur[state->hl_rect.right] / 2) + 0x8;
-      cur += state->Y_stride;
-    }
+  if (FALSE && state->vobsub.hl_rect.top != -1) {
+    gstspu_vobsub_draw_highlight (state, buf, &state->vobsub.hl_rect);
   }
-#endif
 }