Skip to content

Commit

Permalink
Merge pull request #4704 from shikadiqueen/bug/4510
Browse files Browse the repository at this point in the history
Do not use SDL render API for certain drawing operations
  • Loading branch information
Vultraz committed Jan 14, 2020
2 parents f04ad5a + 3bf1530 commit c239ae3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
27 changes: 25 additions & 2 deletions src/display.cpp
Expand Up @@ -1841,7 +1841,25 @@ void display::draw_minimap()
view_h + 2
};

sdl::draw_rectangle(outline_rect, {255, 255, 255, 255});
// SDL 2.0.10's render batching changes result in the
// surface's clipping rectangle being overridden even if
// no render clipping rectangle set operaton was queued,
// so let's not use the render API to draw the rectangle.

const SDL_Rect outline_parts[] = {
// top
{ outline_rect.x, outline_rect.y, outline_rect.w, 1 },
// bottom
{ outline_rect.x, outline_rect.y + outline_rect.h, outline_rect.w, 1 },
// left
{ outline_rect.x, outline_rect.y, 1, outline_rect.h },
// right
{ outline_rect.x + outline_rect.w - 1, outline_rect.y, 1, outline_rect.h },
};

for(const auto& r : outline_parts) {
SDL_FillRect(screen_.getSurface(), &r, 0x00FFFFFF);
}
}

void display::draw_minimap_units()
Expand Down Expand Up @@ -1895,7 +1913,12 @@ void display::draw_minimap_units()
, int(std::round(u_h))
};

sdl::fill_rectangle(r, col);
// SDL 2.0.10's render batching changes result in the
// surface's clipping rectangle being overridden even if
// no render clipping rectangle set operaton was queued,
// so let's not use the render API to draw the rectangle.

SDL_FillRect(screen_.getSurface(), &r, col.to_argb_bytes());
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/help/help_text_area.cpp
Expand Up @@ -552,7 +552,11 @@ void help_text_area::draw_contents()
it->rect.h - i * 2
};

sdl::draw_rectangle(draw_rect, {0, 0, 0, 0});
// SDL 2.0.10's render batching changes result in the
// surface's clipping rectangle being overridden even if
// no render clipping rectangle set operaton was queued,
// so let's not use the render API to draw the rectangle.
SDL_FillRect(screen, &draw_rect, 0);
++dst.x;
++dst.y;
}
Expand Down

0 comments on commit c239ae3

Please sign in to comment.