Skip to content

Commit

Permalink
GRAPHICS: Cleanup formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Hoops committed May 19, 2011
1 parent 1ee5ef9 commit 5fdf279
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions graphics/surface.cpp
Expand Up @@ -90,13 +90,13 @@ void Surface::hLine(int x, int y, int x2, uint32 color) {

if (format.bytesPerPixel == 1) {
byte *ptr = (byte *)getBasePtr(x, y);
memset(ptr, (byte)color, x2-x+1);
memset(ptr, (byte)color, x2 - x + 1);
} else if (format.bytesPerPixel == 2) {
uint16 *ptr = (uint16 *)getBasePtr(x, y);
Common::set_to(ptr, ptr + (x2-x+1), (uint16)color);
Common::set_to(ptr, ptr + (x2 - x + 1), (uint16)color);
} else if (format.bytesPerPixel == 4) {
uint32 *ptr = (uint32 *)getBasePtr(x, y);
Common::set_to(ptr, ptr + (x2-x+1), color);
Common::set_to(ptr, ptr + (x2 - x + 1), color);
} else {
error("Surface::hLine: bytesPerPixel must be 1, 2, or 4");
}
Expand Down Expand Up @@ -125,7 +125,7 @@ void Surface::vLine(int x, int y, int y2, uint32 color) {
uint16 *ptr = (uint16 *)getBasePtr(x, y);
while (y++ <= y2) {
*ptr = (uint16)color;
ptr += pitch/2;
ptr += pitch / 2;
}

} else if (format.bytesPerPixel == 4) {
Expand Down Expand Up @@ -157,7 +157,7 @@ void Surface::fillRect(Common::Rect r, uint32 color) {
} else if (format.bytesPerPixel == 4) {
useMemset = false;
} else if (format.bytesPerPixel != 1) {
error("Surface::fillRect: bytesPerPixel must be 1, 2 or 4");
error("Surface::fillRect: bytesPerPixel must be 1, 2, or 4");
}

if (useMemset) {
Expand All @@ -171,7 +171,7 @@ void Surface::fillRect(Common::Rect r, uint32 color) {
uint16 *ptr = (uint16 *)getBasePtr(r.left, r.top);
while (height--) {
Common::set_to(ptr, ptr + width, (uint16)color);
ptr += pitch/2;
ptr += pitch / 2;
}
} else {
uint32 *ptr = (uint32 *)getBasePtr(r.left, r.top);
Expand All @@ -184,10 +184,10 @@ void Surface::fillRect(Common::Rect r, uint32 color) {
}

void Surface::frameRect(const Common::Rect &r, uint32 color) {
hLine(r.left, r.top, r.right-1, color);
hLine(r.left, r.bottom-1, r.right-1, color);
vLine(r.left, r.top, r.bottom-1, color);
vLine(r.right-1, r.top, r.bottom-1, color);
hLine(r.left, r.top, r.right - 1, color);
hLine(r.left, r.bottom - 1, r.right - 1, color);
vLine(r.left, r.top, r.bottom - 1, color);
vLine(r.right - 1, r.top, r.bottom - 1, color);
}

void Surface::move(int dx, int dy, int height) {
Expand Down

0 comments on commit 5fdf279

Please sign in to comment.