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

Aggregate SDL_Surfaces and their scale in RenSurface #1429

Merged
merged 1 commit into from
Mar 19, 2023

Conversation

Guldoman
Copy link
Member

No description provided.

src/renwindow.h Outdated
@@ -6,19 +6,17 @@ struct RenWindow {
#ifdef LITE_USE_SDL_RENDERER
SDL_Renderer *renderer;
SDL_Texture *texture;
SDL_Surface *surface;
int surface_scale;
RenSurface rs;
Copy link
Contributor

Choose a reason for hiding this comment

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

wouldn't the name surface be better to keep?
The previous type was a pointer, no wrong structure dereferencing should cause an invalid compile due here.

Copy link
Member Author

Choose a reason for hiding this comment

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

wouldn't the name surface be better to keep?

It's mostly to distinguish it from the SDL surface underneath, so we avoid RenWindow.surface.surface.

The previous type was a pointer, no wrong structure dereferencing should cause an invalid compile due here.

What do you mean?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's mostly to distinguish it from the SDL surface underneath, so we avoid RenWindow.surface.surface.
fair.

But I feel like the name rs is a bit undescriptive.

What do you mean?

Ignore it. Just Connecting dots that don't need connecting

Copy link
Member Author

Choose a reason for hiding this comment

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

But I feel like the name rs is a bit undescriptive.

Yeah that's fair.
What name should we use? We could even change the name of the underlying SDL_Surface.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's fine; but if you must, you could simply use rensurface; that's extremely clear, and falls in line with the normal coding practice of capitalizing the class, and lower-casing the instance.

Comment on lines -9 to -10
SDL_Surface *surface;
int surface_scale;
Copy link
Contributor

Choose a reason for hiding this comment

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

RenSurface appears to only be a combination of surface and surface_scale with a changed datatype for scales.

Does this make working with surfaces independently easier?
Does it only affect the use of the SDL Renderer?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it dissociates the surface from the window scale.
At the moment only using the SDL Renderer we get a scale that might be not 1, yeah.

I think in the future, when we refactor how we scale, we'll just not need to have a scale variable here, so then we might just replace RenSurface with SDL_Surface.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, alright.

Is switching to a fixed point number going to introduce any problems?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hopefully not.
This change was done thinking about future fractional scaling support. But considering that we might just scrap the whole surface scale concept, I should probably just revert this to be an int like before.

@Guldoman Guldoman force-pushed the PR_add_RenSurface branch from e1c85ef to 78eb3de Compare March 19, 2023 14:52
@Guldoman
Copy link
Member Author

Reverted back to int for the scale, as there's currently no need for this to be a float.

@Guldoman Guldoman force-pushed the PR_add_RenSurface branch from 78eb3de to d47c262 Compare March 19, 2023 19:26
@adamharrison adamharrison merged commit 2cdf5d8 into lite-xl:master Mar 19, 2023
takase1121 pushed a commit to takase1121/lite-xl that referenced this pull request Aug 19, 2023
takase1121 pushed a commit to takase1121/lite-xl that referenced this pull request Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants