b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Copyright © 2004 Eric Anholt
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync *
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Permission to use, copy, modify, distribute, and sell this software and its
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * documentation for any purpose is hereby granted without fee, provided that
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * the above copyright notice appear in all copies and that both that
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * copyright notice and this permission notice appear in supporting
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * documentation, and that the name of Eric Anholt not be used in
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * advertising or publicity pertaining to distribution of the software without
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * specific, written prior permission. Eric Anholt makes no
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * representations about the suitability of this software for any purpose. It
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * is provided "as is" without express or implied warranty.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync *
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * PERFORMANCE OF THIS SOFTWARE.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* $Header: /cvs/xorg/xc/programs/Xserver/miext/cw/cw.h,v 1.13 2005/10/02 08:28:26 anholt Exp $ */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifdef HAVE_DIX_CONFIG_H
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#include <dix-config.h>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#include "gcstruct.h"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#include "picturestr.h"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * One of these structures is allocated per GC that gets used with a window with
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * backing pixmap.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync GCPtr pBackingGC; /* Copy of the GC but with graphicsExposures
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * set FALSE and the clientClip set to
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * clip output to the valid regions of the
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * backing pixmap. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned long serialNumber; /* clientClip computed time */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned long stateChanges; /* changes in parent gc since last copy */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync GCOps *wrapOps; /* wrapped ops */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync GCFuncs *wrapFuncs; /* wrapped funcs */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} cwGCRec, *cwGCPtr;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int cwGCIndex;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define getCwGC(pGC) ((cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define setCwGC(pGC,p) ((pGC)->devPrivates[cwGCIndex].ptr = (pointer) (p))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * One of these structures is allocated per Picture that gets used with a
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * window with a backing pixmap
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync PicturePtr pBackingPicture;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned long serialNumber;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned long stateChanges;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} cwPictureRec, *cwPicturePtr;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define getCwPicture(pPicture) \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (pPicture->pDrawable ? (cwPicturePtr)(pPicture)->devPrivates[cwPictureIndex].ptr : 0)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define setCwPicture(pPicture,p) ((pPicture)->devPrivates[cwPictureIndex].ptr = (pointer) (p))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int cwPictureIndex;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int cwWindowIndex;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define cwWindowPrivate(pWindow) ((pWindow)->devPrivates[cwWindowIndex].ptr)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define getCwPixmap(pWindow) ((PixmapPtr) cwWindowPrivate(pWindow))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define setCwPixmap(pWindow,pPixmap) (cwWindowPrivate(pWindow) = (pointer) (pPixmap))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define cwDrawableIsRedirWindow(pDraw) \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ((pDraw)->type == DRAWABLE_WINDOW && \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync getCwPixmap((WindowPtr) (pDraw)) != NULL)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * screen func wrappers
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync CloseScreenProcPtr CloseScreen;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync GetImageProcPtr GetImage;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync GetSpansProcPtr GetSpans;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync CreateGCProcPtr CreateGC;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync PaintWindowBackgroundProcPtr PaintWindowBackground;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync PaintWindowBorderProcPtr PaintWindowBorder;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync CopyWindowProcPtr CopyWindow;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync GetWindowPixmapProcPtr GetWindowPixmap;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync SetWindowPixmapProcPtr SetWindowPixmap;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifdef RENDER
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DestroyPictureProcPtr DestroyPicture;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ChangePictureClipProcPtr ChangePictureClip;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DestroyPictureClipProcPtr DestroyPictureClip;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ChangePictureProcPtr ChangePicture;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ValidatePictureProcPtr ValidatePicture;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync CompositeProcPtr Composite;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync GlyphsProcPtr Glyphs;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync CompositeRectsProcPtr CompositeRects;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync TrapezoidsProcPtr Trapezoids;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync TrianglesProcPtr Triangles;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync TriStripProcPtr TriStrip;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync TriFanProcPtr TriFan;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync RasterizeTrapezoidProcPtr RasterizeTrapezoid;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} cwScreenRec, *cwScreenPtr;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int cwScreenIndex;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define getCwScreen(pScreen) ((cwScreenPtr)(pScreen)->devPrivates[cwScreenIndex].ptr)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define setCwScreen(pScreen,p) ((cwScreenPtr)(pScreen)->devPrivates[cwScreenIndex].ptr = (p))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define CW_OFFSET_XYPOINTS(ppt, npt) do { \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DDXPointPtr _ppt = (DDXPointPtr)(ppt); \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int _i; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync for (_i = 0; _i < npt; _i++) { \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync _ppt[_i].x += dst_off_x; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync _ppt[_i].y += dst_off_y; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync } \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} while (0)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define CW_OFFSET_RECTS(prect, nrect) do { \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int _i; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync for (_i = 0; _i < nrect; _i++) { \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (prect)[_i].x += dst_off_x; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (prect)[_i].y += dst_off_y; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync } \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} while (0)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define CW_OFFSET_ARCS(parc, narc) do { \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int _i; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync for (_i = 0; _i < narc; _i++) { \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (parc)[_i].x += dst_off_x; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (parc)[_i].y += dst_off_y; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync } \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} while (0)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define CW_OFFSET_XY_DST(x, y) do { \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (x) = (x) + dst_off_x; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (y) = (y) + dst_off_y; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} while (0)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define CW_OFFSET_XY_SRC(x, y) do { \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (x) = (x) + src_off_x; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (y) = (y) + src_off_y; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} while (0)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* cw.c */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncDrawablePtr
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynccwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* cw_render.c */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynccwInitializeRender (ScreenPtr pScreen);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynccwFiniRender (ScreenPtr pScreen);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* cw.c */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncmiInitializeCompositeWrapper(ScreenPtr pScreen);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Must be called before miInitializeCompositeWrapper */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncmiDisableCompositeWrapper(ScreenPtr pScreen);