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

Avoid extraneous call for DrawSelect in case of a zoom #594

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

tobiolo
Copy link
Collaborator

@tobiolo tobiolo commented Jan 14, 2024

Document::Zoom(int, wxDC&, bool, bool) calls
Document::DrawSelectMove(wxDC&, Selection&, bool, bool) which calls Document::DrawSelect(wxDC&, Selection&, bool, bool). So in this case, we do not need to call
Document::DrawSelect(wxDC&, Selection&, bool, bool) again.

`Document::Zoom(int, wxDC&, bool, bool)` calls
`Document::DrawSelectMove(wxDC&, Selection&, bool, bool)` which calls
`Document::DrawSelect(wxDC&, Selection&, bool, bool)`.
So in this case, we do not need to call
`Document::DrawSelect(wxDC&, Selection&, bool, bool)` again.
@tobiolo tobiolo changed the title Avoid extraneous call for DrawSelect in case of a zoom Avoid extraneous call for DrawSelect in case of a zoom Jan 14, 2024
@tobiolo
Copy link
Collaborator Author

tobiolo commented Jan 15, 2024

#598
#595
#594
should make Refresh() only be called once when document is loaded.

@aardappel
Copy link
Owner

Are you aware that at least on Windows the selection is drawn as a XOR operation (i.e. invert pixels), meaning that drawing it a second time undoes the drawing? Which is faster than redrawing the entire screen.

@tobiolo
Copy link
Collaborator Author

tobiolo commented Jan 16, 2024

Are you aware that at least on Windows the selection is drawn as a XOR operation (i.e. invert pixels), meaning that drawing it a second time undoes the drawing? Which is faster than redrawing the entire screen.

I am aware of this, yes. Unfortunately we have to stick with SIMPLERENDER on Unix platforms.

@aardappel
Copy link
Owner

So does this change work well on Windows?

@tobiolo
Copy link
Collaborator Author

tobiolo commented Jan 16, 2024

So does this change work well on Windows?

I tested it on Windows and it works well. In Document::Draw, everythings get redrawn completely so it should not matter.

@tobiolo tobiolo merged commit 045caf2 into aardappel:master Jan 16, 2024
4 checks passed
@tobiolo tobiolo deleted the avoid-extraneous-drawselect-call branch January 16, 2024 09:14
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.

None yet

2 participants