call lock-pixels once we know we're a sprite
Review URL: https://codereview.appspot.com/6938058
git-svn-id: http://skia.googlecode.com/svn/trunk@6819 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index b6eb682..e1fa366 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1235,6 +1235,14 @@
if (bitmap.getConfig() != SkBitmap::kA8_Config &&
just_translate(matrix, bitmap)) {
+ //
+ // It is safe to call lock pixels now, since we know the matrix is
+ // (more or less) identity.
+ //
+ SkAutoLockPixels alp(bitmap);
+ if (!bitmap.readyToDraw()) {
+ return;
+ }
int ix = SkScalarRound(matrix.getTranslateX());
int iy = SkScalarRound(matrix.getTranslateY());
if (clipHandlesSprite(*fRC, ix, iy, bitmap)) {