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

Unified Diff: src/core/SkBitmapDevice.cpp

Issue 1156073003: remove unneeded device:lockpixels (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« no previous file with comments | « include/core/SkDevice.h ('k') | src/utils/SkDeferredCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapDevice.cpp
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 5b2fc38e321cc48f6e6aff68f822e92fd8bcf727..995b427697f5ff6ca3ae632da3a9af3a5be9d44e 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -120,18 +120,6 @@ SkBaseDevice* SkBitmapDevice::onCreateDevice(const CreateInfo& cinfo, const SkPa
return SkBitmapDevice::Create(cinfo.fInfo, &leaky);
}
-void SkBitmapDevice::lockPixels() {
- if (fBitmap.lockPixelsAreWritable()) {
- fBitmap.lockPixels();
- }
-}
-
-void SkBitmapDevice::unlockPixels() {
- if (fBitmap.lockPixelsAreWritable()) {
- fBitmap.unlockPixels();
- }
-}
-
const SkBitmap& SkBitmapDevice::onAccessBitmap() {
return fBitmap;
}
@@ -172,6 +160,20 @@ bool SkBitmapDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, s
return fBitmap.readPixels(dstInfo, dstPixels, dstRowBytes, x, y);
}
+void SkBitmapDevice::onAttachToCanvas(SkCanvas* canvas) {
+ INHERITED::onAttachToCanvas(canvas);
+ if (fBitmap.lockPixelsAreWritable()) {
+ fBitmap.lockPixels();
+ }
+}
+
+void SkBitmapDevice::onDetachFromCanvas() {
+ INHERITED::onDetachFromCanvas();
+ if (fBitmap.lockPixelsAreWritable()) {
+ fBitmap.unlockPixels();
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
void SkBitmapDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
« no previous file with comments | « include/core/SkDevice.h ('k') | src/utils/SkDeferredCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698