kopia lustrzana https://github.com/njcrawford/EmbroideryReader
Check for null design and valid bitmap size when updating image, should fix issue #5
rodzic
e2604752e6
commit
0f11f3c63d
|
@ -148,6 +148,12 @@ namespace embroideryReader
|
||||||
|
|
||||||
private void updateDesignImage()
|
private void updateDesignImage()
|
||||||
{
|
{
|
||||||
|
if(design == null)
|
||||||
|
{
|
||||||
|
// No design loaded - nothing to update
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Bitmap tempImage = design.designToBitmap((float)settings.threadThickness, (settings.filterStiches), settings.filterStitchesThreshold, 1.0f);
|
Bitmap tempImage = design.designToBitmap((float)settings.threadThickness, (settings.filterStiches), settings.filterStitchesThreshold, 1.0f);
|
||||||
|
|
||||||
// Rotate image
|
// Rotate image
|
||||||
|
@ -187,6 +193,12 @@ namespace embroideryReader
|
||||||
int width = (int)(tempImage.Width * designScale);
|
int width = (int)(tempImage.Width * designScale);
|
||||||
int height = (int)(tempImage.Height * designScale);
|
int height = (int)(tempImage.Height * designScale);
|
||||||
|
|
||||||
|
if (width < 1 || height < 1)
|
||||||
|
{
|
||||||
|
// Image area is too small to update
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (width != tempImage.Width || height != tempImage.Height)
|
if (width != tempImage.Width || height != tempImage.Height)
|
||||||
{
|
{
|
||||||
// Scale image code from http://stackoverflow.com/questions/1922040/resize-an-image-c-sharp
|
// Scale image code from http://stackoverflow.com/questions/1922040/resize-an-image-c-sharp
|
||||||
|
|
Ładowanie…
Reference in New Issue