GRASS Programmer's Manual
6.4.2(2012)
|
00001 /* 00002 * Close down the graphics processing. This gets called only at driver 00003 * termination time. 00004 */ 00005 00006 #ifndef __MINGW32__ 00007 #include <unistd.h> 00008 #include <fcntl.h> 00009 #include <sys/types.h> 00010 #include <sys/stat.h> 00011 #include <sys/mman.h> 00012 #endif 00013 00014 #include <grass/gis.h> 00015 #include "pngdriver.h" 00016 00017 static void unmap_file(void) 00018 { 00019 #ifndef __MINGW32__ 00020 size_t size = HEADER_SIZE + width * height * sizeof(unsigned int); 00021 void *ptr = (char *)grid - HEADER_SIZE; 00022 00023 if (!mapped) 00024 return; 00025 00026 munmap(ptr, size); 00027 00028 mapped = 0; 00029 #endif 00030 } 00031 00032 void PNG_Graph_close(void) 00033 { 00034 write_image(); 00035 00036 if (mapped) 00037 unmap_file(); 00038 else 00039 G_free(grid); 00040 }