fixes around isOpaque and dithering

- copyTo() now preserves isOpaqueness, and BitmapCopyTest tests it
- bitmap shader doesn't claim to have shadespan16 if dithering is on, since its
  sampler doesn't auto-dither (note that gradients do auto-dither in their
  16bit sampler)
- blitter setup just relies on the shader to report if its 16bit sampler can be
  called (allowing gradients to say yes regardless of dither, but bitmaps to say
  no if dithering is on)



git-svn-id: http://skia.googlecode.com/svn/trunk@331 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/SampleDitherBitmap.cpp b/samplecode/SampleDitherBitmap.cpp
index bd604cf..35816a2 100644
--- a/samplecode/SampleDitherBitmap.cpp
+++ b/samplecode/SampleDitherBitmap.cpp
@@ -10,7 +10,7 @@
 
     SkPMColor* c = ctable->lockColors();
     for (int i = 0; i < 256; i++) {
-        c[i] = SkPackARGB32(0xFF, 0, 0, i);
+        c[i] = SkPackARGB32(0xFF, i, 0, 0);
     }
     ctable->unlockColors(true);
     bm.setConfig(SkBitmap::kIndex8_Config, 256, 32);
@@ -51,12 +51,31 @@
         canvas->drawColor(0xFFDDDDDD);
     }
     
+    static void setBitmapOpaque(SkBitmap* bm, bool isOpaque) {
+        SkAutoLockPixels alp(*bm);  // needed for ctable
+        bm->setIsOpaque(isOpaque);
+        SkColorTable* ctable = bm->getColorTable();
+        if (ctable) {
+            ctable->setIsOpaque(isOpaque);
+        }
+    }
+    
     static void draw2(SkCanvas* canvas, const SkBitmap& bm) {
         SkPaint paint;
-        
-        canvas->drawBitmap(bm, 0, 0, &paint);
+        SkBitmap bitmap(bm);
+
+        setBitmapOpaque(&bitmap, false);
+        paint.setDither(false);
+        canvas->drawBitmap(bitmap, 0, 0, &paint);
         paint.setDither(true);
-        canvas->drawBitmap(bm, 0, SkIntToScalar(bm.height() + 10), &paint);
+        canvas->drawBitmap(bitmap, 0, SkIntToScalar(bm.height() + 10), &paint);
+
+        setBitmapOpaque(&bitmap, true);
+        SkScalar x = SkIntToScalar(bm.width() + 10);
+        paint.setDither(false);
+        canvas->drawBitmap(bitmap, x, 0, &paint);
+        paint.setDither(true);
+        canvas->drawBitmap(bitmap, x, SkIntToScalar(bm.height() + 10), &paint);
     }
     
     virtual void onDraw(SkCanvas* canvas) {