(API Change) Remove obs_graphics()

API Removed:
- graphics_t obs_graphics();
Replaced With:
- void obs_enter_graphics();
- void obs_leave_graphics();

Description:
  obs_graphics() was somewhat of a pointless function.  The only time
that it was ever necessary was to pass it as a parameter to
gs_entercontext() followed by a subsequent gs_leavecontext() call after
that.  So, I felt that it made a bit more sense just to implement
obs_enter_graphics() and obs_leave_graphics() functions to do the exact
same thing without having to repeat that code.  There's really no need
to ever "hold" the graphics pointer, though I suppose that could change
in the future so having a similar function come back isn't out of the
question.

Still, this at least reduces the amount of unnecessary repeated code for
the time being.
This commit is contained in:
jp9000
2014-08-04 05:48:58 -07:00
parent b007c6b139
commit 41176eef27
14 changed files with 66 additions and 56 deletions

View File

@@ -36,7 +36,7 @@ void dc_capture_init(struct dc_capture *capture, int x, int y,
capture->height = height;
capture->capture_cursor = cursor;
gs_entercontext(obs_graphics());
obs_enter_graphics();
if (!gs_gdi_texture_available())
compatibility = true;
@@ -46,7 +46,7 @@ void dc_capture_init(struct dc_capture *capture, int x, int y,
init_textures(capture);
gs_leavecontext();
obs_leave_graphics();
if (!capture->valid)
return;
@@ -76,12 +76,12 @@ void dc_capture_free(struct dc_capture *capture)
DeleteObject(capture->bmp);
}
gs_entercontext(obs_graphics());
obs_enter_graphics();
for (int i = 0; i < capture->num_textures; i++)
texture_destroy(capture->textures[i]);
gs_leavecontext();
obs_leave_graphics();
memset(capture, 0, sizeof(struct dc_capture));
}
@@ -223,7 +223,7 @@ effect_t create_opaque_effect(void)
return false;
}
gs_entercontext(obs_graphics());
obs_enter_graphics();
opaque_effect = gs_create_effect_from_file(effect_file, &error_string);
@@ -240,7 +240,7 @@ effect_t create_opaque_effect(void)
bfree(effect_file);
bfree(error_string);
gs_leavecontext();
obs_leave_graphics();
return opaque_effect;
}

View File

@@ -92,12 +92,12 @@ static void monitor_capture_destroy(void *data)
{
struct monitor_capture *capture = data;
gs_entercontext(obs_graphics());
obs_enter_graphics();
dc_capture_free(&capture->data);
effect_destroy(capture->opaque_effect);
gs_leavecontext();
obs_leave_graphics();
bfree(capture);
}
@@ -130,9 +130,9 @@ static void monitor_capture_tick(void *data, float seconds)
{
struct monitor_capture *capture = data;
gs_entercontext(obs_graphics());
obs_enter_graphics();
dc_capture_capture(&capture->data, NULL);
gs_leavecontext();
obs_leave_graphics();
UNUSED_PARAMETER(seconds);
}

View File

@@ -334,9 +334,9 @@ static void wc_destroy(void *data)
bfree(wc->class);
bfree(wc->executable);
gs_entercontext(obs_graphics());
obs_enter_graphics();
effect_destroy(wc->opaque_effect);
gs_leavecontext();
obs_leave_graphics();
bfree(wc);
}
@@ -413,7 +413,7 @@ static void wc_tick(void *data, float seconds)
return;
}
gs_entercontext(obs_graphics());
obs_enter_graphics();
GetClientRect(wc->window, &rect);
@@ -438,7 +438,7 @@ static void wc_tick(void *data, float seconds)
}
dc_capture_capture(&wc->capture, wc->window);
gs_leavecontext();
obs_leave_graphics();
}
static void wc_render(void *data, effect_t effect)