1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
/*
* Close down the graphics processing. This gets called only at driver
* termination time.
*/
#ifndef __MINGW32__
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#endif
#include <grass/gis.h>
#include "pngdriver.h"
static void unmap_file(void)
{
#ifndef __MINGW32__
size_t size = HEADER_SIZE + width * height * sizeof(unsigned int);
void *ptr = (char *)grid - HEADER_SIZE;
if (!mapped)
return;
munmap(ptr, size);
mapped = 0;
#endif
}
void PNG_Graph_close(void)
{
write_image();
if (mapped)
unmap_file();
else
G_free(grid);
}
|