Change cursor API to use RGBA data

This will allow us to use better formats that preserve the entire
alpha channel.
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index cc35626..a692732 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -444,9 +444,9 @@
 }
 
 void CConn::setCursor(int width, int height, const Point& hotspot,
-                      void* data, void* mask)
+                      const rdr::U8* data)
 {
-  desktop->setCursor(width, height, hotspot, data, mask);
+  desktop->setCursor(width, height, hotspot, data);
 }
 
 void CConn::fence(rdr::U32 flags, unsigned len, const char data[])
diff --git a/vncviewer/CConn.h b/vncviewer/CConn.h
index c934f3d..d6dd4a7 100644
--- a/vncviewer/CConn.h
+++ b/vncviewer/CConn.h
@@ -66,7 +66,7 @@
   void dataRect(const rfb::Rect& r, int encoding);
 
   void setCursor(int width, int height, const rfb::Point& hotspot,
-                 void* data, void* mask);
+                 const rdr::U8* data);
 
   void fence(rdr::U32 flags, unsigned len, const char data[]);
 
diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
index 190b39c..acb0a72 100644
--- a/vncviewer/DesktopWindow.cxx
+++ b/vncviewer/DesktopWindow.cxx
@@ -266,9 +266,9 @@
 
 void DesktopWindow::setCursor(int width, int height,
                               const rfb::Point& hotspot,
-                              void* data, void* mask)
+                              const rdr::U8* data)
 {
-  viewport->setCursor(width, height, hotspot, data, mask);
+  viewport->setCursor(width, height, hotspot, data);
 }
 
 
diff --git a/vncviewer/DesktopWindow.h b/vncviewer/DesktopWindow.h
index 3dfaaea..11f3dc2 100644
--- a/vncviewer/DesktopWindow.h
+++ b/vncviewer/DesktopWindow.h
@@ -62,7 +62,7 @@
 
   // New image for the locally rendered cursor
   void setCursor(int width, int height, const rfb::Point& hotspot,
-                 void* data, void* mask);
+                 const rdr::U8* data);
 
   // Fl_Window callback methods
   void draw();
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index b5c516f..6a23526 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -180,21 +180,20 @@
   "     "};
 
 void Viewport::setCursor(int width, int height, const Point& hotspot,
-                              void* data, void* mask)
+                         const rdr::U8* data)
 {
+  int i;
+
   if (cursor) {
     if (!cursor->alloc_array)
       delete [] cursor->array;
     delete cursor;
   }
 
-  int mask_len = ((width+7)/8) * height;
-  int i;
+  for (i = 0; i < width*height; i++)
+    if (data[i*4 + 3] != 0) break;
 
-  for (i = 0; i < mask_len; i++)
-    if (((rdr::U8*)mask)[i]) break;
-
-  if ((i == mask_len) && dotWhenNoCursor) {
+  if ((i == width*height) && dotWhenNoCursor) {
     vlog.debug("cursor is empty - using dot");
 
     Fl_Pixmap pxm(dotcursor_xpm);
@@ -207,34 +206,9 @@
       cursor = new Fl_RGB_Image(buffer, 1, 1, 4);
       cursorHotspot.x = cursorHotspot.y = 0;
     } else {
-      U8 *buffer = new U8[width*height*4];
-      U8 *i, *o, *m;
-      int m_width;
-
-      const PixelFormat *pf;
-      
-      pf = &cc->cp.pf();
-
-      i = (U8*)data;
-      o = buffer;
-      m = (U8*)mask;
-      m_width = (width+7)/8;
-      for (int y = 0;y < height;y++) {
-        for (int x = 0;x < width;x++) {
-          pf->rgbFromBuffer(o, i, 1);
-
-          if (m[(m_width*y)+(x/8)] & 0x80>>(x%8))
-            o[3] = 255;
-          else
-            o[3] = 0;
-
-          o += 4;
-          i += pf->bpp/8;
-        }
-      }
-
+      U8 *buffer = new U8[width * height * 4];
+      memcpy(buffer, data, width * height * 4);
       cursor = new Fl_RGB_Image(buffer, width, height, 4);
-
       cursorHotspot = hotspot;
     }
   }
diff --git a/vncviewer/Viewport.h b/vncviewer/Viewport.h
index 0967fcb..6f0710d 100644
--- a/vncviewer/Viewport.h
+++ b/vncviewer/Viewport.h
@@ -45,7 +45,7 @@
 
   // New image for the locally rendered cursor
   void setCursor(int width, int height, const rfb::Point& hotspot,
-                 void* data, void* mask);
+                 const rdr::U8* data);
 
   void draw(Surface* dst);