@@ -119,7 +119,6 @@ void Start()
119119 outlineBitmap = new WriteableBitmap ( canvasResolutionX , canvasResolutionY , dpiX , dpiY , PixelFormats . Bgra32 , null ) ;
120120 outlineImage . Source = outlineBitmap ;
121121
122-
123122 // build drawing area
124123 drawingImage = imgCanvas ;
125124 RenderOptions . SetBitmapScalingMode ( drawingImage , BitmapScalingMode . NearestNeighbor ) ;
@@ -129,6 +128,12 @@ void Start()
129128 canvasBitmap = new WriteableBitmap ( canvasResolutionX , canvasResolutionY , dpiX , dpiY , PixelFormats . Bgra32 , null ) ;
130129 drawingImage . Source = canvasBitmap ;
131130
131+ // setup preview area
132+ RenderOptions . SetBitmapScalingMode ( imgPreview1x , BitmapScalingMode . NearestNeighbor ) ;
133+ imgPreview1x . Source = canvasBitmap ;
134+ RenderOptions . SetBitmapScalingMode ( imgPreview2x , BitmapScalingMode . NearestNeighbor ) ;
135+ imgPreview2x . Source = canvasBitmap ;
136+
132137 // drawing events
133138 drawingImage . MouseMove += new MouseEventHandler ( DrawingAreaMouseMoved ) ;
134139 drawingImage . MouseLeftButtonDown += new MouseButtonEventHandler ( DrawingLeftButtonDown ) ;
@@ -499,7 +504,11 @@ void DrawingLeftButtonDown(object sender, MouseButtonEventArgs e)
499504 {
500505 // undo test
501506 undoBufferBitmap [ currentUndoIndex ++ ] = canvasBitmap . Clone ( ) ;
502- //Console.WriteLine("save undo " + currentUndoIndex);
507+
508+ // FIXME if undobuffer enabled above, sometimes Exception thrown: 'System.IndexOutOfRangeException' in PixelArtTool.exe
509+ // An unhandled exception of type 'System.IndexOutOfRangeException' occurred in PixelArtTool.exe
510+ // Index was outside the bounds of the array.
511+ // Console.WriteLine(drawingImage);
503512
504513 int x = ( int ) ( e . GetPosition ( drawingImage ) . X / canvasScaleX ) ;
505514 int y = ( int ) ( e . GetPosition ( drawingImage ) . Y / canvasScaleX ) ;
0 commit comments