aboutsummaryrefslogtreecommitdiff
path: root/sys/imio/tf/imflsd.x
blob: bc12f5b5f2c3ce21966fccb6b0062cc7a97da388 (plain) (blame)
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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<imhdr.h>
include	<imio.h>

# IMFLS? -- Flush the output buffer, if necessary.  Convert the datatype
# of the pixels upon output, if the datatype of the pixels in the imagefile
# is different than that requested by the calling program.

procedure imflsd (imdes)

pointer	imdes
pointer	bdes, bp
errchk	imflsh

begin
	# Ignore the flush request if the output buffer has already been
	# flushed.

	if (IM_FLUSH(imdes) == YES) {
	    bdes = IM_OBDES(imdes)
	    bp = BD_BUFPTR(bdes)

	    # Convert datatype of pixels, if necessary, and flush buffer.
	    if (IM_PIXTYPE(imdes) != TY_DOUBLE || SZ_INT != SZ_INT32) {
		call impakd (Memc[bp], Memc[bp], BD_NPIX(bdes),
		    IM_PIXTYPE(imdes))
	    }

	    call imflsh (imdes, bp, BD_VS(bdes,1), BD_VE(bdes,1), BD_NDIM(bdes))

	    IM_FLUSH(imdes) = NO
	}
end