File: imgbuff.H

package info (click to toggle)
xjig 2.4-14.1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 892 kB
  • sloc: cpp: 10,177; makefile: 1,142; perl: 23
file content (42 lines) | stat: -rw-r--r-- 882 bytes parent folder | download | duplicates (9)
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
41
42

#ifndef _imgbuff_h
#define _imgbuff_h

#ifdef USE_MIT_SHM
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h>
#endif

class ImageBuffer {
	public:
		ImageBuffer();
		~ImageBuffer();

		XImage *Init(int w, int h, int bpp8);
		XImage *GetXImage()		{ return ximage; }

		void PutImage(Display *dpy,Drawable d,GC gc,int src_x, int src_y, int dest_x, int dest_y, unsigned int w, unsigned int h) {
#ifdef USE_MIT_SHM
			if (shm) {
					XShmPutImage(dpy,d,gc,ximage,src_x,src_y,dest_x,dest_y,w,h,False);
					XSync(dpy,0);
			}
			else
#endif
					XPutImage(dpy,d,gc,ximage,src_x,src_y,dest_x,dest_y,w,h); }

	private:
		void AllocData(int w,int h,int bpp8);
		void FreeData();

		XImage				*ximage;
		int					width, height;

#ifdef USE_MIT_SHM
		int					shm;				// flag, if shared memory is in use
		XShmSegmentInfo	shminfo;			// shm information
#endif
};

#endif