aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkDraw.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-05-22 08:06:21 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-22 08:06:22 -0700
commit92fc2ae58331662ec411a048686cb4801e0a909a (patch)
tree8b49c125bd366e77fcdff77788e6965912758dc9 /src/core/SkDraw.cpp
parenteb1cb5c5b50febad115d859faca91d2d6af3fff2 (diff)
add SkPixmap and external locking to bitmaps
Diffstat (limited to 'src/core/SkDraw.cpp')
-rw-r--r--src/core/SkDraw.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index ab2d5cccb3..918ef765eb 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1156,16 +1156,17 @@ void SkDraw::drawBitmapAsMask(const SkBitmap& bitmap,
int ix = SkScalarRoundToInt(fMatrix->getTranslateX());
int iy = SkScalarRoundToInt(fMatrix->getTranslateY());
- SkAutoLockPixels alp(bitmap);
- if (!bitmap.readyToDraw()) {
+ SkAutoPixmapUnlock result;
+ if (!bitmap.requestLock(&result)) {
return;
}
-
+ const SkPixmap& pmap = result.pixmap();
SkMask mask;
- mask.fBounds.set(ix, iy, ix + bitmap.width(), iy + bitmap.height());
+ mask.fBounds.set(ix, iy, ix + pmap.width(), iy + pmap.height());
mask.fFormat = SkMask::kA8_Format;
- mask.fRowBytes = SkToU32(bitmap.rowBytes());
- mask.fImage = bitmap.getAddr8(0, 0);
+ mask.fRowBytes = SkToU32(pmap.rowBytes());
+ // fImage is typed as writable, but in this case it is used read-only
+ mask.fImage = (uint8_t*)pmap.addr8(0, 0);
this->drawDevMask(mask, paint);
} else { // need to xform the bitmap first