Skip to content

Commit a28393d

Browse files
committed
fix deprecation warnings
1 parent 1bfd0d9 commit a28393d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

ShaderControl.uno

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ using ShaderPlayground.Internal;
1010
using Uno;
1111
using Uno.Collections;
1212
using Uno.Graphics;
13+
using Uno.Runtime.InteropServices;
1314
using Uno.UX;
1415

1516
public class Code : Node
@@ -680,7 +681,7 @@ public class ShaderControl : LayoutControl
680681
float2(0, 0),
681682
};
682683

683-
var vb = new Buffer(verts.Length * sizeof(float2));
684+
var vb = new byte[verts.Length * sizeof(float2)];
684685
for (int i = 0; i < verts.Length; i++)
685686
vb.Set(i * sizeof(float2), verts[i]);
686687

@@ -975,12 +976,14 @@ extern(OPENGL) public class StaticVertexBuffer : IDisposable
975976

976977
bool _isDisposed;
977978

978-
public StaticVertexBuffer(Buffer data)
979+
public StaticVertexBuffer(byte[] data)
979980
{
980981
_handle = GL.CreateBuffer();
982+
var pin = GCHandle.Alloc(data, GCHandleType.Pinned);
981983
GL.BindBuffer(GLBufferTarget.ArrayBuffer, _handle);
982-
GL.BufferData(GLBufferTarget.ArrayBuffer, data, GLBufferUsage.StaticDraw);
984+
GL.BufferData(GLBufferTarget.ArrayBuffer, data.Length, pin.AddrOfPinnedObject(), GLBufferUsage.StaticDraw);
983985
GL.BindBuffer(GLBufferTarget.ArrayBuffer, GLBufferHandle.Zero);
986+
pin.Free();
984987
}
985988

986989
public void IDisposable.Dispose()

ShaderPlayground.Internal/SizingContainer.uno

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ namespace ShaderPlayground.Internal
9999

100100
float2 SnapSize( float2 sz )
101101
{
102-
return Math.Round(sz* absoluteZoom) / absoluteZoom;
102+
return Math.Floor(sz * absoluteZoom + 0.5f) / absoluteZoom;
103103
}
104104

105105
float2 CalcScale( float2 availableSize, float2 desiredSize,

0 commit comments

Comments
 (0)