Skip to content

Commit

Permalink
GUI2/Canvas: renamed blit function and removed surface argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Jul 9, 2017
1 parent 5ed7abf commit 006cebe
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/gui/core/canvas.cpp
Expand Up @@ -1453,7 +1453,7 @@ void canvas::draw(const bool force)
is_dirty_ = false;
}

void canvas::blit(surface& /*surf*/, SDL_Rect rect)
void canvas::render(SDL_Rect rect)
{
SDL_RenderSetViewport(renderer_, &rect);

Expand Down
5 changes: 2 additions & 3 deletions src/gui/core/canvas.hpp
Expand Up @@ -102,15 +102,14 @@ class canvas
void draw(const bool force = false);

/**
* Blits the canvas unto another surface.
* Copies the canvas texture to the screen renderer.
*
* It makes sure the image on the canvas is up to date. Also executes the
* pre-blitting functions.
*
* @param surf The surface to blit upon.
* @param rect The place to blit to.
*/
void blit(surface& surf, SDL_Rect rect);
void render(SDL_Rect rect);

/**
* Sets the config.
Expand Down
10 changes: 4 additions & 6 deletions src/gui/widgets/panel.cpp
Expand Up @@ -61,20 +61,18 @@ unsigned panel::get_state() const
return 0;
}

void panel::impl_draw_background(surface& frame_buffer, int x_offset, int y_offset)
void panel::impl_draw_background(surface& /*frame_buffer*/, int x_offset, int y_offset)
{
DBG_GUI_D << LOG_HEADER << " size " << get_rectangle() << ".\n";

get_canvas(0).blit(frame_buffer,
calculate_blitting_rectangle(x_offset, y_offset));
get_canvas(0).render(calculate_blitting_rectangle(x_offset, y_offset));
}

void panel::impl_draw_foreground(surface& frame_buffer, int x_offset, int y_offset)
void panel::impl_draw_foreground(surface& /*frame_buffer*/, int x_offset, int y_offset)
{
DBG_GUI_D << LOG_HEADER << " size " << get_rectangle() << ".\n";

get_canvas(1).blit(frame_buffer,
calculate_blitting_rectangle(x_offset, y_offset));
get_canvas(1).render(calculate_blitting_rectangle(x_offset, y_offset));
}

point panel::border_space() const
Expand Down
5 changes: 2 additions & 3 deletions src/gui/widgets/styled_widget.cpp
Expand Up @@ -433,15 +433,14 @@ int styled_widget::get_text_maximum_height() const
return get_height() - config_->text_extra_height;
}

void styled_widget::impl_draw_background(surface& frame_buffer,
void styled_widget::impl_draw_background(surface& /*frame_buffer*/,
int x_offset,
int y_offset)
{
DBG_GUI_D << LOG_HEADER << " label '" << debug_truncate(label_) << "' size "
<< get_rectangle() << ".\n";

get_canvas(get_state()).blit(frame_buffer,
calculate_blitting_rectangle(x_offset, y_offset));
get_canvas(get_state()).render(calculate_blitting_rectangle(x_offset, y_offset));
}

void styled_widget::impl_draw_foreground(surface& /*frame_buffer*/
Expand Down

0 comments on commit 006cebe

Please sign in to comment.