summaryrefslogtreecommitdiff
path: root/src/blitter/32bpp_base.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-06-18 18:45:12 +0000
committerpeter1138 <peter1138@openttd.org>2007-06-18 18:45:12 +0000
commitc31ff284c321be86dcd3e4640f11b4e82a6c7cb4 (patch)
treed94c7db55a9657361ab8c1de68448e9e70965bab /src/blitter/32bpp_base.cpp
parentb09431478d416ceb58f9676d67c1cc3b4af397bc (diff)
downloadopenttd-c31ff284c321be86dcd3e4640f11b4e82a6c7cb4.tar.xz
(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.
Diffstat (limited to 'src/blitter/32bpp_base.cpp')
-rw-r--r--src/blitter/32bpp_base.cpp15
1 files changed, 9 insertions, 6 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)