Changeset - r6947:c5e531edca92
[Not reviewed]
master
0 7 0
peter1138 - 17 years ago 2007-06-18 18:45:12
peter1138@openttd.org
(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.
7 files changed with 19 insertions and 16 deletions:
0 comments (0 inline, 0 general)
src/blitter/32bpp_base.cpp
Show inline comments
 
@@ -18,15 +18,18 @@ void Blitter_32bppBase::SetPixelIfEmpty(
 
	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)
src/blitter/32bpp_base.hpp
Show inline comments
 
@@ -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);
src/blitter/8bpp_base.cpp
Show inline comments
 
@@ -28,9 +28,12 @@ void Blitter_8bppBase::SetPixelIfEmpty(v
 
	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)
src/blitter/8bpp_base.hpp
Show inline comments
 
@@ -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);
src/blitter/base.hpp
Show inline comments
 
@@ -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.
src/blitter/null.hpp
Show inline comments
 
@@ -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) {};
src/gfx.cpp
Show inline comments
 
@@ -148,10 +148,7 @@ void GfxFillRect(int left, int top, int 
 

	
 
	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));
 
		}
0 comments (0 inline, 0 general)