forked from rosebudai/OpenRCT2-Web
Pass DrawPixelInfo by reference (#21563)
This commit is contained in:
1 parent
9ebe65b55a
commit
78d95fc0bd
24 files changed
+194
-194
No files matched your search
@@ -99,18 +99,18 @@ public:
|
||||
void ResetPalette();
|
||||
void StartNewDraw();
|
||||
|
||||
void Clear(DrawPixelInfo* dpi, uint8_t paletteIndex) override;
|
||||
void FillRect(DrawPixelInfo* dpi, uint32_t colour, int32_t x, int32_t y, int32_t w, int32_t h) override;
|
||||
void Clear(DrawPixelInfo& dpi, uint8_t paletteIndex) override;
|
||||
void FillRect(DrawPixelInfo& dpi, uint32_t colour, int32_t x, int32_t y, int32_t w, int32_t h) override;
|
||||
void FilterRect(
|
||||
DrawPixelInfo* dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom) override;
|
||||
void DrawLine(DrawPixelInfo* dpi, uint32_t colour, const ScreenLine& line) override;
|
||||
void DrawSprite(DrawPixelInfo* dpi, const ImageId imageId, int32_t x, int32_t y) override;
|
||||
DrawPixelInfo& dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom) override;
|
||||
void DrawLine(DrawPixelInfo& dpi, uint32_t colour, const ScreenLine& line) override;
|
||||
void DrawSprite(DrawPixelInfo& dpi, const ImageId imageId, int32_t x, int32_t y) override;
|
||||
void DrawSpriteRawMasked(
|
||||
DrawPixelInfo* dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage) override;
|
||||
void DrawSpriteSolid(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour) override;
|
||||
void DrawGlyph(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& palette) override;
|
||||
DrawPixelInfo& dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage) override;
|
||||
void DrawSpriteSolid(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour) override;
|
||||
void DrawGlyph(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& palette) override;
|
||||
void DrawTTFBitmap(
|
||||
DrawPixelInfo* dpi, TextDrawInfo* info, ImageIndex image, const void* pixels, int32_t width, int32_t height, int32_t x,
|
||||
DrawPixelInfo& dpi, TextDrawInfo* info, ImageIndex image, const void* pixels, int32_t width, int32_t height, int32_t x,
|
||||
int32_t y, uint8_t hinting_threshold) override;
|
||||
|
||||
void FlushCommandBuffers();
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
void FlushLines();
|
||||
void FlushRectangles();
|
||||
void HandleTransparency();
|
||||
void CalculcateClipping(DrawPixelInfo* dpi);
|
||||
void CalculcateClipping(DrawPixelInfo& dpi);
|
||||
};
|
||||
|
||||
class OpenGLWeatherDrawer final : public IWeatherDrawer
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
int32_t pixelX = xPixelOffset % dpi.width;
|
||||
int32_t pixelY = (xPixelOffset / dpi.width) % dpi.height;
|
||||
|
||||
_drawingContext->DrawLine(&dpi, patternPixel, { { pixelX, pixelY }, { pixelX + 1, pixelY + 1 } });
|
||||
_drawingContext->DrawLine(dpi, patternPixel, { { pixelX, pixelY }, { pixelX + 1, pixelY + 1 } });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ public:
|
||||
assert(_screenFramebuffer != nullptr);
|
||||
|
||||
_drawingContext->StartNewDraw();
|
||||
_drawingContext->CalculcateClipping(&_bitsDPI);
|
||||
_drawingContext->CalculcateClipping(_bitsDPI);
|
||||
}
|
||||
|
||||
void EndDraw() override
|
||||
@@ -323,7 +323,7 @@ public:
|
||||
|
||||
void PaintWindows() override
|
||||
{
|
||||
_drawingContext->CalculcateClipping(&_bitsDPI);
|
||||
_drawingContext->CalculcateClipping(_bitsDPI);
|
||||
|
||||
WindowUpdateAllViewports();
|
||||
WindowDrawAll(_bitsDPI, 0, 0, _width, _height);
|
||||
@@ -331,7 +331,7 @@ public:
|
||||
|
||||
void PaintWeather() override
|
||||
{
|
||||
_drawingContext->CalculcateClipping(&_bitsDPI);
|
||||
_drawingContext->CalculcateClipping(_bitsDPI);
|
||||
|
||||
DrawWeather(_bitsDPI, &_weatherDrawer);
|
||||
}
|
||||
@@ -509,7 +509,7 @@ void OpenGLDrawingContext::StartNewDraw()
|
||||
_swapFramebuffer->Clear();
|
||||
}
|
||||
|
||||
void OpenGLDrawingContext::Clear(DrawPixelInfo* dpi, uint8_t paletteIndex)
|
||||
void OpenGLDrawingContext::Clear(DrawPixelInfo& dpi, uint8_t paletteIndex)
|
||||
{
|
||||
CalculcateClipping(dpi);
|
||||
|
||||
@@ -517,7 +517,7 @@ void OpenGLDrawingContext::Clear(DrawPixelInfo* dpi, uint8_t paletteIndex)
|
||||
}
|
||||
|
||||
void OpenGLDrawingContext::FillRect(
|
||||
DrawPixelInfo* dpi, uint32_t colour, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
||||
DrawPixelInfo& dpi, uint32_t colour, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
||||
{
|
||||
CalculcateClipping(dpi);
|
||||
|
||||
@@ -552,7 +552,7 @@ void OpenGLDrawingContext::FillRect(
|
||||
}
|
||||
|
||||
void OpenGLDrawingContext::FilterRect(
|
||||
DrawPixelInfo* dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
||||
DrawPixelInfo& dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
||||
{
|
||||
CalculcateClipping(dpi);
|
||||
|
||||
@@ -575,7 +575,7 @@ void OpenGLDrawingContext::FilterRect(
|
||||
command.depth = _drawCount++;
|
||||
}
|
||||
|
||||
void OpenGLDrawingContext::DrawLine(DrawPixelInfo* dpi, uint32_t colour, const ScreenLine& line)
|
||||
void OpenGLDrawingContext::DrawLine(DrawPixelInfo& dpi, uint32_t colour, const ScreenLine& line)
|
||||
{
|
||||
CalculcateClipping(dpi);
|
||||
|
||||
@@ -587,7 +587,7 @@ void OpenGLDrawingContext::DrawLine(DrawPixelInfo* dpi, uint32_t colour, const S
|
||||
command.depth = _drawCount++;
|
||||
}
|
||||
|
||||
void OpenGLDrawingContext::DrawSprite(DrawPixelInfo* dpi, const ImageId imageId, int32_t x, int32_t y)
|
||||
void OpenGLDrawingContext::DrawSprite(DrawPixelInfo& dpi, const ImageId imageId, int32_t x, int32_t y)
|
||||
{
|
||||
CalculcateClipping(dpi);
|
||||
|
||||
@@ -597,19 +597,19 @@ void OpenGLDrawingContext::DrawSprite(DrawPixelInfo* dpi, const ImageId imageId,
|
||||
return;
|
||||
}
|
||||
|
||||
if (dpi->zoom_level > ZoomLevel{ 0 })
|
||||
if (dpi.zoom_level > ZoomLevel{ 0 })
|
||||
{
|
||||
if (g1Element->flags & G1_FLAG_HAS_ZOOM_SPRITE)
|
||||
{
|
||||
DrawPixelInfo zoomedDPI;
|
||||
zoomedDPI.bits = dpi->bits;
|
||||
zoomedDPI.x = dpi->x >> 1;
|
||||
zoomedDPI.y = dpi->y >> 1;
|
||||
zoomedDPI.height = dpi->height >> 1;
|
||||
zoomedDPI.width = dpi->width >> 1;
|
||||
zoomedDPI.pitch = dpi->pitch;
|
||||
zoomedDPI.zoom_level = dpi->zoom_level - 1;
|
||||
DrawSprite(&zoomedDPI, imageId.WithIndex(imageId.GetIndex() - g1Element->zoomed_offset), x >> 1, y >> 1);
|
||||
zoomedDPI.bits = dpi.bits;
|
||||
zoomedDPI.x = dpi.x >> 1;
|
||||
zoomedDPI.y = dpi.y >> 1;
|
||||
zoomedDPI.height = dpi.height >> 1;
|
||||
zoomedDPI.width = dpi.width >> 1;
|
||||
zoomedDPI.pitch = dpi.pitch;
|
||||
zoomedDPI.zoom_level = dpi.zoom_level - 1;
|
||||
DrawSprite(zoomedDPI, imageId.WithIndex(imageId.GetIndex() - g1Element->zoomed_offset), x >> 1, y >> 1);
|
||||
return;
|
||||
}
|
||||
if (g1Element->flags & G1_FLAG_NO_ZOOM_DRAW)
|
||||
@@ -622,11 +622,11 @@ void OpenGLDrawingContext::DrawSprite(DrawPixelInfo* dpi, const ImageId imageId,
|
||||
int32_t top = y + g1Element->y_offset;
|
||||
|
||||
int32_t zoom_mask;
|
||||
if (dpi->zoom_level >= ZoomLevel{ 0 })
|
||||
zoom_mask = dpi->zoom_level.ApplyTo(0xFFFFFFFF);
|
||||
if (dpi.zoom_level >= ZoomLevel{ 0 })
|
||||
zoom_mask = dpi.zoom_level.ApplyTo(0xFFFFFFFF);
|
||||
else
|
||||
zoom_mask = 0xFFFFFFFF;
|
||||
if (dpi->zoom_level != ZoomLevel{ 0 } && (g1Element->flags & G1_FLAG_RLE_COMPRESSION))
|
||||
if (dpi.zoom_level != ZoomLevel{ 0 } && (g1Element->flags & G1_FLAG_RLE_COMPRESSION))
|
||||
{
|
||||
top -= ~zoom_mask;
|
||||
}
|
||||
@@ -642,7 +642,7 @@ void OpenGLDrawingContext::DrawSprite(DrawPixelInfo* dpi, const ImageId imageId,
|
||||
int32_t right = left + g1Element->width;
|
||||
int32_t bottom = top + g1Element->height;
|
||||
|
||||
if (dpi->zoom_level != ZoomLevel{ 0 } && (g1Element->flags & G1_FLAG_RLE_COMPRESSION))
|
||||
if (dpi.zoom_level != ZoomLevel{ 0 } && (g1Element->flags & G1_FLAG_RLE_COMPRESSION))
|
||||
{
|
||||
bottom += top & ~zoom_mask;
|
||||
}
|
||||
@@ -656,15 +656,15 @@ void OpenGLDrawingContext::DrawSprite(DrawPixelInfo* dpi, const ImageId imageId,
|
||||
std::swap(top, bottom);
|
||||
}
|
||||
|
||||
left -= dpi->x;
|
||||
top -= dpi->y;
|
||||
right -= dpi->x;
|
||||
bottom -= dpi->y;
|
||||
left -= dpi.x;
|
||||
top -= dpi.y;
|
||||
right -= dpi.x;
|
||||
bottom -= dpi.y;
|
||||
|
||||
left = dpi->zoom_level.ApplyInversedTo(left);
|
||||
top = dpi->zoom_level.ApplyInversedTo(top);
|
||||
right = dpi->zoom_level.ApplyInversedTo(right);
|
||||
bottom = dpi->zoom_level.ApplyInversedTo(bottom);
|
||||
left = dpi.zoom_level.ApplyInversedTo(left);
|
||||
top = dpi.zoom_level.ApplyInversedTo(top);
|
||||
right = dpi.zoom_level.ApplyInversedTo(right);
|
||||
bottom = dpi.zoom_level.ApplyInversedTo(bottom);
|
||||
|
||||
left += _spriteOffset.x;
|
||||
top += _spriteOffset.y;
|
||||
@@ -738,7 +738,7 @@ void OpenGLDrawingContext::DrawSprite(DrawPixelInfo* dpi, const ImageId imageId,
|
||||
}
|
||||
|
||||
void OpenGLDrawingContext::DrawSpriteRawMasked(
|
||||
DrawPixelInfo* dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage)
|
||||
DrawPixelInfo& dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage)
|
||||
{
|
||||
CalculcateClipping(dpi);
|
||||
|
||||
@@ -771,15 +771,15 @@ void OpenGLDrawingContext::DrawSpriteRawMasked(
|
||||
std::swap(top, bottom);
|
||||
}
|
||||
|
||||
left -= dpi->x;
|
||||
top -= dpi->y;
|
||||
right -= dpi->x;
|
||||
bottom -= dpi->y;
|
||||
left -= dpi.x;
|
||||
top -= dpi.y;
|
||||
right -= dpi.x;
|
||||
bottom -= dpi.y;
|
||||
|
||||
left = dpi->zoom_level.ApplyInversedTo(left);
|
||||
top = dpi->zoom_level.ApplyInversedTo(top);
|
||||
right = dpi->zoom_level.ApplyInversedTo(right);
|
||||
bottom = dpi->zoom_level.ApplyInversedTo(bottom);
|
||||
left = dpi.zoom_level.ApplyInversedTo(left);
|
||||
top = dpi.zoom_level.ApplyInversedTo(top);
|
||||
right = dpi.zoom_level.ApplyInversedTo(right);
|
||||
bottom = dpi.zoom_level.ApplyInversedTo(bottom);
|
||||
|
||||
left += _spriteOffset.x;
|
||||
top += _spriteOffset.y;
|
||||
@@ -800,7 +800,7 @@ void OpenGLDrawingContext::DrawSpriteRawMasked(
|
||||
command.depth = _drawCount++;
|
||||
}
|
||||
|
||||
void OpenGLDrawingContext::DrawSpriteSolid(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour)
|
||||
void OpenGLDrawingContext::DrawSpriteSolid(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour)
|
||||
{
|
||||
CalculcateClipping(dpi);
|
||||
|
||||
@@ -852,7 +852,7 @@ void OpenGLDrawingContext::DrawSpriteSolid(DrawPixelInfo* dpi, const ImageId ima
|
||||
command.depth = _drawCount++;
|
||||
}
|
||||
|
||||
void OpenGLDrawingContext::DrawGlyph(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& palette)
|
||||
void OpenGLDrawingContext::DrawGlyph(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& palette)
|
||||
{
|
||||
CalculcateClipping(dpi);
|
||||
|
||||
@@ -878,15 +878,15 @@ void OpenGLDrawingContext::DrawGlyph(DrawPixelInfo* dpi, const ImageId image, in
|
||||
std::swap(top, bottom);
|
||||
}
|
||||
|
||||
left -= dpi->x;
|
||||
top -= dpi->y;
|
||||
right -= dpi->x;
|
||||
bottom -= dpi->y;
|
||||
left -= dpi.x;
|
||||
top -= dpi.y;
|
||||
right -= dpi.x;
|
||||
bottom -= dpi.y;
|
||||
|
||||
left = dpi->zoom_level.ApplyInversedTo(left);
|
||||
top = dpi->zoom_level.ApplyInversedTo(top);
|
||||
right = dpi->zoom_level.ApplyInversedTo(right);
|
||||
bottom = dpi->zoom_level.ApplyInversedTo(bottom);
|
||||
left = dpi.zoom_level.ApplyInversedTo(left);
|
||||
top = dpi.zoom_level.ApplyInversedTo(top);
|
||||
right = dpi.zoom_level.ApplyInversedTo(right);
|
||||
bottom = dpi.zoom_level.ApplyInversedTo(bottom);
|
||||
|
||||
left += _spriteOffset.x;
|
||||
top += _spriteOffset.y;
|
||||
@@ -908,7 +908,7 @@ void OpenGLDrawingContext::DrawGlyph(DrawPixelInfo* dpi, const ImageId image, in
|
||||
}
|
||||
|
||||
void OpenGLDrawingContext::DrawTTFBitmap(
|
||||
DrawPixelInfo* dpi, TextDrawInfo* info, ImageIndex image, const void* pixels, int32_t width, int32_t height, int32_t x,
|
||||
DrawPixelInfo& dpi, TextDrawInfo* info, ImageIndex image, const void* pixels, int32_t width, int32_t height, int32_t x,
|
||||
int32_t y, uint8_t hinting_threshold)
|
||||
{
|
||||
CalculcateClipping(dpi);
|
||||
@@ -1067,24 +1067,24 @@ void OpenGLDrawingContext::HandleTransparency()
|
||||
_commandBuffers.transparent.clear();
|
||||
}
|
||||
|
||||
void OpenGLDrawingContext::CalculcateClipping(DrawPixelInfo* dpi)
|
||||
void OpenGLDrawingContext::CalculcateClipping(DrawPixelInfo& dpi)
|
||||
{
|
||||
auto screenDPI = _engine.GetDPI();
|
||||
auto bytesPerRow = screenDPI->GetBytesPerRow();
|
||||
auto bitsOffset = static_cast<size_t>(dpi->bits - screenDPI->bits);
|
||||
auto bitsOffset = static_cast<size_t>(dpi.bits - screenDPI->bits);
|
||||
# ifndef NDEBUG
|
||||
auto bitsSize = static_cast<size_t>(screenDPI->height) * bytesPerRow;
|
||||
assert(bitsOffset < bitsSize);
|
||||
# endif
|
||||
|
||||
_clipLeft = static_cast<int32_t>(bitsOffset % bytesPerRow) + dpi->remX;
|
||||
_clipTop = static_cast<int32_t>(bitsOffset / bytesPerRow) + dpi->remY;
|
||||
_clipRight = _clipLeft + dpi->zoom_level.ApplyInversedTo(dpi->width);
|
||||
_clipBottom = _clipTop + dpi->zoom_level.ApplyInversedTo(dpi->height);
|
||||
_offsetX = _clipLeft - dpi->x;
|
||||
_offsetY = _clipTop - dpi->y;
|
||||
_spriteOffset.x = _clipLeft - dpi->remX;
|
||||
_spriteOffset.y = _clipTop - dpi->remY;
|
||||
_clipLeft = static_cast<int32_t>(bitsOffset % bytesPerRow) + dpi.remX;
|
||||
_clipTop = static_cast<int32_t>(bitsOffset / bytesPerRow) + dpi.remY;
|
||||
_clipRight = _clipLeft + dpi.zoom_level.ApplyInversedTo(dpi.width);
|
||||
_clipBottom = _clipTop + dpi.zoom_level.ApplyInversedTo(dpi.height);
|
||||
_offsetX = _clipLeft - dpi.x;
|
||||
_offsetY = _clipTop - dpi.y;
|
||||
_spriteOffset.x = _clipLeft - dpi.remX;
|
||||
_spriteOffset.y = _clipTop - dpi.remY;
|
||||
}
|
||||
|
||||
#endif /* DISABLE_OPENGL */
|
||||
@@ -829,12 +829,12 @@ static void WidgetDrawImage(DrawPixelInfo& dpi, WindowBase& w, WidgetIndex widge
|
||||
// Draw greyed out (light border bottom right shadow)
|
||||
colour = w.colours[widget.colour];
|
||||
colour = ColourMapA[NOT_TRANSLUCENT(colour)].lighter;
|
||||
GfxDrawSpriteSolid(&dpi, image, screenCoords + ScreenCoordsXY{ 1, 1 }, colour);
|
||||
GfxDrawSpriteSolid(dpi, image, screenCoords + ScreenCoordsXY{ 1, 1 }, colour);
|
||||
|
||||
// Draw greyed out (dark)
|
||||
colour = w.colours[widget.colour];
|
||||
colour = ColourMapA[NOT_TRANSLUCENT(colour)].mid_light;
|
||||
GfxDrawSpriteSolid(&dpi, image, screenCoords, colour);
|
||||
GfxDrawSpriteSolid(dpi, image, screenCoords, colour);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace OpenRCT2::Scripting
|
||||
|
||||
void clear()
|
||||
{
|
||||
GfxClear(&_dpi, _fill);
|
||||
GfxClear(_dpi, _fill);
|
||||
}
|
||||
|
||||
void clip(int32_t x, int32_t y, int32_t width, int32_t height)
|
||||
|
||||
@@ -275,7 +275,7 @@ static Widget _inventionListDragWidgets[] = {
|
||||
|
||||
// Draw background
|
||||
uint8_t paletteIndex = ColourMapA[colours[1]].mid_light;
|
||||
GfxClear(&dpi, paletteIndex);
|
||||
GfxClear(dpi, paletteIndex);
|
||||
|
||||
int16_t boxWidth = widgets[WIDX_RESEARCH_ORDER_SCROLL].width();
|
||||
int32_t itemY = -SCROLLABLE_ROW_HEIGHT;
|
||||
|
||||
@@ -720,7 +720,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
||||
bool ridePage = (GetSelectedObjectType() == ObjectType::Ride);
|
||||
|
||||
uint8_t paletteIndex = ColourMapA[colours[1]].mid_light;
|
||||
GfxClear(&dpi, paletteIndex);
|
||||
GfxClear(dpi, paletteIndex);
|
||||
|
||||
screenCoords.y = 0;
|
||||
for (size_t i = 0; i < _listItems.size(); i++)
|
||||
|
||||
@@ -775,7 +775,7 @@ static constexpr ScreenCoordsXY MiniMapOffsets[] = {
|
||||
|
||||
void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override
|
||||
{
|
||||
GfxClear(&dpi, PALETTE_INDEX_10);
|
||||
GfxClear(dpi, PALETTE_INDEX_10);
|
||||
|
||||
G1Element g1temp = {};
|
||||
g1temp.offset = _mapImageData.data();
|
||||
|
||||
@@ -652,12 +652,12 @@ static uint64_t PressedWidgets[WINDOW_MAPGEN_PAGE_COUNT] = {
|
||||
// Draw greyed out (light border bottom right shadow)
|
||||
auto colour = colours[widget.colour];
|
||||
colour = ColourMapA[NOT_TRANSLUCENT(colour)].lighter;
|
||||
GfxDrawSpriteSolid(&dpi, image, pos + ScreenCoordsXY{ 1, 1 }, colour);
|
||||
GfxDrawSpriteSolid(dpi, image, pos + ScreenCoordsXY{ 1, 1 }, colour);
|
||||
|
||||
// Draw greyed out (dark)
|
||||
colour = colours[widget.colour];
|
||||
colour = ColourMapA[NOT_TRANSLUCENT(colour)].mid_light;
|
||||
GfxDrawSpriteSolid(&dpi, image, pos, colour);
|
||||
GfxDrawSpriteSolid(dpi, image, pos, colour);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -479,7 +479,7 @@ static Widget window_new_ride_widgets[] = {
|
||||
return;
|
||||
}
|
||||
|
||||
GfxClear(&dpi, ColourMapA[colours[1]].mid_light);
|
||||
GfxClear(dpi, ColourMapA[colours[1]].mid_light);
|
||||
|
||||
ScreenCoordsXY coords{ 1, 1 };
|
||||
RideSelection* listItem = _windowNewRideListItems;
|
||||
@@ -497,7 +497,7 @@ static Widget window_new_ride_widgets[] = {
|
||||
// Draw ride image with feathered border
|
||||
auto mask = ImageId(SPR_NEW_RIDE_MASK);
|
||||
auto rideImage = ImageId(GetRideImage(*listItem));
|
||||
GfxDrawSpriteRawMasked(&dpi, coords + ScreenCoordsXY{ 2, 2 }, mask, rideImage);
|
||||
GfxDrawSpriteRawMasked(dpi, coords + ScreenCoordsXY{ 2, 2 }, mask, rideImage);
|
||||
|
||||
// Next position
|
||||
coords.x += 116;
|
||||
|
||||
@@ -2116,10 +2116,10 @@ static Widget *window_options_page_widgets[] = {
|
||||
|
||||
// Draw greyed out (light border bottom right shadow)
|
||||
GfxDrawSpriteSolid(
|
||||
&dpi, ImageId(spriteIndex), screenCoords + ScreenCoordsXY{ 1, 1 }, ColourMapA[window_colour].lighter);
|
||||
dpi, ImageId(spriteIndex), screenCoords + ScreenCoordsXY{ 1, 1 }, ColourMapA[window_colour].lighter);
|
||||
|
||||
// Draw greyed out (dark)
|
||||
GfxDrawSpriteSolid(&dpi, ImageId(spriteIndex), screenCoords, ColourMapA[window_colour].mid_light);
|
||||
GfxDrawSpriteSolid(dpi, ImageId(spriteIndex), screenCoords, ColourMapA[window_colour].mid_light);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4739,7 +4739,7 @@ static_assert(std::size(RatingNames) == 6);
|
||||
windowPos + ScreenCoordsXY{ entrancePreviewWidget.left + 1, entrancePreviewWidget.top + 1 },
|
||||
entrancePreviewWidget.width(), entrancePreviewWidget.height()))
|
||||
{
|
||||
GfxClear(&clippedDpi, PALETTE_INDEX_12);
|
||||
GfxClear(clippedDpi, PALETTE_INDEX_12);
|
||||
|
||||
auto stationObj = ride->GetStationObject();
|
||||
if (stationObj != nullptr && stationObj->BaseImageId != ImageIndexUndefined)
|
||||
@@ -5763,7 +5763,7 @@ static_assert(std::size(RatingNames) == 6);
|
||||
|
||||
void GraphsOnScrollDraw(DrawPixelInfo& dpi, int32_t scrollIndex)
|
||||
{
|
||||
GfxClear(&dpi, ColourMapA[COLOUR_SATURATED_GREEN].darker);
|
||||
GfxClear(dpi, ColourMapA[COLOUR_SATURATED_GREEN].darker);
|
||||
|
||||
auto widget = &widgets[WIDX_GRAPH];
|
||||
auto ride = GetRide(rideId);
|
||||
|
||||
@@ -401,7 +401,7 @@ static Widget _scenarioSelectWidgets[] = {
|
||||
void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override
|
||||
{
|
||||
uint8_t paletteIndex = ColourMapA[colours[1]].mid_light;
|
||||
GfxClear(&dpi, paletteIndex);
|
||||
GfxClear(dpi, paletteIndex);
|
||||
|
||||
StringId highlighted_format = ScenarioSelectUseSmallFont() ? STR_WHITE_STRING : STR_WINDOW_COLOUR_2_STRINGID;
|
||||
StringId unhighlighted_format = ScenarioSelectUseSmallFont() ? STR_WHITE_STRING : STR_BLACK_STRING;
|
||||
|
||||
@@ -1635,7 +1635,7 @@ static Widget WindowSceneryBaseWidgets[] = {
|
||||
|
||||
void ContentScrollDraw(DrawPixelInfo& dpi)
|
||||
{
|
||||
GfxClear(&dpi, ColourMapA[colours[1]].mid_light);
|
||||
GfxClear(dpi, ColourMapA[colours[1]].mid_light);
|
||||
|
||||
auto numColumns = GetNumColumns();
|
||||
auto tabIndex = _activeTabIndex;
|
||||
|
||||
@@ -335,7 +335,7 @@ static Widget _serverListWidgets[] = {
|
||||
void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override
|
||||
{
|
||||
uint8_t paletteIndex = ColourMapA[colours[1]].mid_light;
|
||||
GfxClear(&dpi, paletteIndex);
|
||||
GfxClear(dpi, paletteIndex);
|
||||
|
||||
auto& listWidget = widgets[WIDX_LIST];
|
||||
int32_t listWidgetWidth = listWidget.width();
|
||||
|
||||
@@ -759,7 +759,7 @@ static WindowClass window_themes_tab_7_classes[] = {
|
||||
if ((colours[1] & 0x80) == 0)
|
||||
// GfxFillRect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1,
|
||||
// ColourMapA[colours[1]].mid_light);
|
||||
GfxClear(&dpi, ColourMapA[colours[1]].mid_light);
|
||||
GfxClear(dpi, ColourMapA[colours[1]].mid_light);
|
||||
screenCoords.y = 0;
|
||||
for (int32_t i = 0; i < GetColourSchemeTabCount(); i++)
|
||||
{
|
||||
|
||||
@@ -677,7 +677,7 @@ static Widget _trackListWidgets[] = {
|
||||
void OnScrollDraw(const int32_t scrollIndex, DrawPixelInfo& dpi) override
|
||||
{
|
||||
uint8_t paletteIndex = ColourMapA[colours[0]].mid_light;
|
||||
GfxClear(&dpi, paletteIndex);
|
||||
GfxClear(dpi, paletteIndex);
|
||||
|
||||
auto screenCoords = ScreenCoordsXY{ 0, 0 };
|
||||
size_t listIndex = 0;
|
||||
|
||||
@@ -178,10 +178,10 @@ void IntroDraw(DrawPixelInfo& dpi)
|
||||
case IntroState::Disclaimer2:
|
||||
break;
|
||||
case IntroState::PublisherBegin:
|
||||
GfxClear(&dpi, kBackgroundColourDark);
|
||||
GfxClear(dpi, kBackgroundColourDark);
|
||||
break;
|
||||
case IntroState::PublisherScroll:
|
||||
GfxClear(&dpi, kBackgroundColourDark);
|
||||
GfxClear(dpi, kBackgroundColourDark);
|
||||
|
||||
// Draw a white rectangle for the logo background (gives a bit of white margin)
|
||||
GfxFillRect(
|
||||
@@ -197,11 +197,11 @@ void IntroDraw(DrawPixelInfo& dpi)
|
||||
GfxDrawSprite(dpi, ImageId(SPR_INTRO_INFOGRAMES_11), { (screenWidth / 2) - 320 + 319, _introStateCounter + 319 });
|
||||
break;
|
||||
case IntroState::DeveloperBegin:
|
||||
GfxClear(&dpi, kBackgroundColourDark);
|
||||
GfxClear(dpi, kBackgroundColourDark);
|
||||
GfxTransposePalette(PALETTE_G1_IDX_DEVELOPER, 255);
|
||||
break;
|
||||
case IntroState::DeveloperScroll:
|
||||
GfxClear(&dpi, kBackgroundColourDark);
|
||||
GfxClear(dpi, kBackgroundColourDark);
|
||||
|
||||
// Draw Chris Sawyer logo
|
||||
GfxDrawSprite(dpi, ImageId(SPR_INTRO_CHRIS_SAWYER_00), { (screenWidth / 2) - 320 + 70, _introStateCounter });
|
||||
@@ -233,7 +233,7 @@ void IntroDraw(DrawPixelInfo& dpi)
|
||||
ScreenIntroDrawLogo(dpi);
|
||||
break;
|
||||
case IntroState::Clear:
|
||||
GfxClear(&dpi, kBackgroundColourDark);
|
||||
GfxClear(dpi, kBackgroundColourDark);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -293,7 +293,7 @@ static void ScreenIntroDrawLogo(DrawPixelInfo& dpi)
|
||||
DrawingEngineInvalidateImage(SPR_INTRO_LOGO_11);
|
||||
DrawingEngineInvalidateImage(SPR_INTRO_LOGO_21);
|
||||
|
||||
GfxClear(&dpi, kBackgroundColourLogo);
|
||||
GfxClear(dpi, kBackgroundColourLogo);
|
||||
GfxDrawSprite(dpi, ImageId(SPR_INTRO_LOGO_00), { imageX + 0, 0 });
|
||||
GfxDrawSprite(dpi, ImageId(SPR_INTRO_LOGO_10), { imageX + 220, 0 });
|
||||
GfxDrawSprite(dpi, ImageId(SPR_INTRO_LOGO_20), { imageX + 440, 0 });
|
||||
|
||||
@@ -492,7 +492,7 @@ static void TTFDrawCharacterSprite(DrawPixelInfo& dpi, int32_t codepoint, TextDr
|
||||
}
|
||||
|
||||
PaletteMap paletteMap(info->palette);
|
||||
GfxDrawGlyph(&dpi, sprite, screenCoords, paletteMap);
|
||||
GfxDrawGlyph(dpi, sprite, screenCoords, paletteMap);
|
||||
}
|
||||
|
||||
info->x += characterWidth;
|
||||
@@ -548,7 +548,7 @@ static void TTFDrawStringRawTTF(DrawPixelInfo& dpi, std::string_view text, TextD
|
||||
uint8_t hint_thresh = use_hinting ? fontDesc->hinting_threshold : 0;
|
||||
drawingEngine->InvalidateImage(imageId);
|
||||
drawingContext->DrawTTFBitmap(
|
||||
&dpi, info, imageId, surface->pixels, surface->pitch, surface->h, drawX, drawY, hint_thresh);
|
||||
dpi, info, imageId, surface->pixels, surface->pitch, surface->h, drawX, drawY, hint_thresh);
|
||||
|
||||
_ttfGlId++;
|
||||
if (_ttfGlId >= 1023)
|
||||
|
||||
@@ -537,7 +537,7 @@ void GfxTransposePalette(int32_t pal, uint8_t product);
|
||||
void LoadPalette();
|
||||
|
||||
// other
|
||||
void GfxClear(DrawPixelInfo* dpi, uint8_t paletteIndex);
|
||||
void GfxClear(DrawPixelInfo& dpi, uint8_t paletteIndex);
|
||||
void GfxFilterPixel(DrawPixelInfo& dpi, const ScreenCoordsXY& coords, FilterPaletteID palette);
|
||||
void GfxInvalidatePickedUpPeep();
|
||||
void GfxDrawPickedUpPeep(DrawPixelInfo& dpi);
|
||||
@@ -569,10 +569,10 @@ void FASTCALL GfxSpriteToBuffer(DrawPixelInfo& dpi, const DrawSpriteArgs& args);
|
||||
void FASTCALL GfxBmpSpriteToBuffer(DrawPixelInfo& dpi, const DrawSpriteArgs& args);
|
||||
void FASTCALL GfxRleSpriteToBuffer(DrawPixelInfo& dpi, const DrawSpriteArgs& args);
|
||||
void FASTCALL GfxDrawSprite(DrawPixelInfo& dpi, const ImageId image_id, const ScreenCoordsXY& coords);
|
||||
void FASTCALL GfxDrawGlyph(DrawPixelInfo* dpi, const ImageId image, const ScreenCoordsXY& coords, const PaletteMap& paletteMap);
|
||||
void FASTCALL GfxDrawSpriteSolid(DrawPixelInfo* dpi, const ImageId image, const ScreenCoordsXY& coords, uint8_t colour);
|
||||
void FASTCALL GfxDrawGlyph(DrawPixelInfo& dpi, const ImageId image, const ScreenCoordsXY& coords, const PaletteMap& paletteMap);
|
||||
void FASTCALL GfxDrawSpriteSolid(DrawPixelInfo& dpi, const ImageId image, const ScreenCoordsXY& coords, uint8_t colour);
|
||||
void FASTCALL GfxDrawSpriteRawMasked(
|
||||
DrawPixelInfo* dpi, const ScreenCoordsXY& coords, const ImageId maskImage, const ImageId colourImage);
|
||||
DrawPixelInfo& dpi, const ScreenCoordsXY& coords, const ImageId maskImage, const ImageId colourImage);
|
||||
void FASTCALL GfxDrawSpriteSoftware(DrawPixelInfo& dpi, const ImageId imageId, const ScreenCoordsXY& spriteCoords);
|
||||
void FASTCALL GfxDrawSpritePaletteSetSoftware(
|
||||
DrawPixelInfo& dpi, const ImageId imageId, const ScreenCoordsXY& coords, const PaletteMap& paletteMap);
|
||||
|
||||
@@ -20,20 +20,20 @@ namespace OpenRCT2::Drawing
|
||||
{
|
||||
virtual ~IDrawingContext() = default;
|
||||
|
||||
virtual void Clear(DrawPixelInfo* dpi, uint8_t paletteIndex) abstract;
|
||||
virtual void Clear(DrawPixelInfo& dpi, uint8_t paletteIndex) abstract;
|
||||
virtual void FillRect(
|
||||
DrawPixelInfo* dpi, uint32_t colour, int32_t left, int32_t top, int32_t right, int32_t bottom) abstract;
|
||||
DrawPixelInfo& dpi, uint32_t colour, int32_t left, int32_t top, int32_t right, int32_t bottom) abstract;
|
||||
virtual void FilterRect(
|
||||
DrawPixelInfo* dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom) abstract;
|
||||
virtual void DrawLine(DrawPixelInfo* dpi, uint32_t colour, const ScreenLine& line) abstract;
|
||||
virtual void DrawSprite(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y) abstract;
|
||||
DrawPixelInfo& dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom) abstract;
|
||||
virtual void DrawLine(DrawPixelInfo& dpi, uint32_t colour, const ScreenLine& line) abstract;
|
||||
virtual void DrawSprite(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y) abstract;
|
||||
virtual void DrawSpriteRawMasked(
|
||||
DrawPixelInfo* dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage) abstract;
|
||||
virtual void DrawSpriteSolid(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour) abstract;
|
||||
DrawPixelInfo& dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage) abstract;
|
||||
virtual void DrawSpriteSolid(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour) abstract;
|
||||
virtual void DrawGlyph(
|
||||
DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& palette) abstract;
|
||||
DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& palette) abstract;
|
||||
virtual void DrawTTFBitmap(
|
||||
DrawPixelInfo* dpi, TextDrawInfo* info, ImageIndex image, const void* pixels, int32_t width, int32_t height,
|
||||
DrawPixelInfo& dpi, TextDrawInfo* info, ImageIndex image, const void* pixels, int32_t width, int32_t height,
|
||||
int32_t x, int32_t y, uint8_t hinting_threshold) abstract;
|
||||
};
|
||||
|
||||
|
||||
@@ -160,9 +160,9 @@ void GfxSetDirtyBlocks(const ScreenRect& rect)
|
||||
}
|
||||
}
|
||||
|
||||
void GfxClear(DrawPixelInfo* dpi, uint8_t paletteIndex)
|
||||
void GfxClear(DrawPixelInfo& dpi, uint8_t paletteIndex)
|
||||
{
|
||||
auto drawingEngine = dpi->DrawingEngine;
|
||||
auto drawingEngine = dpi.DrawingEngine;
|
||||
if (drawingEngine != nullptr)
|
||||
{
|
||||
IDrawingContext* dc = drawingEngine->GetDrawingContext();
|
||||
@@ -176,7 +176,7 @@ void GfxFillRect(DrawPixelInfo& dpi, const ScreenRect& rect, int32_t colour)
|
||||
if (drawingEngine != nullptr)
|
||||
{
|
||||
IDrawingContext* dc = drawingEngine->GetDrawingContext();
|
||||
dc->FillRect(&dpi, colour, rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom());
|
||||
dc->FillRect(dpi, colour, rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ void GfxFilterRect(DrawPixelInfo& dpi, const ScreenRect& rect, FilterPaletteID p
|
||||
if (drawingEngine != nullptr)
|
||||
{
|
||||
IDrawingContext* dc = drawingEngine->GetDrawingContext();
|
||||
dc->FilterRect(&dpi, palette, rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom());
|
||||
dc->FilterRect(dpi, palette, rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ void GfxDrawLine(DrawPixelInfo& dpi, const ScreenLine& line, int32_t colour)
|
||||
if (drawingEngine != nullptr)
|
||||
{
|
||||
IDrawingContext* dc = drawingEngine->GetDrawingContext();
|
||||
dc->DrawLine(&dpi, colour, line);
|
||||
dc->DrawLine(dpi, colour, line);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ void GfxDrawDashedLine(
|
||||
{
|
||||
x = screenLine.GetX1() + dxPrecise * i * 2 / precisionFactor;
|
||||
y = screenLine.GetY1() + dyPrecise * i * 2 / precisionFactor;
|
||||
dc->DrawLine(&dpi, color, { { x, y }, { x + dxPrecise / precisionFactor, y + dyPrecise / precisionFactor } });
|
||||
dc->DrawLine(dpi, color, { { x, y }, { x + dxPrecise / precisionFactor, y + dyPrecise / precisionFactor } });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -239,13 +239,13 @@ void FASTCALL GfxDrawSprite(DrawPixelInfo& dpi, const ImageId imageId, const Scr
|
||||
if (drawingEngine != nullptr)
|
||||
{
|
||||
IDrawingContext* dc = drawingEngine->GetDrawingContext();
|
||||
dc->DrawSprite(&dpi, imageId, coords.x, coords.y);
|
||||
dc->DrawSprite(dpi, imageId, coords.x, coords.y);
|
||||
}
|
||||
}
|
||||
|
||||
void FASTCALL GfxDrawGlyph(DrawPixelInfo* dpi, const ImageId image, const ScreenCoordsXY& coords, const PaletteMap& paletteMap)
|
||||
void FASTCALL GfxDrawGlyph(DrawPixelInfo& dpi, const ImageId image, const ScreenCoordsXY& coords, const PaletteMap& paletteMap)
|
||||
{
|
||||
auto drawingEngine = dpi->DrawingEngine;
|
||||
auto drawingEngine = dpi.DrawingEngine;
|
||||
if (drawingEngine != nullptr)
|
||||
{
|
||||
IDrawingContext* dc = drawingEngine->GetDrawingContext();
|
||||
@@ -254,9 +254,9 @@ void FASTCALL GfxDrawGlyph(DrawPixelInfo* dpi, const ImageId image, const Screen
|
||||
}
|
||||
|
||||
void FASTCALL
|
||||
GfxDrawSpriteRawMasked(DrawPixelInfo* dpi, const ScreenCoordsXY& coords, const ImageId maskImage, const ImageId colourImage)
|
||||
GfxDrawSpriteRawMasked(DrawPixelInfo& dpi, const ScreenCoordsXY& coords, const ImageId maskImage, const ImageId colourImage)
|
||||
{
|
||||
auto drawingEngine = dpi->DrawingEngine;
|
||||
auto drawingEngine = dpi.DrawingEngine;
|
||||
if (drawingEngine != nullptr)
|
||||
{
|
||||
IDrawingContext* dc = drawingEngine->GetDrawingContext();
|
||||
@@ -264,9 +264,9 @@ void FASTCALL
|
||||
}
|
||||
}
|
||||
|
||||
void FASTCALL GfxDrawSpriteSolid(DrawPixelInfo* dpi, const ImageId image, const ScreenCoordsXY& coords, uint8_t colour)
|
||||
void FASTCALL GfxDrawSpriteSolid(DrawPixelInfo& dpi, const ImageId image, const ScreenCoordsXY& coords, uint8_t colour)
|
||||
{
|
||||
auto drawingEngine = dpi->DrawingEngine;
|
||||
auto drawingEngine = dpi.DrawingEngine;
|
||||
if (drawingEngine != nullptr)
|
||||
{
|
||||
IDrawingContext* dc = drawingEngine->GetDrawingContext();
|
||||
|
||||
@@ -92,12 +92,12 @@ void X8WeatherDrawer::Draw(
|
||||
}
|
||||
}
|
||||
|
||||
void X8WeatherDrawer::Restore(DrawPixelInfo* dpi)
|
||||
void X8WeatherDrawer::Restore(DrawPixelInfo& dpi)
|
||||
{
|
||||
if (_weatherPixelsCount > 0)
|
||||
{
|
||||
uint32_t numPixels = (dpi->width + dpi->pitch) * dpi->height;
|
||||
uint8_t* bits = dpi->bits;
|
||||
uint32_t numPixels = (dpi.width + dpi.pitch) * dpi.height;
|
||||
uint8_t* bits = dpi.bits;
|
||||
for (uint32_t i = 0; i < _weatherPixelsCount; i++)
|
||||
{
|
||||
WeatherPixel weatherPixel = _weatherPixels[i];
|
||||
@@ -193,7 +193,7 @@ void X8DrawingEngine::BeginDraw()
|
||||
{
|
||||
Resize(_width, _height);
|
||||
}
|
||||
_weatherDrawer.Restore(&_bitsDPI);
|
||||
_weatherDrawer.Restore(_bitsDPI);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,16 +460,16 @@ X8DrawingContext::X8DrawingContext(X8DrawingEngine* engine)
|
||||
_engine = engine;
|
||||
}
|
||||
|
||||
void X8DrawingContext::Clear(DrawPixelInfo* dpi, uint8_t paletteIndex)
|
||||
void X8DrawingContext::Clear(DrawPixelInfo& dpi, uint8_t paletteIndex)
|
||||
{
|
||||
int32_t w = dpi->zoom_level.ApplyInversedTo(dpi->width);
|
||||
int32_t h = dpi->zoom_level.ApplyInversedTo(dpi->height);
|
||||
uint8_t* ptr = dpi->bits;
|
||||
int32_t w = dpi.zoom_level.ApplyInversedTo(dpi.width);
|
||||
int32_t h = dpi.zoom_level.ApplyInversedTo(dpi.height);
|
||||
uint8_t* ptr = dpi.bits;
|
||||
|
||||
for (int32_t y = 0; y < h; y++)
|
||||
{
|
||||
std::fill_n(ptr, w, paletteIndex);
|
||||
ptr += w + dpi->pitch;
|
||||
ptr += w + dpi.pitch;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,47 +521,47 @@ static constexpr const uint16_t* Patterns[] = {
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
void X8DrawingContext::FillRect(DrawPixelInfo* dpi, uint32_t colour, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
||||
void X8DrawingContext::FillRect(DrawPixelInfo& dpi, uint32_t colour, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
||||
{
|
||||
if (left > right)
|
||||
return;
|
||||
if (top > bottom)
|
||||
return;
|
||||
if (dpi->x > right)
|
||||
if (dpi.x > right)
|
||||
return;
|
||||
if (left >= dpi->x + dpi->width)
|
||||
if (left >= dpi.x + dpi.width)
|
||||
return;
|
||||
if (bottom < dpi->y)
|
||||
if (bottom < dpi.y)
|
||||
return;
|
||||
if (top >= dpi->y + dpi->height)
|
||||
if (top >= dpi.y + dpi.height)
|
||||
return;
|
||||
|
||||
uint16_t crossPattern = 0;
|
||||
|
||||
int32_t startX = left - dpi->x;
|
||||
int32_t startX = left - dpi.x;
|
||||
if (startX < 0)
|
||||
{
|
||||
crossPattern ^= startX;
|
||||
startX = 0;
|
||||
}
|
||||
|
||||
int32_t endX = right - dpi->x + 1;
|
||||
if (endX > dpi->width)
|
||||
int32_t endX = right - dpi.x + 1;
|
||||
if (endX > dpi.width)
|
||||
{
|
||||
endX = dpi->width;
|
||||
endX = dpi.width;
|
||||
}
|
||||
|
||||
int32_t startY = top - dpi->y;
|
||||
int32_t startY = top - dpi.y;
|
||||
if (startY < 0)
|
||||
{
|
||||
crossPattern ^= startY;
|
||||
startY = 0;
|
||||
}
|
||||
|
||||
int32_t endY = bottom - dpi->y + 1;
|
||||
if (endY > dpi->height)
|
||||
int32_t endY = bottom - dpi.y + 1;
|
||||
if (endY > dpi.height)
|
||||
{
|
||||
endY = dpi->height;
|
||||
endY = dpi.height;
|
||||
}
|
||||
|
||||
int32_t width = endX - startX;
|
||||
@@ -570,10 +570,10 @@ void X8DrawingContext::FillRect(DrawPixelInfo* dpi, uint32_t colour, int32_t lef
|
||||
if (colour & 0x1000000)
|
||||
{
|
||||
// Cross hatching
|
||||
uint8_t* dst = (startY * (dpi->width + dpi->pitch)) + startX + dpi->bits;
|
||||
uint8_t* dst = (startY * (dpi.width + dpi.pitch)) + startX + dpi.bits;
|
||||
for (int32_t i = 0; i < height; i++)
|
||||
{
|
||||
uint8_t* nextdst = dst + dpi->width + dpi->pitch;
|
||||
uint8_t* nextdst = dst + dpi.width + dpi.pitch;
|
||||
uint32_t p = Numerics::ror32(crossPattern, 1);
|
||||
p = (p & 0xFFFF0000) | width;
|
||||
|
||||
@@ -597,22 +597,22 @@ void X8DrawingContext::FillRect(DrawPixelInfo* dpi, uint32_t colour, int32_t lef
|
||||
}
|
||||
else if (colour & 0x4000000)
|
||||
{
|
||||
uint8_t* dst = startY * (dpi->width + dpi->pitch) + startX + dpi->bits;
|
||||
uint8_t* dst = startY * (dpi.width + dpi.pitch) + startX + dpi.bits;
|
||||
|
||||
// The pattern loops every 15 lines this is which
|
||||
// part the pattern is on.
|
||||
int32_t patternY = (startY + dpi->y) % 16;
|
||||
int32_t patternY = (startY + dpi.y) % 16;
|
||||
|
||||
// The pattern loops every 15 pixels this is which
|
||||
// part the pattern is on.
|
||||
int32_t startPatternX = (startX + dpi->x) % 16;
|
||||
int32_t startPatternX = (startX + dpi.x) % 16;
|
||||
int32_t patternX = startPatternX;
|
||||
|
||||
const uint16_t* patternsrc = Patterns[colour >> 28]; // or possibly uint8_t)[esi*4] ?
|
||||
|
||||
for (int32_t numLines = height; numLines > 0; numLines--)
|
||||
{
|
||||
uint8_t* nextdst = dst + dpi->width + dpi->pitch;
|
||||
uint8_t* nextdst = dst + dpi.width + dpi.pitch;
|
||||
uint16_t pattern = patternsrc[patternY];
|
||||
|
||||
for (int32_t numPixels = width; numPixels > 0; numPixels--)
|
||||
@@ -631,53 +631,53 @@ void X8DrawingContext::FillRect(DrawPixelInfo* dpi, uint32_t colour, int32_t lef
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t* dst = startY * (dpi->width + dpi->pitch) + startX + dpi->bits;
|
||||
uint8_t* dst = startY * (dpi.width + dpi.pitch) + startX + dpi.bits;
|
||||
for (int32_t i = 0; i < height; i++)
|
||||
{
|
||||
std::fill_n(dst, width, colour & 0xFF);
|
||||
dst += dpi->width + dpi->pitch;
|
||||
dst += dpi.width + dpi.pitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void X8DrawingContext::FilterRect(
|
||||
DrawPixelInfo* dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
||||
DrawPixelInfo& dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
||||
{
|
||||
if (left > right)
|
||||
return;
|
||||
if (top > bottom)
|
||||
return;
|
||||
if (dpi->x > right)
|
||||
if (dpi.x > right)
|
||||
return;
|
||||
if (left >= dpi->x + dpi->width)
|
||||
if (left >= dpi.x + dpi.width)
|
||||
return;
|
||||
if (bottom < dpi->y)
|
||||
if (bottom < dpi.y)
|
||||
return;
|
||||
if (top >= dpi->y + dpi->height)
|
||||
if (top >= dpi.y + dpi.height)
|
||||
return;
|
||||
|
||||
int32_t startX = left - dpi->x;
|
||||
int32_t startX = left - dpi.x;
|
||||
if (startX < 0)
|
||||
{
|
||||
startX = 0;
|
||||
}
|
||||
|
||||
int32_t endX = right - dpi->x + 1;
|
||||
if (endX > dpi->width)
|
||||
int32_t endX = right - dpi.x + 1;
|
||||
if (endX > dpi.width)
|
||||
{
|
||||
endX = dpi->width;
|
||||
endX = dpi.width;
|
||||
}
|
||||
|
||||
int32_t startY = top - dpi->y;
|
||||
int32_t startY = top - dpi.y;
|
||||
if (startY < 0)
|
||||
{
|
||||
startY = 0;
|
||||
}
|
||||
|
||||
int32_t endY = bottom - dpi->y + 1;
|
||||
if (endY > dpi->height)
|
||||
int32_t endY = bottom - dpi.y + 1;
|
||||
if (endY > dpi.height)
|
||||
{
|
||||
endY = dpi->height;
|
||||
endY = dpi.height;
|
||||
}
|
||||
|
||||
int32_t width = endX - startX;
|
||||
@@ -686,21 +686,21 @@ void X8DrawingContext::FilterRect(
|
||||
// 0x2000000
|
||||
// 00678B7E 00678C83
|
||||
// Location in screen buffer?
|
||||
uint8_t* dst = dpi->bits
|
||||
uint8_t* dst = dpi.bits
|
||||
+ static_cast<uint32_t>(
|
||||
dpi->zoom_level.ApplyInversedTo(startY) * (dpi->zoom_level.ApplyInversedTo(dpi->width) + dpi->pitch)
|
||||
+ dpi->zoom_level.ApplyInversedTo(startX));
|
||||
dpi.zoom_level.ApplyInversedTo(startY) * (dpi.zoom_level.ApplyInversedTo(dpi.width) + dpi.pitch)
|
||||
+ dpi.zoom_level.ApplyInversedTo(startX));
|
||||
|
||||
// Find colour in colour table?
|
||||
auto paletteMap = GetPaletteMapForColour(EnumValue(palette));
|
||||
if (paletteMap.has_value())
|
||||
{
|
||||
const auto& paletteEntries = paletteMap.value();
|
||||
const int32_t scaled_width = dpi->zoom_level.ApplyInversedTo(width);
|
||||
const int32_t step = dpi->zoom_level.ApplyInversedTo(dpi->width) + dpi->pitch;
|
||||
const int32_t scaled_width = dpi.zoom_level.ApplyInversedTo(width);
|
||||
const int32_t step = dpi.zoom_level.ApplyInversedTo(dpi.width) + dpi.pitch;
|
||||
|
||||
// Fill the rectangle with the colours from the colour table
|
||||
auto c = dpi->zoom_level.ApplyInversedTo(height);
|
||||
auto c = dpi.zoom_level.ApplyInversedTo(height);
|
||||
for (int32_t i = 0; i < c; i++)
|
||||
{
|
||||
uint8_t* nextdst = dst + step * i;
|
||||
@@ -713,33 +713,33 @@ void X8DrawingContext::FilterRect(
|
||||
}
|
||||
}
|
||||
|
||||
void X8DrawingContext::DrawLine(DrawPixelInfo* dpi, uint32_t colour, const ScreenLine& line)
|
||||
void X8DrawingContext::DrawLine(DrawPixelInfo& dpi, uint32_t colour, const ScreenLine& line)
|
||||
{
|
||||
GfxDrawLineSoftware(*dpi, line, colour);
|
||||
GfxDrawLineSoftware(dpi, line, colour);
|
||||
}
|
||||
|
||||
void X8DrawingContext::DrawSprite(DrawPixelInfo* dpi, const ImageId imageId, int32_t x, int32_t y)
|
||||
void X8DrawingContext::DrawSprite(DrawPixelInfo& dpi, const ImageId imageId, int32_t x, int32_t y)
|
||||
{
|
||||
GfxDrawSpriteSoftware(*dpi, imageId, { x, y });
|
||||
GfxDrawSpriteSoftware(dpi, imageId, { x, y });
|
||||
}
|
||||
|
||||
void X8DrawingContext::DrawSpriteRawMasked(
|
||||
DrawPixelInfo* dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage)
|
||||
DrawPixelInfo& dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage)
|
||||
{
|
||||
GfxDrawSpriteRawMaskedSoftware(*dpi, { x, y }, maskImage, colourImage);
|
||||
GfxDrawSpriteRawMaskedSoftware(dpi, { x, y }, maskImage, colourImage);
|
||||
}
|
||||
|
||||
void X8DrawingContext::DrawSpriteSolid(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour)
|
||||
void X8DrawingContext::DrawSpriteSolid(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour)
|
||||
{
|
||||
uint8_t palette[256];
|
||||
std::fill_n(palette, sizeof(palette), colour);
|
||||
palette[0] = 0;
|
||||
|
||||
const auto spriteCoords = ScreenCoordsXY{ x, y };
|
||||
GfxDrawSpritePaletteSetSoftware(*dpi, ImageId(image.GetIndex(), 0), spriteCoords, PaletteMap(palette));
|
||||
GfxDrawSpritePaletteSetSoftware(dpi, ImageId(image.GetIndex(), 0), spriteCoords, PaletteMap(palette));
|
||||
}
|
||||
|
||||
void X8DrawingContext::DrawGlyph(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& paletteMap)
|
||||
void X8DrawingContext::DrawGlyph(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& paletteMap)
|
||||
{
|
||||
GfxDrawSpritePaletteSetSoftware(*dpi, image, { x, y }, paletteMap);
|
||||
GfxDrawSpritePaletteSetSoftware(dpi, image, { x, y }, paletteMap);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ namespace OpenRCT2
|
||||
void Draw(
|
||||
DrawPixelInfo& dpi, int32_t x, int32_t y, int32_t width, int32_t height, int32_t xStart, int32_t yStart,
|
||||
const uint8_t* weatherpattern) override;
|
||||
void Restore(DrawPixelInfo* dpi);
|
||||
void Restore(DrawPixelInfo& dpi);
|
||||
};
|
||||
|
||||
#ifdef __WARN_SUGGEST_FINAL_TYPES__
|
||||
@@ -136,19 +136,19 @@ namespace OpenRCT2
|
||||
public:
|
||||
explicit X8DrawingContext(X8DrawingEngine* engine);
|
||||
|
||||
void Clear(DrawPixelInfo* dpi, uint8_t paletteIndex) override;
|
||||
void FillRect(DrawPixelInfo* dpi, uint32_t colour, int32_t x, int32_t y, int32_t w, int32_t h) override;
|
||||
void Clear(DrawPixelInfo& dpi, uint8_t paletteIndex) override;
|
||||
void FillRect(DrawPixelInfo& dpi, uint32_t colour, int32_t x, int32_t y, int32_t w, int32_t h) override;
|
||||
void FilterRect(
|
||||
DrawPixelInfo* dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom) override;
|
||||
void DrawLine(DrawPixelInfo* dpi, uint32_t colour, const ScreenLine& line) override;
|
||||
void DrawSprite(DrawPixelInfo* dpi, const ImageId imageId, int32_t x, int32_t y) override;
|
||||
DrawPixelInfo& dpi, FilterPaletteID palette, int32_t left, int32_t top, int32_t right, int32_t bottom) override;
|
||||
void DrawLine(DrawPixelInfo& dpi, uint32_t colour, const ScreenLine& line) override;
|
||||
void DrawSprite(DrawPixelInfo& dpi, const ImageId imageId, int32_t x, int32_t y) override;
|
||||
void DrawSpriteRawMasked(
|
||||
DrawPixelInfo* dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage) override;
|
||||
void DrawSpriteSolid(DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour) override;
|
||||
DrawPixelInfo& dpi, int32_t x, int32_t y, const ImageId maskImage, const ImageId colourImage) override;
|
||||
void DrawSpriteSolid(DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, uint8_t colour) override;
|
||||
void DrawGlyph(
|
||||
DrawPixelInfo* dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& paletteMap) override;
|
||||
DrawPixelInfo& dpi, const ImageId image, int32_t x, int32_t y, const PaletteMap& paletteMap) override;
|
||||
void DrawTTFBitmap(
|
||||
DrawPixelInfo* dpi, TextDrawInfo* info, uint32_t image, const void* pixels, int32_t width, int32_t height,
|
||||
DrawPixelInfo& dpi, TextDrawInfo* info, uint32_t image, const void* pixels, int32_t width, int32_t height,
|
||||
int32_t x, int32_t y, uint8_t hinting_threshold) override
|
||||
{
|
||||
}
|
||||
|
||||
@@ -987,7 +987,7 @@ static void ViewportPaintColumn(PaintSession& session)
|
||||
{
|
||||
colour = COLOUR_BLACK;
|
||||
}
|
||||
GfxClear(&session.DPI, colour);
|
||||
GfxClear(session.DPI, colour);
|
||||
}
|
||||
|
||||
PaintDrawStructs(session);
|
||||
|
||||
@@ -578,7 +578,7 @@ static void PaintAttachedPS(DrawPixelInfo& dpi, PaintStruct* ps, uint32_t viewFl
|
||||
auto imageId = PaintPSColourifyImage(ps, attached_ps->image_id, viewFlags);
|
||||
if (attached_ps->IsMasked)
|
||||
{
|
||||
GfxDrawSpriteRawMasked(&dpi, screenCoords, imageId, attached_ps->ColourImageId);
|
||||
GfxDrawSpriteRawMasked(dpi, screenCoords, imageId, attached_ps->ColourImageId);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user