From 023bda0d836834eb1f98ceec15b169a492ab78ad Mon Sep 17 00:00:00 2001 From: halcanary Date: Mon, 14 Dec 2015 10:19:17 -0800 Subject: SkBitmap move Running `Release/dm --gpu 0`, the number of times we call SkBitmap::operator=(const SkBitmap&) (which refs the pixelref) is reduced from ~214929 to ~214626. Review URL: https://codereview.chromium.org/1514503004 --- include/core/SkBitmap.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'include/core/SkBitmap.h') diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index cf1c4c77f2..a81e03eefa 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -54,12 +54,24 @@ public: */ SkBitmap(const SkBitmap& src); + /** + * Copy the settings from the src into this bitmap. If the src has pixels + * allocated, ownership of the pixels will be taken. + */ + SkBitmap(SkBitmap&& src); + ~SkBitmap(); - /** Copies the src bitmap into this bitmap. Ownership of the src bitmap's pixels remains - with the src bitmap. + /** Copies the src bitmap into this bitmap. Ownership of the src + bitmap's pixels is shared with the src bitmap. */ SkBitmap& operator=(const SkBitmap& src); + + /** Copies the src bitmap into this bitmap. Takes ownership of the src + bitmap's pixels. + */ + SkBitmap& operator=(SkBitmap&& src); + /** Swap the fields of the two bitmaps. This routine is guaranteed to never fail or throw. */ // This method is not exported to java. -- cgit v1.2.3