src/screenshot.cpp
changeset 5609 dc6a58930ba4
parent 5587 167d9a91ef02
child 6247 7d81e3a5d803
--- a/src/screenshot.cpp	Thu Jan 11 15:30:35 2007 +0000
+++ b/src/screenshot.cpp	Thu Jan 11 17:29:39 2007 +0000
@@ -68,7 +68,6 @@
 	BitmapFileHeader bfh;
 	BitmapInfoHeader bih;
 	RgbQuad rq[256];
-	Pixel *buff;
 	FILE *f;
 	uint i, padw;
 	uint n, maxlines;
@@ -119,7 +118,7 @@
 	maxlines = clamp(65536 / padw, 16, 128);
 
 	// now generate the bitmap bits
-	MallocT(&buff, padw * maxlines); // by default generate 128 lines at a time.
+	Pixel *buff = MallocT<Pixel>(padw * maxlines); // by default generate 128 lines at a time.
 	if (buff == NULL) {
 		fclose(f);
 		return false;
@@ -170,7 +169,6 @@
 static bool MakePNGImage(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette)
 {
 	png_color rq[256];
-	Pixel *buff;
 	FILE *f;
 	uint i, y, n;
 	uint maxlines;
@@ -226,7 +224,7 @@
 	maxlines = clamp(65536 / w, 16, 128);
 
 	// now generate the bitmap bits
-	MallocT(&buff, w * maxlines); // by default generate 128 lines at a time.
+	Pixel *buff = MallocT<Pixel>(w * maxlines); // by default generate 128 lines at a time.
 	if (buff == NULL) {
 		png_destroy_write_struct(&png_ptr, &info_ptr);
 		fclose(f);
@@ -283,7 +281,6 @@
 
 static bool MakePCXImage(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette)
 {
-	Pixel *buff;
 	FILE *f;
 	uint maxlines;
 	uint y;
@@ -323,7 +320,7 @@
 	maxlines = clamp(65536 / w, 16, 128);
 
 	// now generate the bitmap bits
-	MallocT(&buff, w * maxlines); // by default generate 128 lines at a time.
+	Pixel *buff = MallocT<Pixel>(w * maxlines); // by default generate 128 lines at a time.
 	if (buff == NULL) {
 		fclose(f);
 		return false;