GRASS GIS 7 Programmer's Manual
7.0.5(2016)-r00000
pngdriver/graph_close.c
Go to the documentation of this file.
1
15
#include <unistd.h>
16
#include <fcntl.h>
17
#include <sys/types.h>
18
#include <sys/stat.h>
19
#ifdef __MINGW32__
20
#include <windows.h>
21
#else
22
#include <sys/mman.h>
23
#endif
24
25
#include <grass/gis.h>
26
#include "
pngdriver.h
"
27
28
static
void
unmap_file(
void
)
29
{
30
size_t
size =
HEADER_SIZE
+
png
.
width
*
png
.
height
*
sizeof
(
unsigned
int);
31
void
*ptr = (
char
*)
png
.
grid
-
HEADER_SIZE
;
32
33
if
(!
png
.
mapped
)
34
return
;
35
36
#ifdef __MINGW32__
37
UnmapViewOfFile(ptr);
38
CloseHandle(
png
.handle);
39
#else
40
munmap(ptr, size);
41
#endif
42
43
png
.
mapped
= 0;
44
}
45
50
void
PNG_Graph_close
(
void
)
51
{
52
write_image
();
53
54
if
(
png
.
mapped
)
55
unmap_file();
56
else
57
G_free
(
png
.
grid
);
58
}
HEADER_SIZE
#define HEADER_SIZE
Definition:
cairodriver.h:45
png_state::width
int width
Definition:
pngdriver.h:43
pngdriver.h
GRASS png display driver - header file.
png_state::height
int height
Definition:
pngdriver.h:43
png
struct png_state png
Definition:
pngdriver/graph_set.c:32
png_state::mapped
int mapped
Definition:
pngdriver.h:37
write_image
void write_image(void)
Definition:
pngdriver/write.c:22
png_state::grid
unsigned int * grid
Definition:
pngdriver.h:44
if
if(!DBFLoadRecord(psDBF, hEntity)) return NULL
PNG_Graph_close
void PNG_Graph_close(void)
Close down the graphics processing. This gets called only at driver termination time.
Definition:
pngdriver/graph_close.c:50
G_free
void G_free(void *buf)
Free allocated memory.
Definition:
alloc.c:149
pngdriver
graph_close.c
Generated on Thu Oct 13 2016 05:31:23 for GRASS GIS 7 Programmer's Manual by
1.8.12