-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes screen grab crash #366
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,9 @@ | |
using LibDmd.Output.PinDmd1; | ||
using LibDmd.Output.PinDmd2; | ||
using LibDmd.Output.PinDmd3; | ||
using LibDmd.Output.ZeDMD; | ||
using LibDmd.Output.Pixelcade; | ||
using LibDmd.Output.Virtual.AlphaNumeric; | ||
using LibDmd.Output.ZeDMD; | ||
using NLog; | ||
using static System.Windows.Threading.Dispatcher; | ||
using static DmdExt.Common.BaseOptions.DestinationType; | ||
|
@@ -38,7 +38,7 @@ public RenderGraphCollection GetRenderGraphs(HashSet<string> reportingTags) | |
return _graphs; | ||
} | ||
|
||
protected List<IDestination> GetRenderers(IConfiguration config, HashSet<string> reportingTags, int[] position = null) | ||
protected List<IDestination> GetRenderers(IConfiguration config, HashSet<string> reportingTags) | ||
{ | ||
var renderers = new List<IDestination>(); | ||
if (config.PinDmd1.Enabled) { | ||
|
@@ -146,7 +146,7 @@ protected List<IDestination> GetRenderers(IConfiguration config, HashSet<string> | |
} | ||
|
||
if (config.VirtualDmd.Enabled) { | ||
renderers.Add(ShowVirtualDmd(config, position)); | ||
renderers.Add(ShowVirtualDmd(config)); | ||
Logger.Info("Added virtual DMD renderer."); | ||
reportingTags.Add("Out:VirtualDmd"); | ||
} | ||
|
@@ -180,13 +180,14 @@ protected List<IDestination> GetRenderers(IConfiguration config, HashSet<string> | |
return renderers; | ||
} | ||
|
||
private static IDestination ShowVirtualDmd(IConfiguration config, int[] position) | ||
private static IDestination ShowVirtualDmd(IConfiguration config) | ||
{ | ||
var dmd = new VirtualDmd { | ||
Left = config.VirtualDmd.Left, | ||
Top = config.VirtualDmd.Top, | ||
Width = config.VirtualDmd.Width, | ||
Height = config.VirtualDmd.Height | ||
Height = config.VirtualDmd.Height, | ||
IgnoreAspectRatio = config.VirtualDmd.IgnoreAr | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Height was getting ignored, since the AR was locked. |
||
}; | ||
dmd.Setup(config as Configuration, config is Configuration iniConfig ? iniConfig.GameName : null); | ||
var thread = new Thread(() => { | ||
|
@@ -196,8 +197,6 @@ private static IDestination ShowVirtualDmd(IConfiguration config, int[] position | |
|
||
dmd.Dispatcher.Invoke(() => { | ||
dmd.Dmd.Init(); | ||
if(position != null) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The position it was passing here was the screen grab position, not the virtual dmd position. Not sure why, but it didn't seem correct to me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're absolutely right, grabbing position has no business when creating the virtual DMD. |
||
dmd.Dmd.SetDimensions(position[2]- position[0], position[3]-position[1]); | ||
dmd.Show(); | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -605,7 +605,7 @@ private void ogl_OpenGLDraw(object sender, OpenGLRoutedEventArgs args) | |
if (createTexture) | ||
gl.TexImage2D(OpenGL.GL_TEXTURE_2D, 0, OpenGL.GL_RGB, _bitmapToRender.Width, _bitmapToRender.Height, 0, OpenGL.GL_BGR, OpenGL.GL_UNSIGNED_BYTE, data.Scan0); | ||
else | ||
glTexSubImage2D(OpenGL.GL_TEXTURE_2D, 0, 0, 0, DmdWidth, DmdHeight, OpenGL.GL_BGR, OpenGL.GL_UNSIGNED_BYTE, data.Scan0); | ||
glTexSubImage2D(OpenGL.GL_TEXTURE_2D, 0, 0, 0, _bitmapToRender.Width, _bitmapToRender.Height, OpenGL.GL_BGR, OpenGL.GL_UNSIGNED_BYTE, data.Scan0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cause of the crash. The size needs to match the buffer size. Likely just a copy/paste error. |
||
_bitmapToRender.UnlockBits(data); | ||
break; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import resort