diff options
author | Max Horn | 2004-11-25 23:51:58 +0000 |
---|---|---|
committer | Max Horn | 2004-11-25 23:51:58 +0000 |
commit | b3e5b875da37acb0436b8169075c0e9fada36aaa (patch) | |
tree | b74290a4d90b417ac8b32a4a570bb0ac39222bfb /graphics | |
parent | e1cc9b9e591b1b29c1fa27a7d97cdb910aedf744 (diff) | |
download | scummvm-rg350-b3e5b875da37acb0436b8169075c0e9fada36aaa.tar.gz scummvm-rg350-b3e5b875da37acb0436b8169075c0e9fada36aaa.tar.bz2 scummvm-rg350-b3e5b875da37acb0436b8169075c0e9fada36aaa.zip |
Small optimization
svn-id: r15889
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/surface.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/graphics/surface.cpp b/graphics/surface.cpp index 44054172a1..afd47e9d29 100644 --- a/graphics/surface.cpp +++ b/graphics/surface.cpp @@ -39,9 +39,8 @@ void Surface::hLine(int x, int y, int x2, uint32 color) const { if (bytesPerPixel == 1) { byte *ptr = (byte *)getBasePtr(x, y); - while (x++ <= x2) { - *ptr++ = (byte)color; - } + if (x2 >= x) + memset(ptr, (byte)color, x2-x+1); } else if (bytesPerPixel == 2) { uint16 *ptr = (uint16 *)getBasePtr(x, y); while (x++ <= x2) { @@ -96,9 +95,7 @@ void Surface::fillRect(const Common::Rect &rOld, uint32 color) const { if (bytesPerPixel == 1) { byte *ptr = (byte *)getBasePtr(r.left, r.top); while (height--) { - for (i = 0; i < width; i++) { - ptr[i] = (byte)color; - } + memset(ptr, (byte)color, width); ptr += pitch; } } else if (bytesPerPixel == 2) { |