-
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
Conversation
@@ -11,9 +11,9 @@ | |||
using LibDmd.Output.PinDmd1; | |||
using LibDmd.Output.PinDmd2; | |||
using LibDmd.Output.PinDmd3; | |||
using LibDmd.Output.ZeDMD; |
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
@@ -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 comment
The 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 comment
The 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.
@@ -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 comment
The 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.
{ | ||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Height was getting ignored, since the AR was locked.
Awesome, thanks a lot! |
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.
Excellent!
Fixes #357
Allows unlocked AR for virtual DMD when using the mirror command again.