Fixing build warnings (because warnings are errors)
authorMatthew Leibowitz <mattleibow@live.com>
Wed, 26 Dec 2018 21:12:01 +0000 (23:12 +0200)
committerMatthew Leibowitz <mattleibow@live.com>
Wed, 26 Dec 2018 21:13:39 +0000 (23:13 +0200)
include/xamarin/SkManagedDrawable.h
src/c/sk_drawable.cpp
src/xamarin/sk_manageddrawable.cpp

index b90cd3ff80e5038b69f0af21fafd03cdba1d011f..0204897bcb49b113045fb6cac66f3860def14a6f 100644 (file)
@@ -34,12 +34,12 @@ public:
     static void setDelegates(const draw_delegate pDraw,
                              const getBounds_delegate pgetBounds,
                              const newPictureSnapshot_delegate pNewPictureSnapshot);
-    
+
 protected:
     void onDraw(SkCanvas*) override;
     SkRect onGetBounds() override;
     SkPicture* onNewPictureSnapshot() override;
-    
+
     typedef SkDrawable INHERITED;
 };
 
index 1ed50fdfd4726da5a6a1af489b29363fff4fc207..cdf384a52c6daae3fd7d9a52bf10cef798dda0f5 100644 (file)
 #include "sk_picture.h"
 #include "sk_types_priv.h"
 
-   
-void sk_drawable_unref(sk_drawable_t* drawable) 
-{ 
-    SkSafeUnref(AsDrawable(drawable)); 
+
+void sk_drawable_unref(sk_drawable_t* drawable)
+{
+    SkSafeUnref(AsDrawable(drawable));
 }
 
-uint32_t sk_drawable_get_generation_id(sk_drawable_t* d) 
-{ 
-       return AsDrawable(d)->getGenerationID();
+uint32_t sk_drawable_get_generation_id(sk_drawable_t* d)
+{
+    return AsDrawable(d)->getGenerationID();
 }
 
 void sk_drawable_get_bounds(sk_drawable_t* d, sk_rect_t* rect)
-{ 
-    *rect = ToRect(AsDrawable(d)->getBounds()); 
+{
+    *rect = ToRect(AsDrawable(d)->getBounds());
 }
 
 void sk_drawable_draw(sk_drawable_t* d, sk_canvas_t* c, sk_matrix_t* matrix)
 {
-    AsDrawable(d)->draw(AsCanvas(c), &AsMatrix(matrix));
+    SkMatrix m;
+    if (matrix) {
+        m = AsMatrix(matrix);
+    }
+    AsDrawable(d)->draw(AsCanvas(c), matrix ? &m : nullptr);
 }
 
 sk_picture_t* sk_drawable_new_picture_snapshot(sk_drawable_t* d)
-{ 
-       return ToPicture(AsDrawable(d)->newPictureSnapshot());
+{
+    return ToPicture(AsDrawable(d)->newPictureSnapshot());
 }
 
 void sk_drawable_notify_drawing_changed(sk_drawable_t* d)
index 3022a151e6395b7e77b774de1d665b6292736ae9..b5dae666858f9eaea18940c5a765e7e167e43527 100644 (file)
@@ -29,11 +29,6 @@ static inline sk_manageddrawable_t* ToManagedDrawable(SkManagedDrawable* drawabl
     return reinterpret_cast<sk_manageddrawable_t*>(drawable);
 }
 
-static inline const sk_manageddrawable_t* ToManagedDrawable(const SkManagedDrawable* drawable) 
-{
-    return reinterpret_cast<const sk_manageddrawable_t*>(drawable);
-}
-
 void dDraw(SkManagedDrawable* managedDrawable, SkCanvas* canvas) 
 {
     gDraw(ToManagedDrawable(managedDrawable), ToCanvas(canvas));
@@ -50,7 +45,7 @@ SkPicture* dNewPictureSnapshot(SkManagedDrawable* managedDrawable)
 }
 
 sk_manageddrawable_t* sk_manageddrawable_new() { 
-       return ToManagedDrawable(new SkManagedDrawable());
+    return ToManagedDrawable(new SkManagedDrawable());
 }
 
 void sk_manageddrawable_destroy(sk_manageddrawable_t* drawable)