Exposing the SkBitmap::swap method as this is used.
authorMatthew Leibowitz <mattleibow@live.com>
Sun, 6 May 2018 00:52:01 +0000 (02:52 +0200)
committerMatthew Leibowitz <mattleibow@live.com>
Sun, 6 May 2018 00:52:01 +0000 (02:52 +0200)
 - most notably in the now-removed copyTo method

include/c/sk_bitmap.h
src/c/sk_bitmap.cpp
src/c/sk_types_priv.h

index 5934b57..c4f3635 100644 (file)
@@ -50,6 +50,7 @@ SK_C_API bool sk_bitmap_peek_pixels(sk_bitmap_t* cbitmap, sk_pixmap_t* cpixmap);
 SK_C_API bool sk_bitmap_extract_subset(sk_bitmap_t* cbitmap, sk_bitmap_t* dst, sk_irect_t* subset);
 SK_C_API bool sk_bitmap_extract_alpha(sk_bitmap_t* cbitmap, sk_bitmap_t* dst, const sk_paint_t* paint, sk_ipoint_t* offset);
 SK_C_API void sk_bitmap_notify_pixels_changed(sk_bitmap_t* cbitmap);
+SK_C_API void sk_bitmap_swap(sk_bitmap_t* cbitmap, sk_bitmap_t* cother);
 
 SK_C_PLUS_PLUS_END_GUARD
 
index 4cf7654..1291600 100644 (file)
@@ -366,3 +366,8 @@ void sk_bitmap_notify_pixels_changed(sk_bitmap_t* cbitmap)
 {
     AsBitmap(cbitmap)->notifyPixelsChanged();
 }
+
+void sk_bitmap_swap(sk_bitmap_t* cbitmap, sk_bitmap_t* cother)
+{
+    AsBitmap(cbitmap)->swap(AsBitmap(*cother));
+}
index cb8a302..dd34545 100644 (file)
@@ -143,6 +143,10 @@ static inline SkBitmap* AsBitmap(sk_bitmap_t* cbitmap) {
     return reinterpret_cast<SkBitmap*>(cbitmap);
 }
 
+static inline SkBitmap& AsBitmap(sk_bitmap_t& cbitmap) {
+    return reinterpret_cast<SkBitmap&>(cbitmap);
+}
+
 static inline const SkPixmap* AsPixmap(const sk_pixmap_t* cpixmap) {
     return reinterpret_cast<const SkPixmap*>(cpixmap);
 }