Use get_renderer() over *get_window()
This doesn't appear to have been an issue in the rectangle drawing code at least, but it should guard against possible segfaults in the future.
This commit is contained in:
parent
4a0f8d9db0
commit
da7917955b
2 changed files with 3 additions and 3 deletions
|
@ -366,7 +366,7 @@ class viewport_and_clip_rect_setter
|
|||
{
|
||||
public:
|
||||
viewport_and_clip_rect_setter(const widget& widget, int x_offset, int y_offset)
|
||||
: renderer_(*CVideo::get_singleton().get_window())
|
||||
: renderer_(CVideo::get_singleton().get_renderer())
|
||||
{
|
||||
// Set viewport.
|
||||
const SDL_Rect dst_rect = widget.calculate_blitting_rectangle(x_offset, y_offset);
|
||||
|
|
|
@ -56,7 +56,7 @@ SDL_Rect union_rects(const SDL_Rect& rect1, const SDL_Rect& rect2)
|
|||
|
||||
void draw_rectangle(const SDL_Rect& rect, const color_t& color)
|
||||
{
|
||||
SDL_Renderer* renderer = *CVideo::get_singleton().get_window();
|
||||
SDL_Renderer* renderer = CVideo::get_singleton().get_renderer();
|
||||
|
||||
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, color.a);
|
||||
SDL_RenderDrawRect(renderer, &rect);
|
||||
|
@ -64,7 +64,7 @@ void draw_rectangle(const SDL_Rect& rect, const color_t& color)
|
|||
|
||||
void fill_rectangle(const SDL_Rect& rect, const color_t& color)
|
||||
{
|
||||
SDL_Renderer* renderer = *CVideo::get_singleton().get_window();
|
||||
SDL_Renderer* renderer = CVideo::get_singleton().get_renderer();
|
||||
|
||||
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, color.a);
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
|
|
Loading…
Add table
Reference in a new issue