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"