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