fix warning in sampler
lock pixels when we extract alpha
disabling hinting when linear-text is set



git-svn-id: http://skia.googlecode.com/svn/trunk@333 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 9478fae..0276897 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -1044,7 +1044,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-static void GetBitmapAlpha(const SkBitmap& src, uint8_t SK_RESTRICT alpha[],
+static bool GetBitmapAlpha(const SkBitmap& src, uint8_t SK_RESTRICT alpha[],
                            int alphaRowBytes) {
     SkASSERT(alpha != NULL);
     SkASSERT(alphaRowBytes >= src.width());
@@ -1054,6 +1054,16 @@
     int              h = src.height();
     int              rb = src.rowBytes();
 
+    SkAutoLockPixels alp(src);
+    if (!src.readyToDraw()) {
+        // zero out the alpha buffer and return
+        while (--h >= 0) {
+            memset(alpha, 0, w);
+            alpha += alphaRowBytes;
+        }
+        return false;
+    }
+    
     if (SkBitmap::kA8_Config == config && !src.isOpaque()) {
         const uint8_t* s = src.getAddr8(0, 0);
         while (--h >= 0) {
@@ -1096,6 +1106,7 @@
     } else {    // src is opaque, so just fill alpha[] with 0xFF
         memset(alpha, 0xFF, h * alphaRowBytes);
     }
+    return true;
 }
 
 #include "SkPaint.h"
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 76a2066..2432ee3 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1142,6 +1142,16 @@
     return SkMask::kBW_Format;
 }
 
+// if linear-text is on, then we force hinting to be off (since that's sort of
+// the point of linear-text.
+static SkPaint::Hinting computeHinting(const SkPaint& paint) {
+    SkPaint::Hinting h = paint.getHinting();
+    if (paint.isLinearText()) {
+        h = SkPaint::kNo_Hinting;
+    }
+    return h;
+}
+
 void SkScalerContext::MakeRec(const SkPaint& paint,
                               const SkMatrix* deviceMatrix, Rec* rec)
 {
@@ -1207,7 +1217,7 @@
     rec->fSubpixelPositioning = paint.isSubpixelText();
     rec->fMaskFormat = SkToU8(computeMaskFormat(paint));
     rec->fFlags = SkToU8(flags);
-    rec->setHinting(paint.getHinting());
+    rec->setHinting(computeHinting(paint));
 
     /*  Allow the fonthost to modify our rec before we use it as a key into the
         cache. This way if we're asking for something that they will ignore,