Updates to the unix sample app.

Rather than placing pixels, use XPutImage to place the bitmap on screen.

Modify the color arrangements for 8888 when building the sample app, so
they agree with X.

Add a title to simple sample.

Include SkTouchGesture.



git-svn-id: http://skia.googlecode.com/svn/trunk@963 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/utils/unix/SkOSWindow_Unix.cpp b/src/utils/unix/SkOSWindow_Unix.cpp
index 96940f5..650ced2 100644
--- a/src/utils/unix/SkOSWindow_Unix.cpp
+++ b/src/utils/unix/SkOSWindow_Unix.cpp
@@ -72,14 +72,24 @@
     if (!fUnixWindow.fDisplay) return;
     // Draw the bitmap to the screen.
     const SkBitmap& bitmap = getBitmap();
-    for (int i = 0; i < bitmap.width(); i++) {
-        for (int j = 0; j < bitmap.height(); j++) {
-            // Get the pixel, put it on the screen.
-            SkColor color = bitmap.getColor(i, j);
-            XSetForeground(fUnixWindow.fDisplay, fUnixWindow.fGc, color);
-            XDrawPoint(fUnixWindow.fDisplay, fUnixWindow.fWin, fUnixWindow.fGc, i, j);
-        }
-    }
+
+    XImage image;
+    sk_bzero(&image, sizeof(image));
+
+    int bitsPerPixel = bitmap.bytesPerPixel() * 8;
+    image.width = bitmap.width();
+    image.height = bitmap.height();
+    image.format = ZPixmap;
+    image.data = (char*) bitmap.getPixels();
+    image.byte_order = LSBFirst;
+    image.bitmap_unit = bitsPerPixel;
+    image.bitmap_bit_order = LSBFirst;
+    image.bitmap_pad = bitsPerPixel;
+    image.depth = 24;
+    image.bytes_per_line = bitmap.rowBytes() - bitmap.width() * bitmap.bytesPerPixel();
+    image.bits_per_pixel = bitsPerPixel;
+    int status = XInitImage(&image);
+    XPutImage(fUnixWindow.fDisplay, fUnixWindow.fWin, fUnixWindow.fGc, &image, 0, 0, 0, 0, width(), height());
 }
 
 bool SkOSWindow::onHandleChar(SkUnichar)