summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/blitter/32bpp_base.cpp15
-rw-r--r--src/blitter/32bpp_base.hpp2
-rw-r--r--src/blitter/8bpp_base.cpp7
-rw-r--r--src/blitter/8bpp_base.hpp2
-rw-r--r--src/blitter/base.hpp2
-rw-r--r--src/blitter/null.hpp2
-rw-r--r--src/gfx.cpp5
7 files changed, 19 insertions, 16 deletions
diff --git a/src/blitter/32bpp_base.cpp b/src/blitter/32bpp_base.cpp
index 3f02c0886..6862e2907 100644
--- a/src/blitter/32bpp_base.cpp
+++ b/src/blitter/32bpp_base.cpp
@@ -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)
diff --git a/src/blitter/32bpp_base.hpp b/src/blitter/32bpp_base.hpp
index 6ba6ac534..aaa68ef38 100644
--- a/src/blitter/32bpp_base.hpp
+++ b/src/blitter/32bpp_base.hpp
@@ -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);
diff --git a/src/blitter/8bpp_base.cpp b/src/blitter/8bpp_base.cpp
index 48ff3d547..486d7a190 100644
--- a/src/blitter/8bpp_base.cpp
+++ b/src/blitter/8bpp_base.cpp
@@ -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)
diff --git a/src/blitter/8bpp_base.hpp b/src/blitter/8bpp_base.hpp
index 536a6c984..63b28d200 100644
--- a/src/blitter/8bpp_base.hpp
+++ b/src/blitter/8bpp_base.hpp
@@ -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);
diff --git a/src/blitter/base.hpp b/src/blitter/base.hpp
index abc886a22..79a0895f9 100644
--- a/src/blitter/base.hpp
+++ b/src/blitter/base.hpp
@@ -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.
diff --git a/src/blitter/null.hpp b/src/blitter/null.hpp
index 130855998..b3bbe2212 100644
--- a/src/blitter/null.hpp
+++ b/src/blitter/null.hpp
@@ -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) {};
diff --git a/src/gfx.cpp b/src/gfx.cpp
index d34aae7a0..f5f381e62 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -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));
}