10 struct RrSurface *sur;
17 #define MERGE_AREA(a, x, y, w, h) \
18 a->w = MAX(a->x + a->w - 1, x + w - 1) - MIN(a->x, x), \
19 a->h = MAX(a->y + a->h - 1, y + h - 1) - MIN(a->y, y), \
20 a->x = MIN(a->x, x), \
24 void RrExpose(struct RrInstance *inst, XExposeEvent *e)
27 struct RrSurface *sur;
32 if ((sur = RrInstaceLookupSurface(inst, win))) {
33 while (XCheckTypedWindowEvent(RrDisplay(inst), Expose, win, &e2));
34 while (sur->parent && RrSurfaceType(sur->parent) != RR_SURFACE_NONE)
38 RrDebug("Unable to find surface for window 0x%lx\n", win);
41 /*! Paints the surface, and all its children */
42 void RrPaint(struct RrSurface *sur)
44 struct RrInstance *inst;
50 inst = RrSurfaceInstance(sur);
52 /* can't paint a prototype! */
56 if (!RrSurfaceVisible(sur)) return;
58 /* recurse and paint children */
59 for (it = RrSurfaceChildren(sur); it; it = g_slist_next(it))
62 RrDebug("making %p, %p, %p current\n",
63 RrDisplay(inst), RrSurfaceWindow(sur), RrContext(inst));
65 ok = glXMakeCurrent(RrDisplay(inst), RrSurfaceWindow(sur),RrContext(inst));
68 glMatrixMode(GL_MODELVIEW);
70 glMatrixMode(GL_PROJECTION);
73 glOrtho(0, RrScreenWidth(inst), RrScreenHeight(inst), 0, 0, 10);
74 glViewport(0, 0, RrScreenWidth(inst), RrScreenHeight(inst));
75 glMatrixMode(GL_MODELVIEW);
76 glTranslatef(-RrSurfaceX(sur),
77 RrScreenHeight(inst)-RrSurfaceHeight(sur)-RrSurfaceY(sur), 0);
78 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
83 surx += RrSurfaceX(p);
84 sury += RrSurfaceY(p);
88 switch (RrSurfaceType(sur)) {
89 case RR_SURFACE_PLANAR:
90 RrPlanarPaint(sur, surx, sury);
92 case RR_SURFACE_NONPLANAR:
99 glXSwapBuffers(RrDisplay(inst), RrSurfaceWindow(sur));