mirror of https://github.com/OpenRCT2/OpenRCT2.git
Use dpi ref in everything outside the drawing folder
This commit is contained in:
parent
fc0e0d029a
commit
0139c8d19e
|
@ -549,21 +549,21 @@ void CustomListView::MouseUp(const ScreenCoordsXY& pos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomListView::Paint(WindowBase* w, DrawPixelInfo* dpi, const ScrollBar* scroll) const
|
void CustomListView::Paint(WindowBase* w, DrawPixelInfo& dpi, const ScrollBar* scroll) const
|
||||||
{
|
{
|
||||||
auto paletteIndex = ColourMapA[w->colours[1]].mid_light;
|
auto paletteIndex = ColourMapA[w->colours[1]].mid_light;
|
||||||
GfxFillRect(dpi, { { dpi->x, dpi->y }, { dpi->x + dpi->width, dpi->y + dpi->height } }, paletteIndex);
|
GfxFillRect(&dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width, dpi.y + dpi.height } }, paletteIndex);
|
||||||
|
|
||||||
int32_t y = ShowColumnHeaders ? COLUMN_HEADER_HEIGHT : 0;
|
int32_t y = ShowColumnHeaders ? COLUMN_HEADER_HEIGHT : 0;
|
||||||
for (size_t i = 0; i < Items.size(); i++)
|
for (size_t i = 0; i < Items.size(); i++)
|
||||||
{
|
{
|
||||||
if (y > dpi->y + dpi->height)
|
if (y > dpi.y + dpi.height)
|
||||||
{
|
{
|
||||||
// Past the scroll view area
|
// Past the scroll view area
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y + LIST_ROW_HEIGHT >= dpi->y)
|
if (y + LIST_ROW_HEIGHT >= dpi.y)
|
||||||
{
|
{
|
||||||
const auto& itemIndex = static_cast<int32_t>(SortedItems[i]);
|
const auto& itemIndex = static_cast<int32_t>(SortedItems[i]);
|
||||||
const auto& item = Items[itemIndex];
|
const auto& item = Items[itemIndex];
|
||||||
|
@ -583,19 +583,19 @@ void CustomListView::Paint(WindowBase* w, DrawPixelInfo* dpi, const ScrollBar* s
|
||||||
if (isSelected)
|
if (isSelected)
|
||||||
{
|
{
|
||||||
GfxFilterRect(
|
GfxFilterRect(
|
||||||
dpi, { { dpi->x, y }, { dpi->x + dpi->width, y + (LIST_ROW_HEIGHT - 1) } },
|
&dpi, { { dpi.x, y }, { dpi.x + dpi.width, y + (LIST_ROW_HEIGHT - 1) } },
|
||||||
FilterPaletteID::PaletteDarken2);
|
FilterPaletteID::PaletteDarken2);
|
||||||
}
|
}
|
||||||
else if (isHighlighted)
|
else if (isHighlighted)
|
||||||
{
|
{
|
||||||
GfxFilterRect(
|
GfxFilterRect(
|
||||||
dpi, { { dpi->x, y }, { dpi->x + dpi->width, y + (LIST_ROW_HEIGHT - 1) } },
|
&dpi, { { dpi.x, y }, { dpi.x + dpi.width, y + (LIST_ROW_HEIGHT - 1) } },
|
||||||
FilterPaletteID::PaletteDarken2);
|
FilterPaletteID::PaletteDarken2);
|
||||||
}
|
}
|
||||||
else if (isStriped)
|
else if (isStriped)
|
||||||
{
|
{
|
||||||
GfxFillRect(
|
GfxFillRect(
|
||||||
dpi, { { dpi->x, y }, { dpi->x + dpi->width, y + (LIST_ROW_HEIGHT - 1) } },
|
&dpi, { { dpi.x, y }, { dpi.x + dpi.width, y + (LIST_ROW_HEIGHT - 1) } },
|
||||||
ColourMapA[w->colours[1]].lighter | 0x1000000);
|
ColourMapA[w->colours[1]].lighter | 0x1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,7 +641,7 @@ void CustomListView::Paint(WindowBase* w, DrawPixelInfo* dpi, const ScrollBar* s
|
||||||
y = scroll->v_top;
|
y = scroll->v_top;
|
||||||
|
|
||||||
auto bgColour = ColourMapA[w->colours[1]].mid_light;
|
auto bgColour = ColourMapA[w->colours[1]].mid_light;
|
||||||
GfxFillRect(dpi, { { dpi->x, y }, { dpi->x + dpi->width, y + 12 } }, bgColour);
|
GfxFillRect(&dpi, { { dpi.x, y }, { dpi.x + dpi.width, y + 12 } }, bgColour);
|
||||||
|
|
||||||
int32_t x = 0;
|
int32_t x = 0;
|
||||||
for (int32_t j = 0; j < static_cast<int32_t>(Columns.size()); j++)
|
for (int32_t j = 0; j < static_cast<int32_t>(Columns.size()); j++)
|
||||||
|
@ -665,7 +665,7 @@ void CustomListView::Paint(WindowBase* w, DrawPixelInfo* dpi, const ScrollBar* s
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomListView::PaintHeading(
|
void CustomListView::PaintHeading(
|
||||||
WindowBase* w, DrawPixelInfo* dpi, const ScreenCoordsXY& pos, const ScreenSize& size, const std::string& text,
|
WindowBase* w, DrawPixelInfo& dpi, const ScreenCoordsXY& pos, const ScreenSize& size, const std::string& text,
|
||||||
ColumnSortOrder sortOrder, bool isPressed) const
|
ColumnSortOrder sortOrder, bool isPressed) const
|
||||||
{
|
{
|
||||||
auto boxFlags = 0;
|
auto boxFlags = 0;
|
||||||
|
@ -673,7 +673,7 @@ void CustomListView::PaintHeading(
|
||||||
{
|
{
|
||||||
boxFlags = INSET_RECT_FLAG_BORDER_INSET;
|
boxFlags = INSET_RECT_FLAG_BORDER_INSET;
|
||||||
}
|
}
|
||||||
GfxFillRectInset(dpi, { pos, pos + ScreenCoordsXY{ size.width - 1, size.height - 1 } }, w->colours[1], boxFlags);
|
GfxFillRectInset(&dpi, { pos, pos + ScreenCoordsXY{ size.width - 1, size.height - 1 } }, w->colours[1], boxFlags);
|
||||||
if (!text.empty())
|
if (!text.empty())
|
||||||
{
|
{
|
||||||
PaintCell(dpi, pos, size, text.c_str(), false);
|
PaintCell(dpi, pos, size, text.c_str(), false);
|
||||||
|
@ -683,18 +683,18 @@ void CustomListView::PaintHeading(
|
||||||
{
|
{
|
||||||
auto ft = Formatter();
|
auto ft = Formatter();
|
||||||
ft.Add<StringId>(STR_UP);
|
ft.Add<StringId>(STR_UP);
|
||||||
DrawTextBasic(*dpi, pos + ScreenCoordsXY{ size.width - 1, 0 }, STR_BLACK_STRING, ft, { TextAlignment::RIGHT });
|
DrawTextBasic(dpi, pos + ScreenCoordsXY{ size.width - 1, 0 }, STR_BLACK_STRING, ft, { TextAlignment::RIGHT });
|
||||||
}
|
}
|
||||||
else if (sortOrder == ColumnSortOrder::Descending)
|
else if (sortOrder == ColumnSortOrder::Descending)
|
||||||
{
|
{
|
||||||
auto ft = Formatter();
|
auto ft = Formatter();
|
||||||
ft.Add<StringId>(STR_DOWN);
|
ft.Add<StringId>(STR_DOWN);
|
||||||
DrawTextBasic(*dpi, pos + ScreenCoordsXY{ size.width - 1, 0 }, STR_BLACK_STRING, ft, { TextAlignment::RIGHT });
|
DrawTextBasic(dpi, pos + ScreenCoordsXY{ size.width - 1, 0 }, STR_BLACK_STRING, ft, { TextAlignment::RIGHT });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomListView::PaintSeperator(
|
void CustomListView::PaintSeperator(
|
||||||
DrawPixelInfo* dpi, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text) const
|
DrawPixelInfo& dpi, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text) const
|
||||||
{
|
{
|
||||||
auto hasText = text != nullptr && text[0] != '\0';
|
auto hasText = text != nullptr && text[0] != '\0';
|
||||||
auto left = pos.x + 4;
|
auto left = pos.x + 4;
|
||||||
|
@ -712,7 +712,7 @@ void CustomListView::PaintSeperator(
|
||||||
// Draw string
|
// Draw string
|
||||||
Formatter ft;
|
Formatter ft;
|
||||||
ft.Add<const char*>(text);
|
ft.Add<const char*>(text);
|
||||||
DrawTextBasic(*dpi, { centreX, pos.y }, STR_STRING, ft, { baseColour, TextAlignment::CENTRE });
|
DrawTextBasic(dpi, { centreX, pos.y }, STR_STRING, ft, { baseColour, TextAlignment::CENTRE });
|
||||||
|
|
||||||
// Get string dimensions
|
// Get string dimensions
|
||||||
FormatStringLegacy(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_STRING, ft.Data());
|
FormatStringLegacy(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_STRING, ft.Data());
|
||||||
|
@ -723,44 +723,44 @@ void CustomListView::PaintSeperator(
|
||||||
// Draw light horizontal rule
|
// Draw light horizontal rule
|
||||||
auto lightLineLeftTop1 = ScreenCoordsXY{ left, lineY0 };
|
auto lightLineLeftTop1 = ScreenCoordsXY{ left, lineY0 };
|
||||||
auto lightLineRightBottom1 = ScreenCoordsXY{ strLeft, lineY0 };
|
auto lightLineRightBottom1 = ScreenCoordsXY{ strLeft, lineY0 };
|
||||||
GfxDrawLine(dpi, { lightLineLeftTop1, lightLineRightBottom1 }, lightColour);
|
GfxDrawLine(&dpi, { lightLineLeftTop1, lightLineRightBottom1 }, lightColour);
|
||||||
|
|
||||||
auto lightLineLeftTop2 = ScreenCoordsXY{ strRight, lineY0 };
|
auto lightLineLeftTop2 = ScreenCoordsXY{ strRight, lineY0 };
|
||||||
auto lightLineRightBottom2 = ScreenCoordsXY{ right, lineY0 };
|
auto lightLineRightBottom2 = ScreenCoordsXY{ right, lineY0 };
|
||||||
GfxDrawLine(dpi, { lightLineLeftTop2, lightLineRightBottom2 }, lightColour);
|
GfxDrawLine(&dpi, { lightLineLeftTop2, lightLineRightBottom2 }, lightColour);
|
||||||
|
|
||||||
// Draw dark horizontal rule
|
// Draw dark horizontal rule
|
||||||
auto darkLineLeftTop1 = ScreenCoordsXY{ left, lineY1 };
|
auto darkLineLeftTop1 = ScreenCoordsXY{ left, lineY1 };
|
||||||
auto darkLineRightBottom1 = ScreenCoordsXY{ strLeft, lineY1 };
|
auto darkLineRightBottom1 = ScreenCoordsXY{ strLeft, lineY1 };
|
||||||
GfxDrawLine(dpi, { darkLineLeftTop1, darkLineRightBottom1 }, darkColour);
|
GfxDrawLine(&dpi, { darkLineLeftTop1, darkLineRightBottom1 }, darkColour);
|
||||||
|
|
||||||
auto darkLineLeftTop2 = ScreenCoordsXY{ strRight, lineY1 };
|
auto darkLineLeftTop2 = ScreenCoordsXY{ strRight, lineY1 };
|
||||||
auto darkLineRightBottom2 = ScreenCoordsXY{ right, lineY1 };
|
auto darkLineRightBottom2 = ScreenCoordsXY{ right, lineY1 };
|
||||||
GfxDrawLine(dpi, { darkLineLeftTop2, darkLineRightBottom2 }, darkColour);
|
GfxDrawLine(&dpi, { darkLineLeftTop2, darkLineRightBottom2 }, darkColour);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Draw light horizontal rule
|
// Draw light horizontal rule
|
||||||
auto lightLineLeftTop1 = ScreenCoordsXY{ left, lineY0 };
|
auto lightLineLeftTop1 = ScreenCoordsXY{ left, lineY0 };
|
||||||
auto lightLineRightBottom1 = ScreenCoordsXY{ right, lineY0 };
|
auto lightLineRightBottom1 = ScreenCoordsXY{ right, lineY0 };
|
||||||
GfxDrawLine(dpi, { lightLineLeftTop1, lightLineRightBottom1 }, lightColour);
|
GfxDrawLine(&dpi, { lightLineLeftTop1, lightLineRightBottom1 }, lightColour);
|
||||||
|
|
||||||
// Draw dark horizontal rule
|
// Draw dark horizontal rule
|
||||||
auto darkLineLeftTop1 = ScreenCoordsXY{ left, lineY1 };
|
auto darkLineLeftTop1 = ScreenCoordsXY{ left, lineY1 };
|
||||||
auto darkLineRightBottom1 = ScreenCoordsXY{ right, lineY1 };
|
auto darkLineRightBottom1 = ScreenCoordsXY{ right, lineY1 };
|
||||||
GfxDrawLine(dpi, { darkLineLeftTop1, darkLineRightBottom1 }, darkColour);
|
GfxDrawLine(&dpi, { darkLineLeftTop1, darkLineRightBottom1 }, darkColour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomListView::PaintCell(
|
void CustomListView::PaintCell(
|
||||||
DrawPixelInfo* dpi, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text, bool isHighlighted) const
|
DrawPixelInfo& dpi, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text, bool isHighlighted) const
|
||||||
{
|
{
|
||||||
StringId stringId = isHighlighted ? STR_WINDOW_COLOUR_2_STRINGID : STR_BLACK_STRING;
|
StringId stringId = isHighlighted ? STR_WINDOW_COLOUR_2_STRINGID : STR_BLACK_STRING;
|
||||||
|
|
||||||
auto ft = Formatter();
|
auto ft = Formatter();
|
||||||
ft.Add<StringId>(STR_STRING);
|
ft.Add<StringId>(STR_STRING);
|
||||||
ft.Add<const char*>(text);
|
ft.Add<const char*>(text);
|
||||||
DrawTextEllipsised(*dpi, pos, size.width, stringId, ft, {});
|
DrawTextEllipsised(dpi, pos, size.width, stringId, ft, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<RowColumn> CustomListView::GetItemIndexAt(const ScreenCoordsXY& pos)
|
std::optional<RowColumn> CustomListView::GetItemIndexAt(const ScreenCoordsXY& pos)
|
||||||
|
|
|
@ -136,15 +136,15 @@ namespace OpenRCT2::Ui::Windows
|
||||||
void MouseOver(const ScreenCoordsXY& pos, bool isMouseDown);
|
void MouseOver(const ScreenCoordsXY& pos, bool isMouseDown);
|
||||||
void MouseDown(const ScreenCoordsXY& pos);
|
void MouseDown(const ScreenCoordsXY& pos);
|
||||||
void MouseUp(const ScreenCoordsXY& pos);
|
void MouseUp(const ScreenCoordsXY& pos);
|
||||||
void Paint(WindowBase* w, DrawPixelInfo* dpi, const ScrollBar* scroll) const;
|
void Paint(WindowBase* w, DrawPixelInfo& dpi, const ScrollBar* scroll) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void PaintHeading(
|
void PaintHeading(
|
||||||
WindowBase* w, DrawPixelInfo* dpi, const ScreenCoordsXY& pos, const ScreenSize& size, const std::string& text,
|
WindowBase* w, DrawPixelInfo& dpi, const ScreenCoordsXY& pos, const ScreenSize& size, const std::string& text,
|
||||||
ColumnSortOrder sortOrder, bool isPressed) const;
|
ColumnSortOrder sortOrder, bool isPressed) const;
|
||||||
void PaintSeperator(DrawPixelInfo* dpi, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text) const;
|
void PaintSeperator(DrawPixelInfo& dpi, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text) const;
|
||||||
void PaintCell(
|
void PaintCell(
|
||||||
DrawPixelInfo* dpi, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text, bool isHighlighted) const;
|
DrawPixelInfo& dpi, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text, bool isHighlighted) const;
|
||||||
std::optional<RowColumn> GetItemIndexAt(const ScreenCoordsXY& pos);
|
std::optional<RowColumn> GetItemIndexAt(const ScreenCoordsXY& pos);
|
||||||
Widget* GetWidget() const;
|
Widget* GetWidget() const;
|
||||||
void Invalidate();
|
void Invalidate();
|
||||||
|
|
|
@ -751,7 +751,7 @@ namespace OpenRCT2::Ui::Windows
|
||||||
const auto& info = GetInfo(this);
|
const auto& info = GetInfo(this);
|
||||||
if (scrollIndex < static_cast<int32_t>(info.ListViews.size()))
|
if (scrollIndex < static_cast<int32_t>(info.ListViews.size()))
|
||||||
{
|
{
|
||||||
info.ListViews[scrollIndex].Paint(this, &dpi, &scrolls[scrollIndex]);
|
info.ListViews[scrollIndex].Paint(this, dpi, &scrolls[scrollIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,11 +115,11 @@ void DrawingEngineDispose()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPixelInfo* DrawingEngineGetDpi()
|
DrawPixelInfo& DrawingEngineGetDpi()
|
||||||
{
|
{
|
||||||
auto context = GetContext();
|
auto context = GetContext();
|
||||||
auto drawingEngine = context->GetDrawingEngine();
|
auto drawingEngine = context->GetDrawingEngine();
|
||||||
return drawingEngine->GetDrawingPixelInfo();
|
return *(drawingEngine->GetDrawingPixelInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DrawingEngineHasDirtyOptimisations()
|
bool DrawingEngineHasDirtyOptimisations()
|
||||||
|
|
|
@ -25,7 +25,7 @@ void DrawingEngineSetPalette(const GamePalette& colours);
|
||||||
void DrawingEngineCopyRect(int32_t x, int32_t y, int32_t width, int32_t height, int32_t dx, int32_t dy);
|
void DrawingEngineCopyRect(int32_t x, int32_t y, int32_t width, int32_t height, int32_t dx, int32_t dy);
|
||||||
void DrawingEngineDispose();
|
void DrawingEngineDispose();
|
||||||
|
|
||||||
DrawPixelInfo* DrawingEngineGetDpi();
|
DrawPixelInfo& DrawingEngineGetDpi();
|
||||||
bool DrawingEngineHasDirtyOptimisations();
|
bool DrawingEngineHasDirtyOptimisations();
|
||||||
void DrawingEngineInvalidateImage(uint32_t image);
|
void DrawingEngineInvalidateImage(uint32_t image);
|
||||||
void DrawingEngineSetVSync(bool vsync);
|
void DrawingEngineSetVSync(bool vsync);
|
||||||
|
|
|
@ -2801,8 +2801,7 @@ void Peep::Paint(PaintSession& session, int32_t imageDirection) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPixelInfo* dpi = &session.DPI;
|
if (session.DPI.zoom_level > ZoomLevel{ 2 })
|
||||||
if (dpi->zoom_level > ZoomLevel{ 2 })
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -479,8 +479,8 @@ static void ViewportMove(const ScreenCoordsXY& coords, WindowBase* w, Viewport*
|
||||||
|
|
||||||
if (DrawingEngineHasDirtyOptimisations())
|
if (DrawingEngineHasDirtyOptimisations())
|
||||||
{
|
{
|
||||||
DrawPixelInfo* dpi = DrawingEngineGetDpi();
|
DrawPixelInfo& dpi = DrawingEngineGetDpi();
|
||||||
WindowDrawAll(*dpi, left, top, right, bottom);
|
WindowDrawAll(dpi, left, top, right, bottom);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,8 +531,8 @@ static void ViewportMove(const ScreenCoordsXY& coords, WindowBase* w, Viewport*
|
||||||
|
|
||||||
if (DrawingEngineHasDirtyOptimisations())
|
if (DrawingEngineHasDirtyOptimisations())
|
||||||
{
|
{
|
||||||
DrawPixelInfo* dpi = DrawingEngineGetDpi();
|
DrawPixelInfo& dpi = DrawingEngineGetDpi();
|
||||||
ViewportShiftPixels(*dpi, w, viewport, x_diff, y_diff);
|
ViewportShiftPixels(dpi, w, viewport, x_diff, y_diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
*viewport = view_copy;
|
*viewport = view_copy;
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace WindowCloseFlags
|
||||||
} // namespace WindowCloseFlags
|
} // namespace WindowCloseFlags
|
||||||
|
|
||||||
static void WindowDrawCore(DrawPixelInfo& dpi, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom);
|
static void WindowDrawCore(DrawPixelInfo& dpi, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom);
|
||||||
static void WindowDrawSingle(DrawPixelInfo* dpi, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom);
|
static void WindowDrawSingle(DrawPixelInfo& dpi, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom);
|
||||||
|
|
||||||
std::list<std::shared_ptr<WindowBase>>::iterator WindowGetIterator(const WindowBase* w)
|
std::list<std::shared_ptr<WindowBase>>::iterator WindowGetIterator(const WindowBase* w)
|
||||||
{
|
{
|
||||||
|
@ -1203,56 +1203,55 @@ static void WindowDrawCore(DrawPixelInfo& dpi, WindowBase& w, int32_t left, int3
|
||||||
auto* v = (*it).get();
|
auto* v = (*it).get();
|
||||||
if ((&w == v || (v->flags & WF_TRANSPARENT)) && WindowIsVisible(*v))
|
if ((&w == v || (v->flags & WF_TRANSPARENT)) && WindowIsVisible(*v))
|
||||||
{
|
{
|
||||||
WindowDrawSingle(&dpi, *v, left, top, right, bottom);
|
WindowDrawSingle(dpi, *v, left, top, right, bottom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WindowDrawSingle(DrawPixelInfo* dpi, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
static void WindowDrawSingle(DrawPixelInfo& dpi, WindowBase& w, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
||||||
{
|
{
|
||||||
// Copy dpi so we can crop it
|
// Copy dpi so we can crop it
|
||||||
DrawPixelInfo copy = *dpi;
|
DrawPixelInfo copy = dpi;
|
||||||
dpi = ©
|
|
||||||
|
|
||||||
// Clamp left to 0
|
// Clamp left to 0
|
||||||
int32_t overflow = left - dpi->x;
|
int32_t overflow = left - copy.x;
|
||||||
if (overflow > 0)
|
if (overflow > 0)
|
||||||
{
|
{
|
||||||
dpi->x += overflow;
|
copy.x += overflow;
|
||||||
dpi->width -= overflow;
|
copy.width -= overflow;
|
||||||
if (dpi->width <= 0)
|
if (copy.width <= 0)
|
||||||
return;
|
return;
|
||||||
dpi->pitch += overflow;
|
copy.pitch += overflow;
|
||||||
dpi->bits += overflow;
|
copy.bits += overflow;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clamp width to right
|
// Clamp width to right
|
||||||
overflow = dpi->x + dpi->width - right;
|
overflow = copy.x + copy.width - right;
|
||||||
if (overflow > 0)
|
if (overflow > 0)
|
||||||
{
|
{
|
||||||
dpi->width -= overflow;
|
copy.width -= overflow;
|
||||||
if (dpi->width <= 0)
|
if (copy.width <= 0)
|
||||||
return;
|
return;
|
||||||
dpi->pitch += overflow;
|
copy.pitch += overflow;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clamp top to 0
|
// Clamp top to 0
|
||||||
overflow = top - dpi->y;
|
overflow = top - copy.y;
|
||||||
if (overflow > 0)
|
if (overflow > 0)
|
||||||
{
|
{
|
||||||
dpi->y += overflow;
|
copy.y += overflow;
|
||||||
dpi->height -= overflow;
|
copy.height -= overflow;
|
||||||
if (dpi->height <= 0)
|
if (copy.height <= 0)
|
||||||
return;
|
return;
|
||||||
dpi->bits += (dpi->width + dpi->pitch) * overflow;
|
copy.bits += (copy.width + copy.pitch) * overflow;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clamp height to bottom
|
// Clamp height to bottom
|
||||||
overflow = dpi->y + dpi->height - bottom;
|
overflow = copy.y + copy.height - bottom;
|
||||||
if (overflow > 0)
|
if (overflow > 0)
|
||||||
{
|
{
|
||||||
dpi->height -= overflow;
|
copy.height -= overflow;
|
||||||
if (dpi->height <= 0)
|
if (copy.height <= 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1266,7 +1265,7 @@ static void WindowDrawSingle(DrawPixelInfo* dpi, WindowBase& w, int32_t left, in
|
||||||
gCurrentWindowColours[2] = NOT_TRANSLUCENT(w.colours[2]);
|
gCurrentWindowColours[2] = NOT_TRANSLUCENT(w.colours[2]);
|
||||||
gCurrentWindowColours[3] = NOT_TRANSLUCENT(w.colours[3]);
|
gCurrentWindowColours[3] = NOT_TRANSLUCENT(w.colours[3]);
|
||||||
|
|
||||||
WindowEventPaintCall(&w, *dpi);
|
WindowEventPaintCall(&w, copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1190,8 +1190,7 @@ void VehicleVisualMiniGolfPlayer(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPixelInfo* edi = &session.DPI;
|
if (session.DPI.zoom_level >= ZoomLevel{ 2 })
|
||||||
if (edi->zoom_level >= ZoomLevel{ 2 })
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1227,8 +1226,7 @@ void VehicleVisualMiniGolfBall(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPixelInfo* edi = &session.DPI;
|
if (session.DPI.zoom_level >= ZoomLevel{ 1 })
|
||||||
if (edi->zoom_level >= ZoomLevel{ 1 })
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,8 +134,7 @@ static void SpiralSlidePaintTileFront(
|
||||||
PaintAddImageAsParent(session, imageId, { 16, 16, height }, { { 8, 0, height + 3 }, { 8, 16, 108 } });
|
PaintAddImageAsParent(session, imageId, { 16, 16, height }, { { 8, 0, height + 3 }, { 8, 16, 108 } });
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPixelInfo* dpi = &session.DPI;
|
if (session.DPI.zoom_level <= ZoomLevel{ 0 } && ride.slide_in_use != 0)
|
||||||
if (dpi->zoom_level <= ZoomLevel{ 0 } && ride.slide_in_use != 0)
|
|
||||||
{
|
{
|
||||||
uint8_t slide_progress = ride.spiral_slide_progress;
|
uint8_t slide_progress = ride.spiral_slide_progress;
|
||||||
if (slide_progress != 0)
|
if (slide_progress != 0)
|
||||||
|
|
Loading…
Reference in New Issue