From 92fc2ae58331662ec411a048686cb4801e0a909a Mon Sep 17 00:00:00 2001 From: reed Date: Fri, 22 May 2015 08:06:21 -0700 Subject: add SkPixmap and external locking to bitmaps BUG=skia: Review URL: https://codereview.chromium.org/1074983003 --- src/core/SkDraw.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/core/SkDraw.cpp') 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 -- cgit v1.2.3