[ekiga] Add RGB16 support



commit 9299cd88e29cc7525393e25bd55e339b3c49cb9b
Author: Ying-Chun Liu (PaulLiu) <paulliu debian org>
Date:   Sat Mar 20 12:47:49 2010 +0100

    Add RGB16 support

 lib/gui/xwindow.cpp |   12 ++++++++++++
 lib/pixops/pixops.c |    7 +++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/lib/gui/xwindow.cpp b/lib/gui/xwindow.cpp
index be476d4..142bf71 100644
--- a/lib/gui/xwindow.cpp
+++ b/lib/gui/xwindow.cpp
@@ -82,6 +82,7 @@ struct xFormatsentry {
   {"RGBA",   1, 0, LSBFirst,     0x000000FF, 0x0000FF00, 0x00FF0000},  //RGBA *
   {"BGR32",  1, 4, MSBFirst,     0x0000FF00, 0x00FF0000, 0xFF000000},  //BGRA
   {"BGRA",   1, 0, LSBFirst,     0x00FF0000, 0x0000FF00, 0x000000FF},  //BGRA *
+  {"RGB16", 16, 2, LSBFirst,     0x0000F800, 0x000007E0, 0x0000001F},  //RGB16
   {NULL, 0, 0, 0, 0, 0, 0}
 };
 
@@ -1021,6 +1022,17 @@ bool XWindow::checkDepth ()
       }
     }
   }
+  else if (xwattributes.depth == 16) {
+    _depth = 16;
+    if (!XMatchVisualInfo (_display, DefaultScreen (_display), _depth, TrueColor, &_XVInfo)) {
+      PTRACE(4, "X11\tCould not find visual with colordepth of " << _depth  << " bits per pixel");
+      _depth = 24;
+      if (!XMatchVisualInfo (_display, DefaultScreen (_display), _depth, TrueColor, &_XVInfo)) {
+        PTRACE(1, "X11\tCould neither find visual with colordepth of 16 bits per pixel nor with 24 bits per pixel");
+        return false;
+      }
+    }
+  }
   else {
     _depth = 24;
     if (!XMatchVisualInfo (_display, DefaultScreen (_display), _depth, TrueColor, &_XVInfo)) {
diff --git a/lib/pixops/pixops.c b/lib/pixops/pixops.c
index caf50a9..b459edf 100644
--- a/lib/pixops/pixops.c
+++ b/lib/pixops/pixops.c
@@ -157,6 +157,13 @@ pixops_scale_nearest (guchar        *dest_buf,
 	      INNER_LOOP(4, 4, p32=(guint32*)dest;*p32=*((guint32*)p));
 	    }
 	}
+      else if (src_channels == 2)
+	{
+	  if (dest_channels == 2)
+	    {
+	      INNER_LOOP (2, 2, dest[0]=p[0];dest[1]=p[1]);
+	    }
+	}
     }
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]