Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1105)

Unified Diff: src/core/SkDraw.cpp

Issue 1074983003: add SkPixmap and external locking to bitmaps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/core/SkDraw.cpp
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index ab2d5cccb30ed5f5173b3c544b9c57f44a4150e3..918ef765ebbf89d93b3d59086ec19b196aea8c53 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

Powered by Google App Engine
This is Rietveld 408576698