Skip to content

Commit

Permalink
Renamed drawing_buffer to drawing_queue
Browse files Browse the repository at this point in the history
Also renamed drawing_queue::drawing_layer to just 'layer'.
  • Loading branch information
Vultraz committed Jul 26, 2017
1 parent 5eaef33 commit 4b1eb21
Show file tree
Hide file tree
Showing 20 changed files with 110 additions and 110 deletions.
4 changes: 2 additions & 2 deletions projectfiles/CodeBlocks/wesnoth.cbp
Expand Up @@ -260,8 +260,8 @@
<Unit filename="../../src/display_chat_manager.hpp" />
<Unit filename="../../src/display_context.cpp" />
<Unit filename="../../src/display_context.hpp" />
<Unit filename="../../src/drawing_buffer.cpp" />
<Unit filename="../../src/drawing_buffer.hpp" />
<Unit filename="../../src/drawing_queue.cpp" />
<Unit filename="../../src/drawing_queue.hpp" />
<Unit filename="../../src/editor/action/action.cpp" />
<Unit filename="../../src/editor/action/action.hpp" />
<Unit filename="../../src/editor/action/action_base.hpp" />
Expand Down
2 changes: 1 addition & 1 deletion source_lists/libwesnoth
Expand Up @@ -3,7 +3,7 @@ cursor.cpp
desktop/clipboard.cpp
display.cpp
display_context.cpp
drawing_buffer.cpp
drawing_queue.cpp
events.cpp
floating_label.cpp
font/font_config.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/arrow.cpp
Expand Up @@ -32,7 +32,7 @@ static lg::log_domain log_arrows("arrows");
#define SCREEN (static_cast<display*>(resources::screen))

arrow::arrow(bool hidden)
: layer_(drawing_buffer::LAYER_ARROWS)
: layer_(drawing_queue::LAYER_ARROWS)
, color_("red")
, style_(STYLE_STANDARD)
, path_()
Expand Down
2 changes: 1 addition & 1 deletion src/arrow.hpp
Expand Up @@ -90,7 +90,7 @@ class arrow {
*/
virtual void update_symbols();

drawing_buffer::drawing_layer layer_;
drawing_queue::layer layer_;

std::string color_;
/// represents the subdirectory that holds images for this arrow style
Expand Down
32 changes: 16 additions & 16 deletions src/display.cpp
Expand Up @@ -206,7 +206,7 @@ display::display(const display_context* dc,
, animate_water_(true)
, flags_()
, activeTeam_(0)
, drawing_buffer_()
, drawing_queue_()
, map_screenshot_(false)
, reach_map_()
, reach_map_old_()
Expand Down Expand Up @@ -1385,7 +1385,7 @@ static void draw_background(const SDL_Rect& area, const std::string& image)
}

void display::draw_text_in_hex(const map_location& loc,
const drawing_buffer::drawing_layer layer, const std::string& text,
const drawing_queue::layer layer, const std::string& text,
size_t font_size, color_t color, double x_in_hex, double y_in_hex)
{
if (text.empty()) return;
Expand All @@ -1401,12 +1401,12 @@ void display::draw_text_in_hex(const map_location& loc,
for (int dy=-1; dy <= 1; ++dy) {
for (int dx=-1; dx <= 1; ++dx) {
if (dx!=0 || dy!=0) {
drawing_buffer_add(layer, loc, x + dx, y + dy, back_surf);
drawing_queue_add(layer, loc, x + dx, y + dy, back_surf);
}
}
}

drawing_buffer_add(layer, loc, x, y, text_surf);
drawing_queue_add(layer, loc, x, y, text_surf);
}

void display::select_hex(map_location hex)
Expand Down Expand Up @@ -2722,13 +2722,13 @@ void display::draw(bool update, bool force)
* draw_invalidated() also invalidates the halos, so also needs to be
* ran if invalidated_.empty() == true.
*/
//drawing_buffer_.set_clip_rect(map_area());
//drawing_queue_.set_clip_rect(map_area());
if(!invalidated_.empty() || preferences::show_haloes()) {
draw_invalidated();
invalidated_.clear();
}

//drawing_buffer_.render_buffer();
//drawing_queue_.render_buffer();

post_commit();
draw_sidebar();
Expand Down Expand Up @@ -3006,10 +3006,10 @@ void display::draw_hex(const map_location& loc)
// tod may differ from tod if hex is illuminated.
const std::string& tod_hex_mask = tod.image_mask;
if(tod_hex_mask1 != nullptr || tod_hex_mask2 != nullptr) {
drawing_buffer_add(drawing_buffer::LAYER_TERRAIN_FG, loc, xpos, ypos, tod_hex_mask1);
drawing_buffer_add(drawing_buffer::LAYER_TERRAIN_FG, loc, xpos, ypos, tod_hex_mask2);
drawing_queue_add(drawing_queue::LAYER_TERRAIN_FG, loc, xpos, ypos, tod_hex_mask1);
drawing_queue_add(drawing_queue::LAYER_TERRAIN_FG, loc, xpos, ypos, tod_hex_mask2);
} else if(!tod_hex_mask.empty()) {
drawing_buffer_add(drawing_buffer::LAYER_TERRAIN_FG, loc, xpos, ypos,
drawing_queue_add(drawing_queue::LAYER_TERRAIN_FG, loc, xpos, ypos,
image::get_image(tod_hex_mask,image::SCALED_TO_HEX));
}
#endif
Expand Down Expand Up @@ -3041,8 +3041,8 @@ void display::draw_hex(const map_location& loc)
if (draw_num_of_bitmaps_) {
off_y -= text->h / 2;
}
drawing_buffer_add(drawing_buffer::LAYER_FOG_SHROUD, loc, off_x, off_y, bg);
drawing_buffer_add(drawing_buffer::LAYER_FOG_SHROUD, loc, off_x, off_y, text);
drawing_queue_add(drawing_queue::LAYER_FOG_SHROUD, loc, off_x, off_y, bg);
drawing_queue_add(drawing_queue::LAYER_FOG_SHROUD, loc, off_x, off_y, text);
}

if(draw_terrain_codes_ && (game_config::debug || !shrouded(loc))) {
Expand All @@ -3059,8 +3059,8 @@ void display::draw_hex(const map_location& loc)
} else if (draw_num_of_bitmaps_ && !draw_coordinates_) {
off_y -= text->h / 2;
}
drawing_buffer_add(drawing_buffer::LAYER_FOG_SHROUD, loc, off_x, off_y, bg);
drawing_buffer_add(drawing_buffer::LAYER_FOG_SHROUD, loc, off_x, off_y, text);
drawing_queue_add(drawing_queue::LAYER_FOG_SHROUD, loc, off_x, off_y, bg);
drawing_queue_add(drawing_queue::LAYER_FOG_SHROUD, loc, off_x, off_y, text);
}

if(draw_num_of_bitmaps_) {
Expand All @@ -3078,13 +3078,13 @@ void display::draw_hex(const map_location& loc)
if (draw_terrain_codes_) {
off_y += text->h / 2;
}
drawing_buffer_add(drawing_buffer::LAYER_FOG_SHROUD, loc, off_x, off_y, bg);
drawing_buffer_add(drawing_buffer::LAYER_FOG_SHROUD, loc, off_x, off_y, text);
drawing_queue_add(drawing_queue::LAYER_FOG_SHROUD, loc, off_x, off_y, bg);
drawing_queue_add(drawing_queue::LAYER_FOG_SHROUD, loc, off_x, off_y, text);
}
}

if(debug_foreground) {
drawing_buffer_add(drawing_buffer::LAYER_UNIT_DEFAULT, loc, xpos, ypos,
drawing_queue_add(drawing_queue::LAYER_UNIT_DEFAULT, loc, xpos, ypos,
image::get_image("terrain/foreground.png", image_type));
}
#endif
Expand Down
14 changes: 7 additions & 7 deletions src/display.hpp
Expand Up @@ -50,7 +50,7 @@ namespace wb {

#include "animated.hpp"
#include "display_context.hpp"
#include "drawing_buffer.hpp"
#include "drawing_queue.hpp"
#include "filter_context.hpp"
#include "font/sdl_ttf.hpp"
#include "font/standard_colors.hpp"
Expand Down Expand Up @@ -819,20 +819,20 @@ class display : public filter_context, public video2::draw_layering
* The font size is adjusted to the zoom factor.
*/
void draw_text_in_hex(const map_location& loc,
const drawing_buffer::drawing_layer layer, const std::string& text, size_t font_size,
const drawing_queue::layer layer, const std::string& text, size_t font_size,
color_t color, double x_in_hex=0.5, double y_in_hex=0.5);

protected:

//TODO sort
size_t activeTeam_;

drawing_buffer drawing_buffer_;
drawing_queue drawing_queue_;

public:
drawing_buffer& get_drawing_buffer()
drawing_queue& get_drawing_queue()
{
return drawing_buffer_;
return drawing_queue_;
}

/**
Expand All @@ -843,14 +843,14 @@ class display : public filter_context, public video2::draw_layering
* drawing order.
*/

void drawing_buffer_add(const drawing_buffer::drawing_layer,
void drawing_queue_add(const drawing_queue::layer,
const map_location&, int, int, const surface&,
const SDL_Rect &clip = SDL_Rect())
{
UNUSED(clip);
}

void drawing_buffer_add(const drawing_buffer::drawing_layer,
void drawing_queue_add(const drawing_queue::layer,
const map_location&, int, int,
const std::vector<surface>&,
const SDL_Rect &clip = SDL_Rect())
Expand Down
8 changes: 4 additions & 4 deletions src/drawing_buffer.cpp → src/drawing_queue.cpp
Expand Up @@ -12,7 +12,7 @@
See the COPYING file for more details.
*/

#include "drawing_buffer.hpp"
#include "drawing_queue.hpp"

#include "display.hpp"
#include "sdl/surface.hpp"
Expand Down Expand Up @@ -45,15 +45,15 @@ enum {

} // end anon namespace

drawing_buffer::buffer_key::layer_group_array drawing_buffer::buffer_key::layer_groups {{
drawing_queue::buffer_key::layer_group_array drawing_queue::buffer_key::layer_groups {{
LAYER_TERRAIN_BG,
LAYER_UNIT_FIRST,
LAYER_UNIT_MOVE_DEFAULT,
// Make sure the movement doesn't show above fog and reachmap.
LAYER_REACHMAP
}};

drawing_buffer::buffer_key::buffer_key(const map_location &loc, drawing_layer layer)
drawing_queue::buffer_key::buffer_key(const map_location &loc, layer layer)
: key_(0)
{
// Start with the index of last group entry...
Expand Down Expand Up @@ -85,7 +85,7 @@ drawing_buffer::buffer_key::buffer_key(const map_location &loc, drawing_layer la
key_ |= (static_cast<unsigned int>(layer) << SHIFT_LAYER) | static_cast<unsigned int>(loc.x + MAX_BORDER) / 2;
}

void drawing_buffer::render_buffer()
void drawing_queue::render_buffer()
{
// std::list::sort() is a stable sort
buffer_.sort();
Expand Down
14 changes: 7 additions & 7 deletions src/drawing_buffer.hpp → src/drawing_queue.hpp
Expand Up @@ -23,10 +23,10 @@
#include <list>
#include <vector>

class drawing_buffer
class drawing_queue
{
public:
drawing_buffer()
drawing_queue()
: buffer_()
{
}
Expand All @@ -44,7 +44,7 @@ class drawing_buffer
/**
* The various map rendering layers. This controls the internal rendering order.
*/
enum drawing_layer {
enum layer {
/** Layer for the terrain drawn behind units. */
LAYER_TERRAIN_BG,

Expand Down Expand Up @@ -151,7 +151,7 @@ class drawing_buffer
class buffer_key
{
public:
buffer_key(const map_location& loc, drawing_layer layer);
buffer_key(const map_location& loc, layer layer);

bool operator<(const buffer_key& rhs) const
{
Expand All @@ -161,7 +161,7 @@ class drawing_buffer
private:
unsigned int key_;

using layer_group_array = const std::array<drawing_layer, 4>;
using layer_group_array = const std::array<layer, 4>;

// The drawing is done per layer_group, with the range per group being [low, high].
// FIXME: better documentation.
Expand All @@ -172,7 +172,7 @@ class drawing_buffer
class blit_helper
{
public:
blit_helper(const drawing_layer layer,
blit_helper(const layer layer,
const map_location& loc,
const int x,
const int y,
Expand All @@ -186,7 +186,7 @@ class drawing_buffer
{
}

blit_helper(const drawing_layer layer,
blit_helper(const layer layer,
const map_location& loc,
const int x,
const int y,
Expand Down
4 changes: 2 additions & 2 deletions src/editor/editor_display.cpp
Expand Up @@ -115,13 +115,13 @@ void editor_display::draw_hex(const map_location& loc)
display::draw_hex(loc);
if (map().on_board_with_border(loc)) {
if (map().in_selection(loc)) {
//drawing_buffer_add(drawing_buffer::LAYER_FOG_SHROUD, loc, xpos, ypos,
//drawing_queue_add(drawing_queue::LAYER_FOG_SHROUD, loc, xpos, ypos,
// image::get_texture("editor/selection-overlay.png"));
}

if (brush_locations_.find(loc) != brush_locations_.end()) {
static const image::locator brush(game_config::images::editor_brush);
//drawing_buffer_add(drawing_buffer::LAYER_SELECTED_HEX, loc, xpos, ypos,
//drawing_queue_add(drawing_queue::LAYER_SELECTED_HEX, loc, xpos, ypos,
// image::get_texture(brush));
}
}
Expand Down

0 comments on commit 4b1eb21

Please sign in to comment.