obs-text: Render only when changed#10735
Open
exeldro wants to merge 1 commit intoobsproject:masterfrom
Open
Conversation
RytoEX
requested changes
Jun 1, 2024
Member
RytoEX
left a comment
There was a problem hiding this comment.
Nits. Don't know enough about these code changes to make a quick call, so hopefully someone else familiar with them can give it a look.
f84ac8f to
046c50c
Compare
RytoEX
requested changes
May 8, 2026
Member
RytoEX
left a comment
There was a problem hiding this comment.
Probably fine as-is, as we'll be doing a pass with clang-format, but might as well add braces now if time permits.
Comment on lines
+800
to
+808
| if (color != new_color || opacity != new_opacity || | ||
| (gradient && color2 != new_color2) || | ||
| (gradient && opacity2 != new_opacity2) || | ||
| gradient_dir != new_grad_dir || vertical != new_vertical || | ||
| bk_color != new_bk_color || bk_opacity != new_bk_opacity || | ||
| use_extents != new_extents || wrap != new_extents_wrap || | ||
| extents_cx != n_extents_cx || extents_cy != n_extents_cy || | ||
| antialiasing != new_antialiasing) | ||
| needs_render = true; |
Member
There was a problem hiding this comment.
Suggested change
| if (color != new_color || opacity != new_opacity || | |
| (gradient && color2 != new_color2) || | |
| (gradient && opacity2 != new_opacity2) || | |
| gradient_dir != new_grad_dir || vertical != new_vertical || | |
| bk_color != new_bk_color || bk_opacity != new_bk_opacity || | |
| use_extents != new_extents || wrap != new_extents_wrap || | |
| extents_cx != n_extents_cx || extents_cy != n_extents_cy || | |
| antialiasing != new_antialiasing) | |
| needs_render = true; | |
| if (color != new_color || opacity != new_opacity || | |
| (gradient && color2 != new_color2) || | |
| (gradient && opacity2 != new_opacity2) || | |
| gradient_dir != new_grad_dir || vertical != new_vertical || | |
| bk_color != new_bk_color || bk_opacity != new_bk_opacity || | |
| use_extents != new_extents || wrap != new_extents_wrap || | |
| extents_cx != n_extents_cx || extents_cy != n_extents_cy || | |
| antialiasing != new_antialiasing) { | |
| needs_render = true; | |
| } |
Comment on lines
+852
to
+855
| if (old_text != text || use_outline != new_outline || | ||
| outline_color != new_o_color || outline_opacity != new_o_opacity || | ||
| outline_size != roundf(float(new_o_size))) | ||
| needs_render = true; |
Member
There was a problem hiding this comment.
Suggested change
| if (old_text != text || use_outline != new_outline || | |
| outline_color != new_o_color || outline_opacity != new_o_opacity || | |
| outline_size != roundf(float(new_o_size))) | |
| needs_render = true; | |
| if (old_text != text || use_outline != new_outline || | |
| outline_color != new_o_color || outline_opacity != new_o_opacity || | |
| outline_size != roundf(float(new_o_size))) { | |
| needs_render = true; | |
| } |
Comment on lines
+886
to
+887
| if (needs_render) | ||
| RenderText(); |
Member
There was a problem hiding this comment.
Suggested change
| if (needs_render) | |
| RenderText(); | |
| if (needs_render) { | |
| RenderText(); | |
| } |
Comment on lines
+911
to
+912
| if (old_text != text) | ||
| RenderText(); |
Member
There was a problem hiding this comment.
Suggested change
| if (old_text != text) | |
| RenderText(); | |
| if (old_text != text) { | |
| RenderText(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Render text only when changed
Motivation and Context
Rendering text can take lots of time (in my testing example 86 ms), so in case nothing changed, like for example a obs-websocket request to update the text to the same value, the rendering step can be skipped.
How Has This Been Tested?
On windows 11 by changing a text file without resulting text changes to be rendered and by calling SetInputSettings on obs-websockets
Types of changes
Checklist: