[Scummvm-cvs-logs] CVS: scummvm/graphics surface.cpp,1.6,1.7 surface.h,1.7,1.8
Max Horn
fingolfin at users.sourceforge.net
Sun May 8 14:25:36 CEST 2005
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm/insane insane.cpp,1.58,1.59 insane_ben.cpp,1.24,1.25 insane_enemy.cpp,1.18,1.19 insane_scenes.cpp,1.27,1.28
- Next message: [Scummvm-cvs-logs] CVS: scummvm/common system.h,1.98,1.99
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/graphics
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22728
Modified Files:
surface.cpp surface.h
Log Message:
Added convenience methods create/free to Graphics::Surface (part of patch #1163026)
Index: surface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/surface.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- surface.cpp 8 May 2005 12:33:55 -0000 1.6
+++ surface.cpp 8 May 2005 21:24:33 -0000 1.7
@@ -46,6 +46,25 @@
error("Surface::drawLine: bytesPerPixel must be 1 or 2");
}
+void Surface::create(uint16 width, uint16 height, uint8 bytesPP) {
+ free();
+
+ w = width;
+ h = height;
+ bytesPerPixel = bytesPP;
+ pitch = w * bytesPP;
+
+ pixels = calloc(width * height, bytesPP);
+ assert(pixels);
+}
+
+void Surface::free() {
+ ::free(pixels);
+ pixels = 0;
+ w = h = pitch = 0;
+ bytesPerPixel = 0;
+}
+
void Surface::hLine(int x, int y, int x2, uint32 color) {
// Clipping
if (y < 0 || y >= h)
Index: surface.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/surface.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- surface.h 8 May 2005 12:33:55 -0000 1.7
+++ surface.h 8 May 2005 21:24:33 -0000 1.8
@@ -47,6 +47,17 @@
return static_cast<void *>(static_cast<byte *>(pixels) + y * pitch + x * bytesPerPixel);
}
+ /**
+ * Allocate pixels memory for this surface and for the specified dimension.
+ */
+ void create(uint16 width, uint16 height, uint8 bytesPP);
+
+ /**
+ * Release the memory used by the pixels memory of this surface. This is the
+ * counterpart to create().
+ */
+ void free();
+
void drawLine(int x0, int y0, int x1, int y1, uint32 color);
void hLine(int x, int y, int x2, uint32 color);
void vLine(int x, int y, int y2, uint32 color);
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm/insane insane.cpp,1.58,1.59 insane_ben.cpp,1.24,1.25 insane_enemy.cpp,1.18,1.19 insane_scenes.cpp,1.27,1.28
- Next message: [Scummvm-cvs-logs] CVS: scummvm/common system.h,1.98,1.99
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list