File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
src/Windowing/Silk.NET.Windowing.Common/Internals Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -283,6 +283,8 @@ public Vector2D<int> PointToFramebuffer(Vector2D<int> point)
283
283
Unsafe . As < int , Vector2D < int > > ( ref framebufferSizeElements [ 0 ] ) = FramebufferSize;
284
284
var framebufferSize = new Vector < int > ( framebufferSizeElements ) ;
285
285
Span < int > sizeElements = stackalloc int [ Vector < int > . Count ] ;
286
+ // HACK: Avoid divide by zero errors
287
+ sizeElements [ 2 ..] . Fill ( 1 ) ;
286
288
Unsafe . As < int , Vector2D < int > > ( ref sizeElements [ 0 ] ) = Size;
287
289
var size = new Vector < int > ( sizeElements ) ;
288
290
Span < int > pointElements = stackalloc int [ Vector < int > . Count ] ;
@@ -295,6 +297,11 @@ public Vector2D<int> PointToFramebuffer(Vector2D<int> point)
295
297
Unsafe . As < int , Vector2D < int > > ( ref a [ 0 ] ) = FramebufferSize;
296
298
Unsafe . As < int , Vector2D < int > > ( ref a [ c ] ) = Size;
297
299
Unsafe . As < int , Vector2D < int > > ( ref a [ c * 2 ] ) = point;
300
+
301
+ // HACK: Avoid divide by zero errors
302
+ for ( var i = c + 2 ; i < c * 2 ; i ++ )
303
+ a [ i ] = 1 ;
304
+
298
305
var framebufferSize = new Vector < int > ( a , 0 ) ;
299
306
var size = new Vector < int > ( a , c ) ;
300
307
var thePoint = new Vector < int > ( a , c * 2 ) ;
You can’t perform that action at this time.
0 commit comments