Skip to content
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

Merged
merged 1 commit into from
Apr 15, 2023
Merged

Conversation

GyroJoe
Copy link
Contributor

@GyroJoe GyroJoe commented Apr 15, 2023

Fixes #357

Allows unlocked AR for virtual DMD when using the mirror command again.

@@ -11,9 +11,9 @@
using LibDmd.Output.PinDmd1;
using LibDmd.Output.PinDmd2;
using LibDmd.Output.PinDmd3;
using LibDmd.Output.ZeDMD;
Copy link
Contributor Author

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)
Copy link
Contributor Author

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.

Copy link
Owner

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);
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@freezy
Copy link
Owner

freezy commented Apr 15, 2023

Awesome, thanks a lot!

Copy link
Owner

@freezy freezy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mirroring screen to virtual dmd crashes since v1.10.0 works fine in v1.9.0
2 participants