-
Notifications
You must be signed in to change notification settings - Fork 41
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
PROTO: Create text_objects and use them for rendering to improve text rendering performance #773
base: master
Are you sure you want to change the base?
Changes from all commits
c04bb35
e7f48cf
d4fa6db
bd1fd57
ead6221
607dd4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,7 +110,11 @@ static void menu_render(component *c) { | |
if(m->help_bg2) { | ||
video_draw(m->help_bg2, m->help_x - 8, m->help_y - 8); | ||
} | ||
text_render(&m->help_text_conf, TEXT_DEFAULT, m->help_x, m->help_y, m->help_w, m->help_h, (*tmp)->help); | ||
// TODO: The text_cache should move into inner component. In this case the one of the s->objs. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this comment is wrong and it's not invalidated every frame There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think what I ran into was that the menu didn't animate, so I marked all these dynamic. |
||
// Right now it will get invalidated on every render. For help text it usually doesn't matter because there | ||
// is usually only 1 help text on the screen per time. | ||
text_render(&(m->text_cache[0]), &m->help_text_conf, TEXT_DEFAULT, m->help_x, m->help_y, m->help_w, | ||
m->help_h, (*tmp)->help); | ||
} | ||
i++; | ||
} | ||
|
@@ -368,6 +372,7 @@ void menu_set_help_text_settings(component *c, text_settings *settings) { | |
|
||
static void menu_free(component *c) { | ||
menu *m = sizer_get_obj(c); | ||
text_objects_free(m->text_cache, 1); | ||
if(m->bg1) { | ||
surface_free(m->bg1); | ||
omf_free(m->bg1); | ||
|
@@ -411,6 +416,11 @@ void menu_set_padding(component *c, int padding) { | |
m->padding = padding; | ||
} | ||
|
||
void menu_invalidate_help_text_cache(component *c) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does anything use this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. game_menu_return should be calling it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I goofed the rebase? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could also be I missed it in the original PROTO submit. |
||
menu *m = sizer_get_obj(c); | ||
m->text_cache->dirty = true; | ||
} | ||
|
||
component *menu_create(int obj_h) { | ||
component *c = sizer_create(); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove