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

Screen Scrolling rendering error, game screen size off by 1 pixel both horizontally and vertically #10

Open
drone1400 opened this issue Mar 4, 2025 · 1 comment

Comments

@drone1400
Copy link
Contributor

drone1400 commented Mar 4, 2025

First of all, I am talking about the Windows release of DinkHD V2.05

When the Screen Scrolling effect is enabled, during the actual scrolling effect itself, the game-screen area is too big by 1 pixel in both width and height.

This offset error seems to be consistent regardless of resolution. I have tested this at both 640x480 and 1280x960 and noticed the same thing happening.

At 640x480, the game-screen area is 601x401 pixels instead of 600x400.

At 1280x960, the game-screen area is 1201x801 pixels instead of 1200x800.

The extra pixel line, both horizontally and vertically, is just pure black and overrides the right sidebar and the bottom hud elements.

I have uploaded some short video recordings and screenshots that showcase the issue.

NOTE: At 1280x960, when scrolling towards the left, another rendering error can be seen. There is a left-over single pixel width line from one of the sidebars right in between the two game screens. However, I believe this is related to a separate scaling specific rendering issue which I shall be posting about shortly.

640x480 video: https://github.com/user-attachments/assets/54cb6a38-2a5e-458a-83df-d99f1163bcdf
1280x960 video: https://github.com/user-attachments/assets/164f3afa-af41-42b3-b014-16dfe780c29d

Size Normal Left Right Up Down
640x480 Image Image Image Image Image
1280x960 Image Image Image Image Image

EDIT: tried organizing the screenshots so they take less space xD

@SethRobinson
Copy link
Owner

Hey, appreciate the detailed info!

I can see the code is adding a bit to fix a seam that pops up when doing screen scrolling:

Image

However, if the screen is exactly 640X480 (or any exact 4:3 ratio?) it doesn't need this fix. (the first versions of DinkHD ran only on the iPhone and required scaling)

So I've added this code which seams (ha) to fix it, but only if smoothing is off and if running at an exact 4:3 ratio like 640X480:

if (fabs((dstRect.GetWidth() / dstRect.GetHeight()) - (4.0f / 3.0f)) < 0.01f)
{
	bNeedSeamFix = false;
}

if (bNeedSeamFix)
{
	//without normal antialiasing we don't need to do much, but this does fix tiny black artifacts during the screen transition
	dstOffset = rtRectf(-0.05, -0.05f, 0.05f, 0.05);
	srcOffset = rtRectf(0.4, 0.4, -0.4, -0.4);
}

Hmm, in both cases there is still a little black line on the right and bottom border that probably shouldn't be there, but is likely caused by something else, it's a lot of weird matrix math that keeps multiple levels of scaling to keep aspect ratio correct on weird screen sizes. (I can't just have a window the correct size, it has to be full screen on mobile devices)

Image

Suspect that's due to something else though.

Anyway thanks, this fix will be in the next build

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

No branches or pull requests

2 participants