/* * Close down the graphics processing. This gets called only at driver * termination time. */ #include #include #include #include #ifdef __MINGW32__ #include #else #include #endif #include #include "pngdriver.h" static void unmap_file(void) { size_t size = HEADER_SIZE + png.width * png.height * sizeof(unsigned int); void *ptr = (char *)png.grid - HEADER_SIZE; if (!png.mapped) return; #ifdef __MINGW32__ UnmapViewOfFile(ptr); CloseHandle(png.handle); #else munmap(ptr, size); #endif png.mapped = 0; } void PNG_Graph_close(void) { write_image(); if (png.mapped) unmap_file(); else G_free(png.grid); }