SPARK-933 The screenshot included by 'Report a Problem' is cropped

This commit is contained in:
Eric Harding committed 2018-03-28 19:24:13 -04:00
1 parent 4b3e67cae9
commit 5dcee95c6b
1 file changed
+9 -4
@@ -4,6 +4,7 @@ using System.IO;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media.Imaging;
using mbts.config;
using mbts.ui.native;
namespace mbts.ui.utility
@@ -46,10 +47,15 @@ namespace mbts.ui.utility
return null;
}
static (int width,int height) screen_size() {
var config = Configuration.get<bts.config.System>();
double width = SystemParameters.VirtualScreenWidth * config.dpi_ratio;
double height = SystemParameters.VirtualScreenHeight * config.dpi_ratio;
return ((int)width, (int)height);
}
private static BitmapSource capture() {
int width = (int)SystemParameters.VirtualScreenWidth;
int height = (int)SystemParameters.VirtualScreenHeight;
(int width, int height) = screen_size();
IntPtr screen_dc = NativeMethods.GetDC(IntPtr.Zero);
IntPtr mem_dc = NativeMethods.CreateCompatibleDC(screen_dc);
IntPtr hbitmap = NativeMethods.CreateCompatibleBitmap(screen_dc, width, height);
@@ -64,8 +70,7 @@ namespace mbts.ui.utility
private static BitmapSource capture(int width_dest, int height_dest) {
int width_src = (int)SystemParameters.VirtualScreenWidth;
int height_src = (int)SystemParameters.VirtualScreenHeight;
(int width_src, int height_src) = screen_size();
IntPtr screen_dc = NativeMethods.GetDC(IntPtr.Zero);
IntPtr mem_dc = NativeMethods.CreateCompatibleDC(screen_dc);
IntPtr hbitmap = NativeMethods.CreateCompatibleBitmap(screen_dc, width_dest, height_dest);