mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r10201) -Codechange: Replace Blitter::SetHorizontalLine with Blitter::DrawRect, as the former was only used by the rectangle drawing code anyway. This lets us draw rectangles in one go.
This commit is contained in:
parent
b09431478d
commit
c31ff284c3
|
@ -18,15 +18,18 @@ void Blitter_32bppBase::SetPixelIfEmpty(void *video, int x, int y, uint8 color)
|
|||
if (*dst == 0) *dst = LookupColourInPalette(color);
|
||||
}
|
||||
|
||||
void Blitter_32bppBase::SetHorizontalLine(void *video, int width, uint8 color)
|
||||
void Blitter_32bppBase::DrawRect(void *video, int width, int height, uint8 color)
|
||||
{
|
||||
uint32 *dst = (uint32 *)video;
|
||||
uint32 color32 = LookupColourInPalette(color);
|
||||
|
||||
for (; width > 0; width--) {
|
||||
*dst = color32;
|
||||
dst++;
|
||||
}
|
||||
do {
|
||||
uint32 *dst = (uint32 *)video;
|
||||
for (int i = width; i > 0; i--) {
|
||||
*dst = color32;
|
||||
dst++;
|
||||
}
|
||||
video = (uint32 *)video + _screen.pitch;
|
||||
} while (--height);
|
||||
}
|
||||
|
||||
void Blitter_32bppBase::CopyFromBuffer(void *video, const void *src, int width, int height, int src_pitch)
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
/* virtual */ void *MoveTo(const void *video, int x, int y);
|
||||
/* virtual */ void SetPixel(void *video, int x, int y, uint8 color);
|
||||
/* virtual */ void SetPixelIfEmpty(void *video, int x, int y, uint8 color);
|
||||
/* virtual */ void SetHorizontalLine(void *video, int width, uint8 color);
|
||||
/* virtual */ void DrawRect(void *video, int width, int height, uint8 color);
|
||||
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height, int src_pitch);
|
||||
/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height, int dst_pitch);
|
||||
/* virtual */ void MoveBuffer(void *video_dst, const void *video_src, int width, int height);
|
||||
|
|
|
@ -28,9 +28,12 @@ void Blitter_8bppBase::SetPixelIfEmpty(void *video, int x, int y, uint8 color)
|
|||
if (*dst == 0) *dst = color;
|
||||
}
|
||||
|
||||
void Blitter_8bppBase::SetHorizontalLine(void *video, int width, uint8 color)
|
||||
void Blitter_8bppBase::DrawRect(void *video, int width, int height, uint8 color)
|
||||
{
|
||||
memset(video, color, width);
|
||||
do {
|
||||
memset(video, color, width);
|
||||
video = (uint8 *)video + _screen.pitch;
|
||||
} while (--height);
|
||||
}
|
||||
|
||||
void Blitter_8bppBase::CopyFromBuffer(void *video, const void *src, int width, int height, int src_pitch)
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
/* virtual */ void *MoveTo(const void *video, int x, int y);
|
||||
/* virtual */ void SetPixel(void *video, int x, int y, uint8 color);
|
||||
/* virtual */ void SetPixelIfEmpty(void *video, int x, int y, uint8 color);
|
||||
/* virtual */ void SetHorizontalLine(void *video, int width, uint8 color);
|
||||
/* virtual */ void DrawRect(void *video, int width, int height, uint8 color);
|
||||
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height, int src_pitch);
|
||||
/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height, int dst_pitch);
|
||||
/* virtual */ void MoveBuffer(void *video_dst, const void *video_src, int width, int height);
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
* @param width The lenght of the line.
|
||||
* @param color A 8bpp mapping color.
|
||||
*/
|
||||
virtual void SetHorizontalLine(void *video, int width, uint8 color) = 0;
|
||||
virtual void DrawRect(void *video, int width, int height, uint8 color) = 0;
|
||||
|
||||
/**
|
||||
* Copy from a buffer to the screen.
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
/* virtual */ void *MoveTo(const void *video, int x, int y) { return NULL; };
|
||||
/* virtual */ void SetPixel(void *video, int x, int y, uint8 color) {};
|
||||
/* virtual */ void SetPixelIfEmpty(void *video, int x, int y, uint8 color) {};
|
||||
/* virtual */ void SetHorizontalLine(void *video, int width, uint8 color) {};
|
||||
/* virtual */ void DrawRect(void *video, int width, int height, uint8 color) {};
|
||||
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height, int src_pitch) {};
|
||||
/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) {};
|
||||
/* virtual */ void MoveBuffer(void *video_dst, const void *video_src, int width, int height) {};
|
||||
|
|
|
@ -148,10 +148,7 @@ void GfxFillRect(int left, int top, int right, int bottom, int color)
|
|||
|
||||
if (!HASBIT(color, PALETTE_MODIFIER_GREYOUT)) {
|
||||
if (!HASBIT(color, USE_COLORTABLE)) {
|
||||
do {
|
||||
blitter->SetHorizontalLine(dst, right, (uint8)color);
|
||||
dst = blitter->MoveTo(dst, 0, 1);
|
||||
} while (--bottom);
|
||||
blitter->DrawRect(dst, right, bottom, (uint8)color);
|
||||
} else {
|
||||
blitter->DrawColorMappingRect(dst, right, bottom, GB(color, 0, PALETTE_WIDTH));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue