Renamed fill_rect fill_surface_rect to better distinguish it

This commit is contained in:
Charles Dang 2017-05-26 16:13:30 +11:00
parent 4b95691660
commit 078a4f6a64
6 changed files with 10 additions and 10 deletions

View file

@ -2631,7 +2631,7 @@ void display::draw_hex(const map_location& loc) {
surface text = font::get_rendered_text(lexical_cast<std::string>(loc), font::SIZE_SMALL, font::NORMAL_COLOR);
surface bg = create_neutral_surface(text->w, text->h);
SDL_Rect bg_rect {0, 0, text->w, text->h};
sdl::fill_rect(bg, &bg_rect, 0xaa000000);
sdl::fill_surface_rect(bg, &bg_rect, 0xaa000000);
off_x -= text->w / 2;
off_y -= text->h / 2;
if (draw_terrain_codes_) {
@ -2649,7 +2649,7 @@ void display::draw_hex(const map_location& loc) {
surface text = font::get_rendered_text(lexical_cast<std::string>(get_map().get_terrain(loc)), font::SIZE_SMALL, font::NORMAL_COLOR);
surface bg = create_neutral_surface(text->w, text->h);
SDL_Rect bg_rect {0, 0, text->w, text->h};
sdl::fill_rect(bg, &bg_rect, 0xaa000000);
sdl::fill_surface_rect(bg, &bg_rect, 0xaa000000);
off_x -= text->w / 2;
off_y -= text->h / 2;
if (draw_coordinates_ && !draw_num_of_bitmaps_) {
@ -2666,7 +2666,7 @@ void display::draw_hex(const map_location& loc) {
surface text = font::get_rendered_text(lexical_cast<std::string>(num_images_bg + num_images_fg), font::SIZE_SMALL, font::NORMAL_COLOR);
surface bg = create_neutral_surface(text->w, text->h);
SDL_Rect bg_rect {0, 0, text->w, text->h};
sdl::fill_rect(bg, &bg_rect, 0xaa000000);
sdl::fill_surface_rect(bg, &bg_rect, 0xaa000000);
off_x -= text->w / 2;
off_y -= text->h / 2;
if (draw_coordinates_) {

View file

@ -111,7 +111,7 @@ surface floating_label::create_surface()
}
Uint32 color = SDL_MapRGBA(foreground->format, bgcolor_.r,bgcolor_.g, bgcolor_.b, bgalpha_);
sdl::fill_rect(background,nullptr, color);
sdl::fill_surface_rect(background,nullptr, color);
// we make the text less transparent, because the blitting on the
// dark background will darken the anti-aliased part.
@ -129,7 +129,7 @@ surface floating_label::create_surface()
// background is blurred shadow of the text
surface background = create_neutral_surface
(foreground->w + 4, foreground->h + 4);
sdl::fill_rect(background, nullptr, 0);
sdl::fill_surface_rect(background, nullptr, 0);
SDL_Rect r { 2, 2, 0, 0 };
sdl_blit(foreground, nullptr, background, &r);
background = shadow_image(background);

View file

@ -231,7 +231,7 @@ surface getMinimap(int w, int h, const gamemap &map, const team *vw, const std::
}
SDL_Rect fillrect {maprect.x, maprect.y, scale * 3/4, scale};
const Uint32 mapped_col = SDL_MapRGB(minimap->format,col.r,col.g,col.b);
sdl::fill_rect(minimap, &fillrect, mapped_col);
sdl::fill_surface_rect(minimap, &fillrect, mapped_col);
}
}
@ -271,7 +271,7 @@ surface getMinimap(int w, int h, const gamemap &map, const team *vw, const std::
};
const Uint32 mapped_col = SDL_MapRGB(minimap->format,col.r,col.g,col.b);
sdl::fill_rect(minimap, &fillrect, mapped_col);
sdl::fill_surface_rect(minimap, &fillrect, mapped_col);
}

View file

@ -111,7 +111,7 @@ void fill_rectangle(const SDL_Rect& rect, const color_t& color);
* @param dst_rect The rectangle to fill.
* @param color Color of the rectangle.
*/
inline void fill_rect(surface& dst, SDL_Rect* dst_rect, const Uint32 color)
inline void fill_surface_rect(surface& dst, SDL_Rect* dst_rect, const Uint32 color)
{
SDL_FillRect(dst, dst_rect, color);
}

View file

@ -2204,7 +2204,7 @@ void draw_centered_on_background(surface surf, const SDL_Rect& rect, const color
Uint32 col = SDL_MapRGBA(target->format, color.r, color.g, color.b, color.a);
//TODO: only draw background outside the image
SDL_Rect r = rect;
sdl::fill_rect(target, &r, col);
sdl::fill_surface_rect(target, &r, col);
if (surf != nullptr) {
r.x = rect.x + (rect.w-surf->w)/2;

View file

@ -399,7 +399,7 @@ void unit_drawer::draw_bar(const std::string& image, int xpos, int ypos,
const Uint8 r_alpha = std::min<unsigned>(unsigned(fxpmult(alpha,255)),255);
surface filled_surf = create_compatible_surface(bar_surf, bar_loc.w, height - unfilled);
SDL_Rect filled_area = sdl::create_rect(0, 0, bar_loc.w, height-unfilled);
sdl::fill_rect(filled_surf,&filled_area,SDL_MapRGBA(bar_surf->format,col.r,col.g,col.b, r_alpha));
sdl::fill_surface_rect(filled_surf,&filled_area,SDL_MapRGBA(bar_surf->format,col.r,col.g,col.b, r_alpha));
disp.drawing_buffer_add(display::LAYER_UNIT_BAR, loc, xpos + bar_loc.x, ypos + bar_loc.y + unfilled, filled_surf);
}
}