MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / XCopyArea

Function XCopyArea

server/faker-x11.cpp:88–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86// We have to override this function in order to handle GLX pixmap rendering
87
88int XCopyArea(Display *dpy, Drawable src, Drawable dst, GC gc, int src_x,
89 int src_y, unsigned int width, unsigned int height, int dest_x, int dest_y)
90{
91 TRY();
92
93 if(IS_EXCLUDED(dpy))
94 return _XCopyArea(dpy, src, dst, gc, src_x, src_y, width, height, dest_x,
95 dest_y);
96
97 DISABLE_FAKER();
98
99 faker::VirtualDrawable *srcVW = NULL, *dstVW = NULL;
100 bool srcWin = false, dstWin = false;
101 bool copy2d = true, copy3d = false, triggerRB = false;
102 GLXDrawable glxsrc = 0, glxdst = 0;
103
104 if(src == 0 || dst == 0) return BadDrawable;
105
106 /////////////////////////////////////////////////////////////////////////////
107 OPENTRACE(XCopyArea); PRARGD(dpy); PRARGX(src); PRARGX(dst); PRARGX(gc);
108 PRARGI(src_x); PRARGI(src_y); PRARGI(width); PRARGI(height);
109 PRARGI(dest_x); PRARGI(dest_y); STARTTRACE();
110 /////////////////////////////////////////////////////////////////////////////
111
112 if(!(srcVW = (faker::VirtualDrawable *)PMHASH.find(dpy, src)))
113 {
114 srcVW = (faker::VirtualDrawable *)WINHASH.find(dpy, src);
115 if(srcVW) srcWin = true;
116 }
117 if(srcVW && !srcVW->isInit())
118 {
119 // If the 3D drawable hasn't been made current yet, then its contents will
120 // be identical to the corresponding 2D drawable
121 srcVW = NULL;
122 srcWin = false;
123 }
124 if(!(dstVW = (faker::VirtualDrawable *)PMHASH.find(dpy, dst)))
125 {
126 dstVW = (faker::VirtualDrawable *)WINHASH.find(dpy, dst);
127 if(dstVW) dstWin = true;
128 }
129 if(dstVW && !dstVW->isInit())
130 {
131 dstVW = NULL;
132 dstWin = false;
133 }
134
135 // GLX (3D) Pixmap --> non-GLX (2D) drawable
136 // Sync pixels from the 3D pixmap (on the 3D X Server) to the corresponding
137 // 2D pixmap (on the 2D X Server) and let the "real" XCopyArea() do the rest.
138 if(srcVW && !srcWin && !dstVW)
139 ((faker::VirtualPixmap *)srcVW)->readback();
140
141 // non-GLX (2D) drawable --> non-GLX (2D) drawable
142 // Source and destination are not backed by a drawable on the 3D X Server, so
143 // defer to the real XCopyArea() function.
144 //
145 // non-GLX (2D) drawable --> GLX (3D) drawable

Callers 8

offScreenTestFunction · 0.85
maskMethod · 0.85
draw_fixedMethod · 0.85
copy_offscreenMethod · 0.85
scrollMethod · 0.85
fbx_writeFunction · 0.85
fbx_syncFunction · 0.85

Calls 5

isInitMethod · 0.80
copyPixelsMethod · 0.80
findMethod · 0.45
readbackMethod · 0.45
getGLXDrawableMethod · 0.45

Tested by

no test coverage detected