diff options
author | 2015-05-22 08:06:21 -0700 | |
---|---|---|
committer | 2015-05-22 08:06:22 -0700 | |
commit | 92fc2ae58331662ec411a048686cb4801e0a909a (patch) | |
tree | 8b49c125bd366e77fcdff77788e6965912758dc9 /src/core/SkDraw.cpp | |
parent | eb1cb5c5b50febad115d859faca91d2d6af3fff2 (diff) |
add SkPixmap and external locking to bitmaps
BUG=skia:
Review URL: https://codereview.chromium.org/1074983003
Diffstat (limited to 'src/core/SkDraw.cpp')
-rw-r--r-- | src/core/SkDraw.cpp | 13 |
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 |