Fix rare cases breaking encapsulation of SDL_Surface by surface
This commit is contained in:
parent
b4d6a7eb2a
commit
bd7deaf318
3 changed files with 11 additions and 12 deletions
|
@ -1313,14 +1313,14 @@ void editor_controller::redraw_toolbar()
|
|||
SDL_Rect r = a.second->toolbar_button()->location(gui().screen_area());
|
||||
SDL_Rect outline = create_rect(r.x - 2, r.y - 2, r.h + 4, r.w + 4);
|
||||
//outline = intersect_rects(r, gui().screen_area());
|
||||
SDL_Surface* const screen = gui().video().getSurface();
|
||||
surface screen = gui().video().getSurface();
|
||||
Uint32 color;
|
||||
if (a.second == mouse_action_) {
|
||||
color = SDL_MapRGB(screen->format, 0xFF, 0x00, 0x00);
|
||||
} else {
|
||||
color = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00);
|
||||
}
|
||||
draw_rectangle(outline.x, outline.y, outline.w, outline.h, color, gui().video().getSurface());
|
||||
draw_rectangle(outline.x, outline.y, outline.w, outline.h, color, screen);
|
||||
update_rect(outline);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -414,7 +414,7 @@ void terrain_palette::draw(bool force) {
|
|||
}
|
||||
unsigned int starting = tstart_;
|
||||
unsigned int ending = starting + nterrains_;
|
||||
SDL_Surface* const screen = gui_.video().getSurface();
|
||||
surface screen = gui_.video().getSurface();
|
||||
if(ending > num_terrains()){
|
||||
ending = num_terrains();
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ void terrain_palette::draw(bool force) {
|
|||
|
||||
sdl_blit(image, NULL, screen, &dstrect);
|
||||
|
||||
SDL_Surface* const screen = gui_.video().getSurface();
|
||||
surface screen = gui_.video().getSurface();
|
||||
Uint32 color;
|
||||
if (terrain == selected_bg_terrain() && terrain == selected_fg_terrain()) {
|
||||
color = SDL_MapRGB(screen->format,0xFF,0x00,0xFF);
|
||||
|
@ -633,7 +633,7 @@ void brush_bar::draw(bool force) {
|
|||
int x = loc.x;
|
||||
// Everything will be redrawn even though only one little part may
|
||||
// have changed, but that happens so seldom so we'll settle with this.
|
||||
SDL_Surface* const screen = gui_.video().getSurface();
|
||||
surface screen = gui_.video().getSurface();
|
||||
for (size_t i = 0; i < brushes_.size(); i++) {
|
||||
std::string filename = brushes_[i].image();
|
||||
surface image(image::get_image(filename));
|
||||
|
|
|
@ -118,16 +118,15 @@ void loadscreen::draw_screen(const std::string &text)
|
|||
}
|
||||
|
||||
// Draw logo if it was succesfully loaded.
|
||||
if (!logo_surface_.null() && !logo_drawn_) {
|
||||
SDL_Surface *logo = logo_surface_.get();
|
||||
area.x = (screen_.getx () - logo->w) / 2;
|
||||
area.y = ((scry - logo->h) / 2) - pbh;
|
||||
area.w = logo->w;
|
||||
area.h = logo->h;
|
||||
if (logo_surface_ && !logo_drawn_) {
|
||||
area.x = (screen_.getx () - logo_surface_->w) / 2;
|
||||
area.y = ((scry - logo_surface_->h) / 2) - pbh;
|
||||
area.w = logo_surface_->w;
|
||||
area.h = logo_surface_->h;
|
||||
// Check if we have enough pixels to display it.
|
||||
if (area.x > 0 && area.y > 0) {
|
||||
pby_offset_ = (pbh + area.h)/2;
|
||||
sdl_blit (logo, 0, gdis, &area);
|
||||
sdl_blit(logo_surface_, 0, gdis, &area);
|
||||
} else {
|
||||
ERR_DP << "loadscreen: Logo image is too big." << std::endl;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue