Import combined Enhanced viewport: zoom out, overlays & tooltips (r53_27127) patch

https://www.tt-forums.net/viewtopic.php?f=33&t=53394
This commit is contained in:
patch-import
2015-08-02 19:37:42 +01:00
committed by Jonathan G Rennison
parent fd3388467f
commit 536a95dfd0
105 changed files with 3509 additions and 325 deletions

View File

@@ -317,6 +317,50 @@ void Blitter_32bppAnim::SetPixel(void *video, int x, int y, uint8 colour)
this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = colour | (DEFAULT_BRIGHTNESS << 8);
}
void Blitter_32bppAnim::SetLine(void *video, int x, int y, uint8 *colours, uint width)
{
Colour *dst = (Colour *)video + x + y * _screen.pitch;
if (_screen_disable_anim) {
do {
*dst = LookupColourInPalette(*colours);
dst++;
colours++;
} while (--width);
} else {
uint16 *dstanim = (uint16 *)(&this->anim_buf[(uint32 *)video - (uint32 *)_screen.dst_ptr + x + y * _screen.pitch]);
do {
*dstanim = *colours | (DEFAULT_BRIGHTNESS << 8);
*dst = LookupColourInPalette(*colours);
dst++;
dstanim++;
colours++;
} while (--width);
}
}
void Blitter_32bppAnim::SetLine32(void *video, int x, int y, uint32 *colours, uint width)
{
Colour *dst = (Colour *)video + x + y * _screen.pitch;
if (_screen_disable_anim) {
do {
*dst = *colours;
dst++;
colours++;
} while (--width);
} else {
uint16 *dstanim = (uint16 *)(&this->anim_buf[(uint32 *)video - (uint32 *)_screen.dst_ptr + x + y * _screen.pitch]);
do {
*dstanim = 0;
*dst = *colours;
dst++;
dstanim++;
colours++;
} while (--width);
}
}
void Blitter_32bppAnim::DrawRect(void *video, int width, int height, uint8 colour)
{
if (_screen_disable_anim) {

View File

@@ -32,6 +32,8 @@ public:
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
/* virtual */ void SetLine(void *video, int x, int y, uint8 *colours, uint width);
/* virtual */ void SetLine32(void *video, int x, int y, uint32 *colours, uint width);
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height);

View File

@@ -24,6 +24,26 @@ void Blitter_32bppBase::SetPixel(void *video, int x, int y, uint8 colour)
*((Colour *)video + x + y * _screen.pitch) = LookupColourInPalette(colour);
}
void Blitter_32bppBase::SetLine(void *video, int x, int y, uint8 *colours, uint width)
{
Colour *dst = (Colour *)video + x + y * _screen.pitch;
do {
*dst = LookupColourInPalette(*colours);
dst++;
colours++;
} while (--width);
}
void Blitter_32bppBase::SetLine32(void *video, int x, int y, uint32 *colours, uint width)
{
Colour *dst = (Colour *)video + x + y * _screen.pitch;
do {
*dst = *colours;
dst++;
colours++;
} while (--width);
}
void Blitter_32bppBase::DrawRect(void *video, int width, int height, uint8 colour)
{
Colour colour32 = LookupColourInPalette(colour);

View File

@@ -23,6 +23,8 @@ public:
/* virtual */ uint8 GetScreenDepth() { return 32; }
/* virtual */ void *MoveTo(void *video, int x, int y);
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
/* virtual */ void SetLine(void *video, int x, int y, uint8 *colours, uint width);
/* virtual */ void SetLine32(void *video, int x, int y, uint32 *colours, uint width);
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height);

View File

@@ -280,8 +280,8 @@ Sprite *Blitter_32bppOptimized::Encode(const SpriteLoader::Sprite *sprite, Alloc
zoom_max = ZOOM_LVL_NORMAL;
} else {
zoom_min = _settings_client.gui.zoom_min;
zoom_max = _settings_client.gui.zoom_max;
if (zoom_max == zoom_min) zoom_max = ZOOM_LVL_MAX;
zoom_max = (ZoomLevel) min(_settings_client.gui.zoom_max, ZOOM_LVL_DRAW_SPR);
if (zoom_max == zoom_min) zoom_max = ZOOM_LVL_DRAW_SPR;
}
for (ZoomLevel z = zoom_min; z <= zoom_max; z++) {

View File

@@ -35,6 +35,11 @@ void Blitter_8bppBase::SetPixel(void *video, int x, int y, uint8 colour)
*((uint8 *)video + x + y * _screen.pitch) = colour;
}
void Blitter_8bppBase::SetLine(void *video, int x, int y, uint8 *colours, uint width)
{
memcpy((uint8 *)video + x + y * _screen.pitch, colours, width * sizeof(uint8));
}
void Blitter_8bppBase::DrawRect(void *video, int width, int height, uint8 colour)
{
do {

View File

@@ -21,6 +21,7 @@ public:
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
/* virtual */ void *MoveTo(void *video, int x, int y);
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
/* virtual */ void SetLine(void *video, int x, int y, uint8 *colours, uint width);
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height);

View File

@@ -134,8 +134,8 @@ Sprite *Blitter_8bppOptimized::Encode(const SpriteLoader::Sprite *sprite, Alloca
zoom_max = ZOOM_LVL_NORMAL;
} else {
zoom_min = _settings_client.gui.zoom_min;
zoom_max = _settings_client.gui.zoom_max;
if (zoom_max == zoom_min) zoom_max = ZOOM_LVL_MAX;
zoom_max = (ZoomLevel) min(_settings_client.gui.zoom_max, ZOOM_LVL_DRAW_SPR);
if (zoom_max == zoom_min) zoom_max = ZOOM_LVL_DRAW_SPR;
}
for (ZoomLevel i = zoom_min; i <= zoom_max; i++) {

View File

@@ -100,6 +100,26 @@ public:
*/
virtual void SetPixel(void *video, int x, int y, uint8 colour) = 0;
/**
* Draw a sequence of pixels on the video-buffer.
* @param video The destination pointer (video-buffer).
* @param x The x position within video-buffer.
* @param y The y position within video-buffer.
* @param colours A 8bpp colour mapping buffer.
* @param width The length of the line.
*/
virtual void SetLine(void *video, int x, int y, uint8 *colours, uint width) = 0;
/**
* Draw a sequence of pixels on the video-buffer (no LookupColourInPalette).
* @param video The destination pointer (video-buffer).
* @param x The x position within video-buffer.
* @param y The y position within video-buffer.
* @param colours A 32bpp colour buffer.
* @param width The length of the line.
*/
virtual void SetLine32(void *video, int x, int y, uint32 *colours, uint width) { NOT_REACHED(); };
/**
* Make a single horizontal line in a single colour on the video-buffer.
* @param video The destination pointer (video-buffer).

View File

@@ -23,6 +23,7 @@ public:
/* virtual */ Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
/* virtual */ void *MoveTo(void *video, int x, int y) { return NULL; };
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour) {};
/* virtual */ void SetLine(void *video, int x, int y, uint8 *colours, uint width) {};
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour) {};
/* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) {};
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height) {};