Merge branch 'master' into jgrpp

# Conflicts:
#	src/blitter/32bpp_anim.hpp
#	src/blitter/32bpp_base.hpp
#	src/blitter/8bpp_base.hpp
#	src/blitter/null.hpp
#	src/cheat_gui.cpp
#	src/gfx.cpp
#	src/linkgraph/linkgraph.cpp
#	src/spriteloader/grf.cpp
#	src/station_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2023-01-03 11:36:24 +00:00
27 changed files with 117 additions and 96 deletions

View File

@@ -621,9 +621,9 @@ void Blitter_32bppAnim::ScrollBuffer(void *video, int left, int top, int width,
Blitter_32bppBase::ScrollBuffer(video, left, top, width, height, scroll_x, scroll_y);
}
int Blitter_32bppAnim::BufferSize(int width, int height)
size_t Blitter_32bppAnim::BufferSize(uint width, uint height)
{
return width * height * (sizeof(uint32) + sizeof(uint16));
return (sizeof(uint32) + sizeof(uint16)) * width * height;
}
void Blitter_32bppAnim::PaletteAnimate(const Palette &palette)

View File

@@ -46,7 +46,7 @@ public:
void CopyFromBuffer(void *video, const void *src, int width, int height) override;
void CopyToBuffer(const void *video, void *dst, int width, int height) override;
void ScrollBuffer(void *video, int left, int top, int width, int height, int scroll_x, int scroll_y) override;
int BufferSize(int width, int height) override;
size_t BufferSize(uint width, uint height) override;
void PaletteAnimate(const Palette &palette) override;
Blitter::PaletteAnimation UsePaletteAnimation() override;

View File

@@ -170,9 +170,9 @@ void Blitter_32bppBase::ScrollBuffer(void *video, int left, int top, int width,
}
}
int Blitter_32bppBase::BufferSize(int width, int height)
size_t Blitter_32bppBase::BufferSize(uint width, uint height)
{
return width * height * sizeof(uint32);
return sizeof(uint32) * width * height;
}
void Blitter_32bppBase::PaletteAnimate(const Palette &palette)

View File

@@ -30,7 +30,7 @@ public:
void CopyToBuffer(const void *video, void *dst, int width, int height) override;
void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override;
void ScrollBuffer(void *video, int left, int top, int width, int height, int scroll_x, int scroll_y) override;
int BufferSize(int width, int height) override;
size_t BufferSize(uint width, uint height) override;
void PaletteAnimate(const Palette &palette) override;
Blitter::PaletteAnimation UsePaletteAnimation() override;
int GetBytesPerPixel() override { return 4; }

View File

@@ -31,9 +31,10 @@ void Blitter_40bppAnim::SetPixel(void *video, int x, int y, uint8 colour)
if (_screen_disable_anim) {
Blitter_32bppOptimized::SetPixel(video, x, y, colour);
} else {
*((Colour *)video + x + y * _screen.pitch) = _black_colour;
size_t y_offset = static_cast<size_t>(y) * _screen.pitch;
*((Colour *)video + x + y_offset) = _black_colour;
VideoDriver::GetInstance()->GetAnimBuffer()[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * _screen.pitch] = colour;
VideoDriver::GetInstance()->GetAnimBuffer()[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y_offset] = colour;
}
}
@@ -571,9 +572,9 @@ void Blitter_40bppAnim::ScrollBuffer(void *video, int left, int top, int width,
Blitter_32bppBase::ScrollBuffer(video, left, top, width, height, scroll_x, scroll_y);
}
int Blitter_40bppAnim::BufferSize(int width, int height)
size_t Blitter_40bppAnim::BufferSize(uint width, uint height)
{
return width * height * (sizeof(uint32) + sizeof(uint8));
return (sizeof(uint32) + sizeof(uint8)) * width * height;
}
Blitter::PaletteAnimation Blitter_40bppAnim::UsePaletteAnimation()

View File

@@ -32,7 +32,7 @@ public:
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override;
Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override;
int BufferSize(int width, int height) override;
size_t BufferSize(uint width, uint height) override;
Blitter::PaletteAnimation UsePaletteAnimation() override;
bool NeedsAnimationBuffer() override;

View File

@@ -159,9 +159,9 @@ void Blitter_8bppBase::ScrollBuffer(void *video, int left, int top, int width, i
}
}
int Blitter_8bppBase::BufferSize(int width, int height)
size_t Blitter_8bppBase::BufferSize(uint width, uint height)
{
return width * height;
return static_cast<size_t>(width) * height;
}
void Blitter_8bppBase::PaletteAnimate(const Palette &palette)

View File

@@ -27,7 +27,7 @@ public:
void CopyToBuffer(const void *video, void *dst, int width, int height) override;
void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override;
void ScrollBuffer(void *video, int left, int top, int width, int height, int scroll_x, int scroll_y) override;
int BufferSize(int width, int height) override;
size_t BufferSize(uint width, uint height) override;
void PaletteAnimate(const Palette &palette) override;
Blitter::PaletteAnimation UsePaletteAnimation() override;
int GetBytesPerPixel() override { return 1; }

View File

@@ -224,7 +224,7 @@ public:
* @param height The height of the buffer-to-be.
* @return The size needed for the buffer.
*/
virtual int BufferSize(int width, int height) = 0;
virtual size_t BufferSize(uint width, uint height) = 0;
/**
* Called when the 8bpp palette is changed; you should redraw all pixels on the screen that

View File

@@ -30,7 +30,7 @@ public:
void CopyToBuffer(const void *video, void *dst, int width, int height) override {};
void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override {};
void ScrollBuffer(void *video, int left, int top, int width, int height, int scroll_x, int scroll_y) override {};
int BufferSize(int width, int height) override { return 0; };
size_t BufferSize(uint width, uint height) override { return 0; };
void PaletteAnimate(const Palette &palette) override { };
Blitter::PaletteAnimation UsePaletteAnimation() override { return Blitter::PALETTE_ANIMATION_NONE; };