add install mask signature to c bitmap api
authorTyler Hoeflicker <thoeflicker@bluebeam.com>
Mon, 16 Jan 2017 23:32:29 +0000 (15:32 -0800)
committerTyler Hoeflicker <thoeflicker@bluebeam.com>
Mon, 16 Jan 2017 23:32:29 +0000 (15:32 -0800)
include/c/sk_bitmap.h
src/c/sk_bitmap.cpp
src/c/sk_types_priv.h

index e62cbb0..dc578c2 100644 (file)
@@ -42,6 +42,7 @@ SK_API void sk_bitmap_get_pixel_colors(sk_bitmap_t* cbitmap, sk_color_t* colors)
 SK_API void sk_bitmap_set_pixel_colors(sk_bitmap_t* cbitmap, const sk_color_t* colors);
 SK_API bool sk_bitmap_install_pixels(sk_bitmap_t* cbitmap, const sk_imageinfo_t* cinfo, void* pixels, size_t rowBytes, sk_colortable_t* ctable, const sk_bitmap_release_proc releaseProc, void* context);
 SK_API bool sk_bitmap_install_pixels_with_pixmap(sk_bitmap_t* cbitmap, const sk_pixmap_t* cpixmap);
+SK_API bool sk_bitmap_install_mask_pixels(sk_bitmap_t* cbitmap, const sk_mask_t* cmask);
 SK_API bool sk_bitmap_try_alloc_pixels(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, size_t rowBytes);
 SK_API bool sk_bitmap_try_alloc_pixels_with_color_table(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, sk_pixelref_factory_t* factory, sk_colortable_t* ctable);
 SK_API sk_colortable_t* sk_bitmap_get_colortable(sk_bitmap_t* cbitmap);
index 26f4ea6..165dac3 100644 (file)
@@ -316,6 +316,12 @@ bool sk_bitmap_install_pixels_with_pixmap(sk_bitmap_t* cbitmap, const sk_pixmap_
     return bmp->installPixels(AsPixmap(*cpixmap));
 }
 
+SK_API bool sk_bitmap_install_mask_pixels(sk_bitmap_t* cbitmap, const sk_mask_t* cmask) {
+    SkBitmap* bmp = AsBitmap(cbitmap);
+    const SkMask* mask = AsMask(cmask);
+    return bmp->installMaskPixels(*mask);
+}
+
 bool sk_bitmap_try_alloc_pixels(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, size_t rowBytes)
 {
     SkBitmap* bmp = AsBitmap(cbitmap);
index d73f68d..f76f837 100644 (file)
@@ -158,6 +158,10 @@ static inline SkMask* AsMask(sk_mask_t* cmask) {
     return reinterpret_cast<SkMask*>(cmask);
 }
 
+static inline const SkMask* AsMask(const sk_mask_t* cmask) {
+    return reinterpret_cast<const SkMask*>(cmask);
+}
+
 static inline sk_mask_t* ToMask(SkMask* mask) {
     return reinterpret_cast<sk_mask_t*>(mask);
 }