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

github.com/ClusterM/NesTiler.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'NesTiler/FastBitmap.cs')
-rw-r--r--NesTiler/FastBitmap.cs2
1 files changed, 2 insertions, 0 deletions
diff --git a/NesTiler/FastBitmap.cs b/NesTiler/FastBitmap.cs
index fb92468..5910f43 100644
--- a/NesTiler/FastBitmap.cs
+++ b/NesTiler/FastBitmap.cs
@@ -1,4 +1,5 @@
using SkiaSharp;
+using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
@@ -17,6 +18,7 @@ namespace com.clusterrr.Famicom.NesTiler
{
Width = skBitmap.Width;
Height = height <= 0 ? skBitmap.Height - verticalOffset : height;
+ if (skBitmap.Height - verticalOffset - Height <= 0) throw new InvalidOperationException("Invalid image height.");
var pixels = skBitmap.Pixels;
colors = skBitmap.Pixels.Skip(verticalOffset * Width).Take(Width * Height).Select(p => Color.FromArgb(p.Alpha, p.Red, p.Green, p.Blue)).ToArray();
}