1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Apply review suggestions

This commit is contained in:
Hielke Morsink
2021-10-01 23:57:33 +02:00
parent dbd50d08c6
commit 0f2dffcc16
3 changed files with 8 additions and 8 deletions

View File

@@ -458,8 +458,8 @@ void FASTCALL gfx_draw_sprite_palette_set_software(
}
// Its used super often so we will define it to a separate variable.
auto zoom_level = dpi->zoom_level;
int32_t zoom_mask = zoom_level > ZoomLevel{ 0 } ? 0xFFFFFFFF * zoom_level : 0xFFFFFFFF;
const auto zoom_level = dpi->zoom_level;
const int32_t zoom_mask = zoom_level > ZoomLevel{ 0 } ? 0xFFFFFFFF * zoom_level : 0xFFFFFFFF;
if (zoom_level > ZoomLevel{ 0 } && g1->flags & G1_FLAG_RLE_COMPRESSION)
{

View File

@@ -387,10 +387,10 @@ void screenshot_giant()
throw std::runtime_error("Giant screenshot failed, unable to find a suitable destination path.");
}
auto rotation = get_current_rotation();
const auto rotation = get_current_rotation();
auto zoom = ZoomLevel{ 0 };
auto mainWindow = window_get_main();
auto vp = window_get_viewport(mainWindow);
auto* mainWindow = window_get_main();
const auto* vp = window_get_viewport(mainWindow);
if (mainWindow != nullptr && vp != nullptr)
{
zoom = vp->zoom;

View File

@@ -947,10 +947,10 @@ void viewport_paint(
const rct_viewport* viewport, rct_drawpixelinfo* dpi, const ScreenRect& screenRect,
std::vector<RecordedPaintSession>* recorded_sessions)
{
uint32_t viewFlags = viewport->flags;
const uint32_t viewFlags = viewport->flags;
uint32_t width = screenRect.GetWidth();
uint32_t height = screenRect.GetHeight();
uint32_t bitmask = viewport->zoom >= ZoomLevel{ 0 } ? 0xFFFFFFFF & (0xFFFFFFFF * viewport->zoom) : 0xFFFFFFFF;
const uint32_t bitmask = viewport->zoom >= ZoomLevel{ 0 } ? 0xFFFFFFFF & (0xFFFFFFFF * viewport->zoom) : 0xFFFFFFFF;
ScreenCoordsXY topLeft = screenRect.Point1;
width &= bitmask;
@@ -978,7 +978,7 @@ void viewport_paint(
dpi1.remX = std::max(0, dpi->x - x);
dpi1.remY = std::max(0, dpi->y - y);
// make sure, the compare operation is done in int32_t to avoid the loop becoming an infiniteloop.
// make sure, the compare operation is done in int32_t to avoid the loop becoming an infinite loop.
// this as well as the [x += 32] in the loop causes signed integer overflow -> undefined behaviour.
auto rightBorder = dpi1.x + dpi1.width;
auto alignedX = floor2(dpi1.x, 32);