diff options
author | 2015-12-14 10:19:17 -0800 | |
---|---|---|
committer | 2015-12-14 10:19:17 -0800 | |
commit | 023bda0d836834eb1f98ceec15b169a492ab78ad (patch) | |
tree | 1dc817f5fa326a6bb943aa1bb10f3ac1e6714ede /include/core/SkBitmap.h | |
parent | c9730831fcff6016279b304f246740b3cf53f9e4 (diff) |
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
Diffstat (limited to 'include/core/SkBitmap.h')
-rw-r--r-- | include/core/SkBitmap.h | 16 |
1 files changed, 14 insertions, 2 deletions
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. |