Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/CommonBrushLayer.cs7
-rw-r--r--Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs6
2 files changed, 10 insertions, 3 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/CommonBrushLayer.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/CommonBrushLayer.cs
index 9fce3f7..ac76c0d 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/CommonBrushLayer.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/CommonBrushLayer.cs
@@ -84,8 +84,11 @@ namespace Xamarin.PropertyEditing.Mac
public NSImage RenderPreview ()
{
var scale = this.ContentsScale;
- nint h = (nint)(this.Bounds.Height * scale);
- nint w = (nint)(this.Bounds.Width * scale);
+ // The double cast below is needed for now, while Width/Height/scale are of type ObjCRuntime.nfloat
+ // in order for the floating point to integral conversion to work properly. Later when ObjCRuntime.nfloat
+ // is replaced with System.Runtime.InteropServices.NFloat that won't be needed (but can't hurt).
+ nint h = (nint)(double)(this.Bounds.Height * scale);
+ nint w = (nint)(double)(this.Bounds.Width * scale);
nint bytesPerRow = w * 4;
if (h <= 0 || w <= 0)
diff --git a/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs b/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs
index a38bd55..fa71c50 100644
--- a/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs
+++ b/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs
@@ -212,7 +212,11 @@ namespace Xamarin.PropertyEditing.Mac
this.registrations[cellIdentifier] = registration;
}
- return (nfloat) registration.GetHeight (vm);
+ // The double cast below is needed for now, while the return value is type ObjCRuntime.nfloat
+ // in order for the integral to floating point conversion to work properly. Later when ObjCRuntime.nfloat
+ // is replaced with System.Runtime.InteropServices.NFloat that won't be needed (but can't hurt).
+ nfloat rowHeight = (nfloat)(double)registration.GetHeight (vm);
+ return rowHeight;
}
private class EditorRegistration