1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-29 17:54:50 +01:00

Revert DPI accessors

This commit is contained in:
Michael Bernardi
2024-09-27 01:46:46 +10:00
parent 570e1efc8c
commit 09fa68a803
46 changed files with 348 additions and 428 deletions

View File

@@ -55,12 +55,12 @@ uint8_t gScreenshotCountdown = 0;
static bool WriteDpiToFile(std::string_view path, const DrawPixelInfo& dpi, const GamePalette& palette)
{
auto const pixels8 = dpi.bits;
auto const pixelsLen = dpi.LineStride() * dpi.ScreenHeight();
auto const pixelsLen = dpi.LineStride() * dpi.height;
try
{
Image image;
image.Width = dpi.ScreenWidth();
image.Height = dpi.ScreenHeight();
image.Width = dpi.width;
image.Height = dpi.height;
image.Depth = 8;
image.Stride = dpi.LineStride();
image.Palette = std::make_unique<GamePalette>(palette);
@@ -230,9 +230,9 @@ static int32_t GetTallestVisibleTileTop(
static DrawPixelInfo CreateDPI(const Viewport& viewport)
{
DrawPixelInfo dpi;
dpi.SetWidth(viewport.width);
dpi.SetHeight(viewport.height);
dpi.bits = new (std::nothrow) uint8_t[dpi.ScreenWidth() * dpi.ScreenHeight()];
dpi.width = viewport.width;
dpi.height = viewport.height;
dpi.bits = new (std::nothrow) uint8_t[dpi.width * dpi.height];
if (dpi.bits == nullptr)
{
throw std::runtime_error("Giant screenshot failed, unable to allocate memory for image.");
@@ -240,7 +240,7 @@ static DrawPixelInfo CreateDPI(const Viewport& viewport)
if (viewport.flags & VIEWPORT_FLAG_TRANSPARENT_BACKGROUND)
{
std::memset(dpi.bits, PALETTE_INDEX_0, static_cast<size_t>(dpi.ScreenWidth()) * dpi.ScreenHeight());
std::memset(dpi.bits, PALETTE_INDEX_0, static_cast<size_t>(dpi.width) * dpi.height);
}
return dpi;
@@ -251,8 +251,8 @@ static void ReleaseDPI(DrawPixelInfo& dpi)
if (dpi.bits != nullptr)
delete[] dpi.bits;
dpi.bits = nullptr;
dpi.SetWidth(0);
dpi.SetHeight(0);
dpi.width = 0;
dpi.height = 0;
}
static Viewport GetGiantViewport(int32_t rotation, ZoomLevel zoom)