aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorMax Horn2004-11-25 23:51:58 +0000
committerMax Horn2004-11-25 23:51:58 +0000
commitb3e5b875da37acb0436b8169075c0e9fada36aaa (patch)
treeb74290a4d90b417ac8b32a4a570bb0ac39222bfb /graphics
parente1cc9b9e591b1b29c1fa27a7d97cdb910aedf744 (diff)
downloadscummvm-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.cpp9
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) {