diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-01-04 15:20:56 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-01-04 15:23:17 +0300 |
commit | c7eb83bc17f3465aa8c9c9aeb3998cc5882ac4ec (patch) | |
tree | c3214124d8954dd1e74a97f2d7723ac6b0bfa6c1 /source/blender/editors/interface/resources.c | |
parent | 3447944c3f6a9afdf608c10033f090b11c15753c (diff) |
Fix sequencer border-flickering
Offscreen viewport drawing wasn't properly restoring the theme.
Add API calls to store/restore the theme so it can be temporarily overridden.
Diffstat (limited to 'source/blender/editors/interface/resources.c')
-rw-r--r-- | source/blender/editors/interface/resources.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 941ef08b8e1..aa5b2570952 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -61,9 +61,16 @@ /* global for themes */ typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha); -static bTheme *theme_active = NULL; -static int theme_spacetype = SPACE_VIEW3D; -static int theme_regionid = RGN_TYPE_WINDOW; +/* be sure to keep 'bThemeState' in sync */ +static struct bThemeState g_theme_state = { + NULL, + SPACE_VIEW3D, + RGN_TYPE_WINDOW, +}; + +#define theme_active g_theme_state.theme +#define theme_spacetype g_theme_state.spacetype +#define theme_regionid g_theme_state.regionid void ui_resources_init(void) { @@ -1215,6 +1222,18 @@ bTheme *UI_GetTheme(void) return U.themes.first; } +/** + * for the rare case we need to temp swap in a different theme (offscreen render) + */ +void UI_Theme_Store(struct bThemeState *theme_state) +{ + *theme_state = g_theme_state; +} +void UI_Theme_Restore(struct bThemeState *theme_state) +{ + g_theme_state = *theme_state; +} + /* for space windows only */ void UI_ThemeColor(int colorid) { |