diff -ur --exclude=CVS --exclude=Makefile ScummVM/graphics/surface.cpp ScummVM+hack/graphics/surface.cpp
old
|
new
|
|
20 | 20 | |
21 | 21 | #include "common/stdafx.h" |
22 | 22 | #include "common/util.h" |
| 23 | #include "graphics/primitives.h" |
23 | 24 | #include "graphics/surface.h" |
24 | 25 | |
25 | 26 | namespace Graphics { |
26 | 27 | |
| 28 | static void plotPoint(int x, int y, int color, void *data) { |
| 29 | Surface *s = (Surface *)data; |
| 30 | |
| 31 | if (s->bytesPerPixel == 1) { |
| 32 | byte *ptr = (byte *)s->getBasePtr(x, y); |
| 33 | *ptr = (byte)color; |
| 34 | } else if (s->bytesPerPixel == 2) { |
| 35 | uint16 *ptr = (uint16 *)s->getBasePtr(x, y); |
| 36 | *ptr = (uint16)color; |
| 37 | } else { |
| 38 | error("plotPoint: bytesPerPixel must be 1 or 2"); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | void Surface::drawLine(int x0, int y0, int x1, int y1, uint32 color) const { |
| 43 | Graphics::drawLine(x0, y0, x1, y1, color, &plotPoint, const_cast<Surface *>(this)); |
| 44 | } |
| 45 | |
27 | 46 | void Surface::hLine(int x, int y, int x2, uint32 color) const { |
28 | 47 | // Clipping |
29 | 48 | if (y < 0 || y >= h) |
diff -ur --exclude=CVS --exclude=Makefile ScummVM/graphics/surface.h ScummVM+hack/graphics/surface.h
old
|
new
|
|
42 | 42 | inline void *getBasePtr(int x, int y) const { |
43 | 43 | return (void *)((byte *)pixels + y * pitch + x * bytesPerPixel); |
44 | 44 | } |
45 | | |
| 45 | |
| 46 | void drawLine(int x0, int y0, int x1, int y1, uint32 color) const; |
46 | 47 | void hLine(int x, int y, int x2, uint32 color) const; |
47 | 48 | void vLine(int x, int y, int y2, uint32 color) const; |
48 | 49 | void fillRect(const Common::Rect &r, uint32 color) const; |