45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright © 2000 Keith Packard
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Permission to use, copy, modify, distribute, and sell this software and its
45e9809aff7304721fddb95654901b32195c9c7avboxsync * documentation for any purpose is hereby granted without fee, provided that
45e9809aff7304721fddb95654901b32195c9c7avboxsync * the above copyright notice appear in all copies and that both that
45e9809aff7304721fddb95654901b32195c9c7avboxsync * copyright notice and this permission notice appear in supporting
45e9809aff7304721fddb95654901b32195c9c7avboxsync * documentation, and that the name of Keith Packard not be used in
45e9809aff7304721fddb95654901b32195c9c7avboxsync * advertising or publicity pertaining to distribution of the software without
45e9809aff7304721fddb95654901b32195c9c7avboxsync * specific, written prior permission. Keith Packard makes no
45e9809aff7304721fddb95654901b32195c9c7avboxsync * representations about the suitability of this software for any purpose. It
45e9809aff7304721fddb95654901b32195c9c7avboxsync * is provided "as is" without express or implied warranty.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
45e9809aff7304721fddb95654901b32195c9c7avboxsync * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
45e9809aff7304721fddb95654901b32195c9c7avboxsync * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync * PERFORMANCE OF THIS SOFTWARE.
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifndef _SHADOW_H_
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define _SHADOW_H_
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include "scrnintstr.h"
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef RENDER
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include "picturestr.h"
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include "damage.h"
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include "damagestr.h"
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef struct _shadowBuf *shadowBufPtr;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef void (*ShadowUpdateProc) (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define SHADOW_WINDOW_RELOCATE 1
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define SHADOW_WINDOW_READ 2
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define SHADOW_WINDOW_WRITE 4
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef void *(*ShadowWindowProc) (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync CARD32 row,
45e9809aff7304721fddb95654901b32195c9c7avboxsync CARD32 offset,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int mode,
45e9809aff7304721fddb95654901b32195c9c7avboxsync CARD32 *size,
45e9809aff7304721fddb95654901b32195c9c7avboxsync void *closure);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* BC hack: do not move the damage member. see shadow.c for explanation. */
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef struct _shadowBuf {
45e9809aff7304721fddb95654901b32195c9c7avboxsync DamagePtr pDamage;
45e9809aff7304721fddb95654901b32195c9c7avboxsync ShadowUpdateProc update;
45e9809aff7304721fddb95654901b32195c9c7avboxsync ShadowWindowProc window;
45e9809aff7304721fddb95654901b32195c9c7avboxsync RegionRec damage;
45e9809aff7304721fddb95654901b32195c9c7avboxsync PixmapPtr pPixmap;
45e9809aff7304721fddb95654901b32195c9c7avboxsync void *closure;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int randr;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync /* screen wrappers */
45e9809aff7304721fddb95654901b32195c9c7avboxsync GetImageProcPtr GetImage;
45e9809aff7304721fddb95654901b32195c9c7avboxsync CloseScreenProcPtr CloseScreen;
45e9809aff7304721fddb95654901b32195c9c7avboxsync} shadowBufRec;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Match defines from randr extension */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define SHADOW_ROTATE_0 1
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define SHADOW_ROTATE_90 2
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define SHADOW_ROTATE_180 4
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define SHADOW_ROTATE_270 8
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define SHADOW_ROTATE_ALL (SHADOW_ROTATE_0|SHADOW_ROTATE_90|\
45e9809aff7304721fddb95654901b32195c9c7avboxsync SHADOW_ROTATE_180|SHADOW_ROTATE_270)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define SHADOW_REFLECT_X 16
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define SHADOW_REFLECT_Y 32
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define SHADOW_REFLECT_ALL (SHADOW_REFLECT_X|SHADOW_REFLECT_Y)
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern int shadowScrPrivateIndex;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define shadowGetBuf(pScr) ((shadowBufPtr) (pScr)->devPrivates[shadowScrPrivateIndex].ptr)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define shadowBuf(pScr) shadowBufPtr pBuf = shadowGetBuf(pScr)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define shadowDamage(pBuf) DamageRegion(pBuf->pDamage)
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncBool
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowSetup (ScreenPtr pScreen);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncBool
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowAdd (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync PixmapPtr pPixmap,
45e9809aff7304721fddb95654901b32195c9c7avboxsync ShadowUpdateProc update,
45e9809aff7304721fddb95654901b32195c9c7avboxsync ShadowWindowProc window,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int randr,
45e9809aff7304721fddb95654901b32195c9c7avboxsync void *closure);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowRemove (ScreenPtr pScreen, PixmapPtr pPixmap);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowBufPtr
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowFindBuf (WindowPtr pWindow);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncBool
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowInit (ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid *
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowAlloc (int width, int height, int bpp);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdatePacked (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdatePlanar4 (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdatePlanar4x8 (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateRotatePacked (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateRotate8_90 (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateRotate16_90 (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateRotate16_90YX (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateRotate32_90 (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateRotate8_180 (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateRotate16_180 (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateRotate32_180 (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateRotate8_270 (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateRotate16_270 (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateRotate16_270YX (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateRotate32_270 (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateRotate8 (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateRotate16 (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateRotate32 (ScreenPtr pScreen,
45e9809aff7304721fddb95654901b32195c9c7avboxsync shadowBufPtr pBuf);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef void (* shadowUpdateProc)(ScreenPtr, shadowBufPtr);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateProc shadowUpdatePackedWeak(void);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateProc shadowUpdatePlanar4Weak(void);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateProc shadowUpdatePlanar4x8Weak(void);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncshadowUpdateProc shadowUpdateRotatePackedWeak(void);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* _SHADOW_H_ */