Drop miext/shadow directory
Not used on this branch.
This commit is contained in:
parent
aa49cd5ab7
commit
be7257c5d1
|
@ -414,7 +414,6 @@ inc = include_directories(
|
|||
'glamor',
|
||||
'mi',
|
||||
'miext/damage',
|
||||
'miext/shadow',
|
||||
'miext/sync',
|
||||
'dbe',
|
||||
'dri3',
|
||||
|
@ -499,7 +498,6 @@ subdir('composite')
|
|||
subdir('damageext')
|
||||
subdir('dbe')
|
||||
subdir('miext/damage')
|
||||
subdir('miext/shadow')
|
||||
subdir('miext/sync')
|
||||
subdir('present')
|
||||
subdir('randr')
|
||||
|
|
|
@ -1,187 +0,0 @@
|
|||
/*
|
||||
* Fast C2P (Chunky-to-Planar) Conversion
|
||||
*
|
||||
* NOTES:
|
||||
* - This code was inspired by Scout's C2P tutorial
|
||||
* - It assumes to run on a big endian system
|
||||
*
|
||||
* Copyright © 2003-2008 Geert Uytterhoeven
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Basic transpose step
|
||||
*/
|
||||
|
||||
static inline void _transp(CARD32 d[], unsigned int i1, unsigned int i2,
|
||||
unsigned int shift, CARD32 mask)
|
||||
{
|
||||
CARD32 t = (d[i1] ^ (d[i2] >> shift)) & mask;
|
||||
|
||||
d[i1] ^= t;
|
||||
d[i2] ^= t << shift;
|
||||
}
|
||||
|
||||
|
||||
static inline void c2p_unsupported(void) {
|
||||
BUG_WARN(1);
|
||||
}
|
||||
|
||||
static inline CARD32 get_mask(unsigned int n)
|
||||
{
|
||||
switch (n) {
|
||||
case 1:
|
||||
return 0x55555555;
|
||||
|
||||
case 2:
|
||||
return 0x33333333;
|
||||
|
||||
case 4:
|
||||
return 0x0f0f0f0f;
|
||||
|
||||
case 8:
|
||||
return 0x00ff00ff;
|
||||
|
||||
case 16:
|
||||
return 0x0000ffff;
|
||||
}
|
||||
|
||||
c2p_unsupported();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Transpose operations on 8 32-bit words
|
||||
*/
|
||||
|
||||
static inline void transp8(CARD32 d[], unsigned int n, unsigned int m)
|
||||
{
|
||||
CARD32 mask = get_mask(n);
|
||||
|
||||
switch (m) {
|
||||
case 1:
|
||||
/* First n x 1 block */
|
||||
_transp(d, 0, 1, n, mask);
|
||||
/* Second n x 1 block */
|
||||
_transp(d, 2, 3, n, mask);
|
||||
/* Third n x 1 block */
|
||||
_transp(d, 4, 5, n, mask);
|
||||
/* Fourth n x 1 block */
|
||||
_transp(d, 6, 7, n, mask);
|
||||
return;
|
||||
|
||||
case 2:
|
||||
/* First n x 2 block */
|
||||
_transp(d, 0, 2, n, mask);
|
||||
_transp(d, 1, 3, n, mask);
|
||||
/* Second n x 2 block */
|
||||
_transp(d, 4, 6, n, mask);
|
||||
_transp(d, 5, 7, n, mask);
|
||||
return;
|
||||
|
||||
case 4:
|
||||
/* Single n x 4 block */
|
||||
_transp(d, 0, 4, n, mask);
|
||||
_transp(d, 1, 5, n, mask);
|
||||
_transp(d, 2, 6, n, mask);
|
||||
_transp(d, 3, 7, n, mask);
|
||||
return;
|
||||
}
|
||||
|
||||
c2p_unsupported();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Transpose operations on 4 32-bit words
|
||||
*/
|
||||
|
||||
static inline void transp4(CARD32 d[], unsigned int n, unsigned int m)
|
||||
{
|
||||
CARD32 mask = get_mask(n);
|
||||
|
||||
switch (m) {
|
||||
case 1:
|
||||
/* First n x 1 block */
|
||||
_transp(d, 0, 1, n, mask);
|
||||
/* Second n x 1 block */
|
||||
_transp(d, 2, 3, n, mask);
|
||||
return;
|
||||
|
||||
case 2:
|
||||
/* Single n x 2 block */
|
||||
_transp(d, 0, 2, n, mask);
|
||||
_transp(d, 1, 3, n, mask);
|
||||
return;
|
||||
}
|
||||
|
||||
c2p_unsupported();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Transpose operations on 4 32-bit words (reverse order)
|
||||
*/
|
||||
|
||||
static inline void transp4x(CARD32 d[], unsigned int n, unsigned int m)
|
||||
{
|
||||
CARD32 mask = get_mask(n);
|
||||
|
||||
switch (m) {
|
||||
case 2:
|
||||
/* Single n x 2 block */
|
||||
_transp(d, 2, 0, n, mask);
|
||||
_transp(d, 3, 1, n, mask);
|
||||
return;
|
||||
}
|
||||
|
||||
c2p_unsupported();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Transpose operations on 2 32-bit words
|
||||
*/
|
||||
|
||||
static inline void transp2(CARD32 d[], unsigned int n)
|
||||
{
|
||||
CARD32 mask = get_mask(n);
|
||||
|
||||
/* Single n x 1 block */
|
||||
_transp(d, 0, 1, n, mask);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Transpose operations on 2 32-bit words (reverse order)
|
||||
*/
|
||||
|
||||
static inline void transp2x(CARD32 d[], unsigned int n)
|
||||
{
|
||||
CARD32 mask = get_mask(n);
|
||||
|
||||
/* Single n x 1 block */
|
||||
_transp(d, 1, 0, n, mask);
|
||||
return;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
srcs_miext_shadow = [
|
||||
'shadow.c',
|
||||
'sh3224.c',
|
||||
'shafb4.c',
|
||||
'shafb8.c',
|
||||
'shiplan2p4.c',
|
||||
'shiplan2p8.c',
|
||||
'shpacked.c',
|
||||
'shplanar8.c',
|
||||
'shplanar.c',
|
||||
'shrot16pack_180.c',
|
||||
'shrot16pack_270.c',
|
||||
'shrot16pack_270YX.c',
|
||||
'shrot16pack_90.c',
|
||||
'shrot16pack_90YX.c',
|
||||
'shrot16pack.c',
|
||||
'shrot32pack_180.c',
|
||||
'shrot32pack_270.c',
|
||||
'shrot32pack_90.c',
|
||||
'shrot32pack.c',
|
||||
'shrot8pack_180.c',
|
||||
'shrot8pack_270.c',
|
||||
'shrot8pack_90.c',
|
||||
'shrot8pack.c',
|
||||
'shrotate.c',
|
||||
]
|
||||
|
||||
hdrs_miext_shadow = [
|
||||
'shadow.h',
|
||||
]
|
||||
|
||||
libxserver_miext_shadow = static_library('libxserver_miext_shadow',
|
||||
srcs_miext_shadow,
|
||||
include_directories: inc,
|
||||
dependencies: common_dep,
|
||||
)
|
|
@ -1,138 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include "dix-config.h"
|
||||
#endif
|
||||
|
||||
#include "shadow.h"
|
||||
#include "fb.h"
|
||||
|
||||
#define Get8(a) ((CARD32) READ(a))
|
||||
|
||||
#if BITMAP_BIT_ORDER == MSBFirst
|
||||
#define Get24(a) ((Get8(a) << 16) | (Get8((a)+1) << 8) | Get8((a)+2))
|
||||
#define Put24(a,p) ((WRITE((a+0), (CARD8) ((p) >> 16))), \
|
||||
(WRITE((a+1), (CARD8) ((p) >> 8))), \
|
||||
(WRITE((a+2), (CARD8) (p))))
|
||||
#else
|
||||
#define Get24(a) (Get8(a) | (Get8((a)+1) << 8) | (Get8((a)+2)<<16))
|
||||
#define Put24(a,p) ((WRITE((a+0), (CARD8) (p))), \
|
||||
(WRITE((a+1), (CARD8) ((p) >> 8))), \
|
||||
(WRITE((a+2), (CARD8) ((p) >> 16))))
|
||||
#endif
|
||||
|
||||
static void
|
||||
sh24_32BltLine(CARD8 *srcLine,
|
||||
CARD8 *dstLine,
|
||||
int width)
|
||||
{
|
||||
CARD32 *src;
|
||||
CARD8 *dst;
|
||||
int w;
|
||||
CARD32 pixel;
|
||||
|
||||
src = (CARD32 *) srcLine;
|
||||
dst = dstLine;
|
||||
w = width;
|
||||
|
||||
while (((long)dst & 3) && w) {
|
||||
w--;
|
||||
pixel = READ(src++);
|
||||
Put24(dst, pixel);
|
||||
dst += 3;
|
||||
}
|
||||
/* Do four aligned pixels at a time */
|
||||
while (w >= 4) {
|
||||
CARD32 s0, s1;
|
||||
|
||||
s0 = READ(src++);
|
||||
s1 = READ(src++);
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
WRITE((CARD32 *) dst, (s0 & 0xffffff) | (s1 << 24));
|
||||
#else
|
||||
WRITE((CARD32 *) dst, (s0 << 8) | ((s1 & 0xffffff) >> 16));
|
||||
#endif
|
||||
s0 = READ(src++);
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
WRITE((CARD32 *) (dst + 4),
|
||||
((s1 & 0xffffff) >> 8) | (s0 << 16));
|
||||
#else
|
||||
WRITE((CARD32 *) (dst + 4),
|
||||
(s1 << 16) | ((s0 & 0xffffff) >> 8));
|
||||
#endif
|
||||
s1 = READ(src++);
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
WRITE((CARD32 *) (dst + 8),
|
||||
((s0 & 0xffffff) >> 16) | (s1 << 8));
|
||||
#else
|
||||
WRITE((CARD32 *) (dst + 8), (s0 << 24) | (s1 & 0xffffff));
|
||||
#endif
|
||||
dst += 12;
|
||||
w -= 4;
|
||||
}
|
||||
while (w--) {
|
||||
pixel = READ(src++);
|
||||
Put24(dst, pixel);
|
||||
dst += 3;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
shadowUpdate32to24(ScreenPtr pScreen, shadowBufPtr pBuf)
|
||||
{
|
||||
RegionPtr damage = DamageRegion(pBuf->pDamage);
|
||||
PixmapPtr pShadow = pBuf->pPixmap;
|
||||
int nbox = RegionNumRects(damage);
|
||||
BoxPtr pbox = RegionRects(damage);
|
||||
FbStride shaStride;
|
||||
int shaBpp;
|
||||
_X_UNUSED int shaXoff, shaYoff;
|
||||
int x, y, w, h;
|
||||
CARD32 winSize;
|
||||
FbBits *shaBase, *shaLine;
|
||||
CARD8 *winBase = NULL, *winLine;
|
||||
|
||||
fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
|
||||
shaYoff);
|
||||
|
||||
/* just get the initial window base + stride */
|
||||
winBase = (*pBuf->window)(pScreen, 0, 0, SHADOW_WINDOW_WRITE,
|
||||
&winSize, pBuf->closure);
|
||||
|
||||
while (nbox--) {
|
||||
x = pbox->x1;
|
||||
y = pbox->y1;
|
||||
w = pbox->x2 - pbox->x1;
|
||||
h = pbox->y2 - pbox->y1;
|
||||
|
||||
winLine = winBase + y * winSize + (x * 3);
|
||||
shaLine = shaBase + y * shaStride + ((x * shaBpp) >> FB_SHIFT);
|
||||
|
||||
while (h--) {
|
||||
sh24_32BltLine((CARD8 *)shaLine, (CARD8 *)winLine, w);
|
||||
winLine += winSize;
|
||||
shaLine += shaStride;
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
}
|
|
@ -1,195 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "dixfontstr.h"
|
||||
#include "mi.h"
|
||||
#include "regionstr.h"
|
||||
#include "globals.h"
|
||||
#include "gcstruct.h"
|
||||
#include "shadow.h"
|
||||
|
||||
static DevPrivateKeyRec shadowScrPrivateKeyRec;
|
||||
#define shadowScrPrivateKey (&shadowScrPrivateKeyRec)
|
||||
|
||||
#define shadowGetBuf(pScr) ((shadowBufPtr) \
|
||||
dixLookupPrivate(&(pScr)->devPrivates, shadowScrPrivateKey))
|
||||
#define shadowBuf(pScr) shadowBufPtr pBuf = shadowGetBuf(pScr)
|
||||
|
||||
#define wrap(priv, real, mem) {\
|
||||
priv->mem = real->mem; \
|
||||
real->mem = shadow##mem; \
|
||||
}
|
||||
|
||||
#define unwrap(priv, real, mem) {\
|
||||
real->mem = priv->mem; \
|
||||
}
|
||||
|
||||
static void
|
||||
shadowRedisplay(ScreenPtr pScreen)
|
||||
{
|
||||
shadowBuf(pScreen);
|
||||
RegionPtr pRegion;
|
||||
|
||||
if (!pBuf || !pBuf->pDamage || !pBuf->update)
|
||||
return;
|
||||
pRegion = DamageRegion(pBuf->pDamage);
|
||||
if (RegionNotEmpty(pRegion)) {
|
||||
(*pBuf->update) (pScreen, pBuf);
|
||||
DamageEmpty(pBuf->pDamage);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
shadowBlockHandler(ScreenPtr pScreen, void *timeout)
|
||||
{
|
||||
shadowBuf(pScreen);
|
||||
|
||||
shadowRedisplay(pScreen);
|
||||
|
||||
unwrap(pBuf, pScreen, BlockHandler);
|
||||
pScreen->BlockHandler(pScreen, timeout);
|
||||
wrap(pBuf, pScreen, BlockHandler);
|
||||
}
|
||||
|
||||
static void
|
||||
shadowGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
|
||||
unsigned int format, unsigned long planeMask, char *pdstLine)
|
||||
{
|
||||
ScreenPtr pScreen = pDrawable->pScreen;
|
||||
|
||||
shadowBuf(pScreen);
|
||||
|
||||
/* Many apps use GetImage to sync with the visible frame buffer */
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
shadowRedisplay(pScreen);
|
||||
unwrap(pBuf, pScreen, GetImage);
|
||||
pScreen->GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
|
||||
wrap(pBuf, pScreen, GetImage);
|
||||
}
|
||||
|
||||
static Bool
|
||||
shadowCloseScreen(ScreenPtr pScreen)
|
||||
{
|
||||
shadowBuf(pScreen);
|
||||
|
||||
unwrap(pBuf, pScreen, GetImage);
|
||||
unwrap(pBuf, pScreen, CloseScreen);
|
||||
unwrap(pBuf, pScreen, BlockHandler);
|
||||
shadowRemove(pScreen, pBuf->pPixmap);
|
||||
DamageDestroy(pBuf->pDamage);
|
||||
if (pBuf->pPixmap)
|
||||
pScreen->DestroyPixmap(pBuf->pPixmap);
|
||||
free(pBuf);
|
||||
return pScreen->CloseScreen(pScreen);
|
||||
}
|
||||
|
||||
Bool
|
||||
shadowSetup(ScreenPtr pScreen)
|
||||
{
|
||||
shadowBufPtr pBuf;
|
||||
|
||||
if (!dixRegisterPrivateKey(&shadowScrPrivateKeyRec, PRIVATE_SCREEN, 0))
|
||||
return FALSE;
|
||||
|
||||
if (!DamageSetup(pScreen))
|
||||
return FALSE;
|
||||
|
||||
pBuf = malloc(sizeof(shadowBufRec));
|
||||
if (!pBuf)
|
||||
return FALSE;
|
||||
pBuf->pDamage = DamageCreate((DamageReportFunc) NULL,
|
||||
(DamageDestroyFunc) NULL,
|
||||
DamageReportNone, TRUE, pScreen, pScreen);
|
||||
if (!pBuf->pDamage) {
|
||||
free(pBuf);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wrap(pBuf, pScreen, CloseScreen);
|
||||
wrap(pBuf, pScreen, GetImage);
|
||||
wrap(pBuf, pScreen, BlockHandler);
|
||||
pBuf->update = 0;
|
||||
pBuf->window = 0;
|
||||
pBuf->pPixmap = 0;
|
||||
pBuf->closure = 0;
|
||||
pBuf->randr = 0;
|
||||
|
||||
dixSetPrivate(&pScreen->devPrivates, shadowScrPrivateKey, pBuf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
shadowAdd(ScreenPtr pScreen, PixmapPtr pPixmap, ShadowUpdateProc update,
|
||||
ShadowWindowProc window, int randr, void *closure)
|
||||
{
|
||||
shadowBuf(pScreen);
|
||||
|
||||
/*
|
||||
* Map simple rotation values to bitmasks; fortunately,
|
||||
* these are all unique
|
||||
*/
|
||||
switch (randr) {
|
||||
case 0:
|
||||
randr = SHADOW_ROTATE_0;
|
||||
break;
|
||||
case 90:
|
||||
randr = SHADOW_ROTATE_90;
|
||||
break;
|
||||
case 180:
|
||||
randr = SHADOW_ROTATE_180;
|
||||
break;
|
||||
case 270:
|
||||
randr = SHADOW_ROTATE_270;
|
||||
break;
|
||||
}
|
||||
pBuf->update = update;
|
||||
pBuf->window = window;
|
||||
pBuf->randr = randr;
|
||||
pBuf->closure = closure;
|
||||
pBuf->pPixmap = pPixmap;
|
||||
DamageRegister(&pPixmap->drawable, pBuf->pDamage);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
shadowRemove(ScreenPtr pScreen, PixmapPtr pPixmap)
|
||||
{
|
||||
shadowBuf(pScreen);
|
||||
|
||||
if (pBuf->pPixmap) {
|
||||
DamageUnregister(pBuf->pDamage);
|
||||
pBuf->update = 0;
|
||||
pBuf->window = 0;
|
||||
pBuf->randr = 0;
|
||||
pBuf->closure = 0;
|
||||
pBuf->pPixmap = 0;
|
||||
}
|
||||
}
|
|
@ -1,155 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _SHADOW_H_
|
||||
#define _SHADOW_H_
|
||||
|
||||
#include "scrnintstr.h"
|
||||
|
||||
#include "picturestr.h"
|
||||
|
||||
#include "damage.h"
|
||||
#include "damagestr.h"
|
||||
typedef struct _shadowBuf *shadowBufPtr;
|
||||
|
||||
typedef void (*ShadowUpdateProc) (ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
#define SHADOW_WINDOW_RELOCATE 1
|
||||
#define SHADOW_WINDOW_READ 2
|
||||
#define SHADOW_WINDOW_WRITE 4
|
||||
|
||||
typedef void *(*ShadowWindowProc) (ScreenPtr pScreen,
|
||||
CARD32 row,
|
||||
CARD32 offset,
|
||||
int mode, CARD32 *size, void *closure);
|
||||
|
||||
typedef struct _shadowBuf {
|
||||
DamagePtr pDamage;
|
||||
ShadowUpdateProc update;
|
||||
ShadowWindowProc window;
|
||||
PixmapPtr pPixmap;
|
||||
void *closure;
|
||||
int randr;
|
||||
|
||||
/* screen wrappers */
|
||||
GetImageProcPtr GetImage;
|
||||
CloseScreenProcPtr CloseScreen;
|
||||
ScreenBlockHandlerProcPtr BlockHandler;
|
||||
} shadowBufRec;
|
||||
|
||||
/* Match defines from randr extension */
|
||||
#define SHADOW_ROTATE_0 1
|
||||
#define SHADOW_ROTATE_90 2
|
||||
#define SHADOW_ROTATE_180 4
|
||||
#define SHADOW_ROTATE_270 8
|
||||
#define SHADOW_ROTATE_ALL (SHADOW_ROTATE_0|SHADOW_ROTATE_90|\
|
||||
SHADOW_ROTATE_180|SHADOW_ROTATE_270)
|
||||
#define SHADOW_REFLECT_X 16
|
||||
#define SHADOW_REFLECT_Y 32
|
||||
#define SHADOW_REFLECT_ALL (SHADOW_REFLECT_X|SHADOW_REFLECT_Y)
|
||||
|
||||
extern _X_EXPORT Bool
|
||||
shadowSetup(ScreenPtr pScreen);
|
||||
|
||||
extern _X_EXPORT Bool
|
||||
|
||||
shadowAdd(ScreenPtr pScreen,
|
||||
PixmapPtr pPixmap,
|
||||
ShadowUpdateProc update,
|
||||
ShadowWindowProc window, int randr, void *closure);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowRemove(ScreenPtr pScreen, PixmapPtr pPixmap);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateAfb4(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateAfb8(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateIplan2p4(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateIplan2p8(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdatePlanar4(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdatePlanar4x8(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateRotatePacked(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateRotate8_90(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateRotate16_90(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateRotate16_90YX(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateRotate32_90(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateRotate8_180(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateRotate16_180(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateRotate32_180(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateRotate8_270(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateRotate16_270(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateRotate16_270YX(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateRotate32_270(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateRotate8(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateRotate16(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdateRotate32(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
extern _X_EXPORT void
|
||||
shadowUpdate32to24(ScreenPtr pScreen, shadowBufPtr pBuf);
|
||||
|
||||
typedef void (*shadowUpdateProc) (ScreenPtr, shadowBufPtr);
|
||||
|
||||
#endif /* _SHADOW_H_ */
|
|
@ -1,139 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2013 Geert Uytterhoeven
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Based on shpacked.c, which is Copyright © 2000 Keith Packard
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include <X11/fonts/font.h>
|
||||
#include "dixfontstr.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "mi.h"
|
||||
#include "regionstr.h"
|
||||
#include "globals.h"
|
||||
#include "gcstruct.h"
|
||||
#include "shadow.h"
|
||||
#include "fb.h"
|
||||
#include "c2p_core.h"
|
||||
|
||||
|
||||
/*
|
||||
* Perform a full C2P step on 32 4-bit pixels, stored in 4 32-bit words
|
||||
* containing
|
||||
* - 32 4-bit chunky pixels on input
|
||||
* - permutated planar data (1 plane per 32-bit word) on output
|
||||
*/
|
||||
|
||||
static void c2p_32x4(CARD32 d[4])
|
||||
{
|
||||
transp4(d, 16, 2);
|
||||
transp4(d, 8, 1);
|
||||
transp4(d, 4, 2);
|
||||
transp4(d, 2, 1);
|
||||
transp4(d, 1, 2);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Store a full block of permutated planar data after c2p conversion
|
||||
*/
|
||||
|
||||
static inline void store_afb4(void *dst, unsigned int stride,
|
||||
const CARD32 d[4])
|
||||
{
|
||||
CARD8 *p = dst;
|
||||
|
||||
*(CARD32 *)p = d[3]; p += stride;
|
||||
*(CARD32 *)p = d[1]; p += stride;
|
||||
*(CARD32 *)p = d[2]; p += stride;
|
||||
*(CARD32 *)p = d[0]; p += stride;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
shadowUpdateAfb4(ScreenPtr pScreen, shadowBufPtr pBuf)
|
||||
{
|
||||
RegionPtr damage = DamageRegion(pBuf->pDamage);
|
||||
PixmapPtr pShadow = pBuf->pPixmap;
|
||||
int nbox = RegionNumRects(damage);
|
||||
BoxPtr pbox = RegionRects(damage);
|
||||
FbBits *shaBase;
|
||||
CARD32 *shaLine, *sha;
|
||||
FbStride shaStride;
|
||||
int scrLine;
|
||||
_X_UNUSED int shaBpp, shaXoff, shaYoff;
|
||||
int x, y, w, h;
|
||||
int i, n;
|
||||
CARD32 *win;
|
||||
CARD32 off, winStride;
|
||||
union {
|
||||
CARD8 bytes[16];
|
||||
CARD32 words[4];
|
||||
} d;
|
||||
|
||||
fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
|
||||
shaYoff);
|
||||
if (sizeof(FbBits) != sizeof(CARD32))
|
||||
shaStride = shaStride * sizeof(FbBits) / sizeof(CARD32);
|
||||
|
||||
while (nbox--) {
|
||||
x = pbox->x1;
|
||||
y = pbox->y1;
|
||||
w = pbox->x2 - pbox->x1;
|
||||
h = pbox->y2 - pbox->y1;
|
||||
|
||||
scrLine = (x & -32) / 2;
|
||||
shaLine = (CARD32 *)shaBase + y * shaStride + scrLine / sizeof(CARD32);
|
||||
|
||||
off = scrLine / 4; /* byte offset in bitplane scanline */
|
||||
n = ((x & 31) + w + 31) / 32; /* number of c2p units in scanline */
|
||||
|
||||
while (h--) {
|
||||
sha = shaLine;
|
||||
win = (CARD32 *) (*pBuf->window) (pScreen,
|
||||
y,
|
||||
off,
|
||||
SHADOW_WINDOW_WRITE,
|
||||
&winStride,
|
||||
pBuf->closure);
|
||||
if (!win)
|
||||
return;
|
||||
for (i = 0; i < n; i++) {
|
||||
memcpy(d.bytes, sha, sizeof(d.bytes));
|
||||
c2p_32x4(d.words);
|
||||
store_afb4(win++, winStride, d.words);
|
||||
sha += sizeof(d.bytes) / sizeof(*sha);
|
||||
}
|
||||
shaLine += shaStride;
|
||||
y++;
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
}
|
|
@ -1,143 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2013 Geert Uytterhoeven
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Based on shpacked.c, which is Copyright © 2000 Keith Packard
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include <X11/fonts/font.h>
|
||||
#include "dixfontstr.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "mi.h"
|
||||
#include "regionstr.h"
|
||||
#include "globals.h"
|
||||
#include "gcstruct.h"
|
||||
#include "shadow.h"
|
||||
#include "fb.h"
|
||||
#include "c2p_core.h"
|
||||
|
||||
|
||||
/*
|
||||
* Perform a full C2P step on 32 8-bit pixels, stored in 8 32-bit words
|
||||
* containing
|
||||
* - 32 8-bit chunky pixels on input
|
||||
* - permutated planar data (1 plane per 32-bit word) on output
|
||||
*/
|
||||
|
||||
static void c2p_32x8(CARD32 d[8])
|
||||
{
|
||||
transp8(d, 16, 4);
|
||||
transp8(d, 8, 2);
|
||||
transp8(d, 4, 1);
|
||||
transp8(d, 2, 4);
|
||||
transp8(d, 1, 2);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Store a full block of permutated planar data after c2p conversion
|
||||
*/
|
||||
|
||||
static inline void store_afb8(void *dst, unsigned int stride,
|
||||
const CARD32 d[8])
|
||||
{
|
||||
CARD8 *p = dst;
|
||||
|
||||
*(CARD32 *)p = d[7]; p += stride;
|
||||
*(CARD32 *)p = d[5]; p += stride;
|
||||
*(CARD32 *)p = d[3]; p += stride;
|
||||
*(CARD32 *)p = d[1]; p += stride;
|
||||
*(CARD32 *)p = d[6]; p += stride;
|
||||
*(CARD32 *)p = d[4]; p += stride;
|
||||
*(CARD32 *)p = d[2]; p += stride;
|
||||
*(CARD32 *)p = d[0]; p += stride;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
shadowUpdateAfb8(ScreenPtr pScreen, shadowBufPtr pBuf)
|
||||
{
|
||||
RegionPtr damage = DamageRegion(pBuf->pDamage);
|
||||
PixmapPtr pShadow = pBuf->pPixmap;
|
||||
int nbox = RegionNumRects(damage);
|
||||
BoxPtr pbox = RegionRects(damage);
|
||||
FbBits *shaBase;
|
||||
CARD32 *shaLine, *sha;
|
||||
FbStride shaStride;
|
||||
int scrLine;
|
||||
_X_UNUSED int shaBpp, shaXoff, shaYoff;
|
||||
int x, y, w, h;
|
||||
int i, n;
|
||||
CARD32 *win;
|
||||
CARD32 off, winStride;
|
||||
union {
|
||||
CARD8 bytes[32];
|
||||
CARD32 words[8];
|
||||
} d;
|
||||
|
||||
fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
|
||||
shaYoff);
|
||||
if (sizeof(FbBits) != sizeof(CARD32))
|
||||
shaStride = shaStride * sizeof(FbBits) / sizeof(CARD32);
|
||||
|
||||
while (nbox--) {
|
||||
x = pbox->x1;
|
||||
y = pbox->y1;
|
||||
w = pbox->x2 - pbox->x1;
|
||||
h = pbox->y2 - pbox->y1;
|
||||
|
||||
scrLine = x & -32;
|
||||
shaLine = (CARD32 *)shaBase + y * shaStride + scrLine / sizeof(CARD32);
|
||||
|
||||
off = scrLine / 8; /* byte offset in bitplane scanline */
|
||||
n = ((x & 31) + w + 31) / 32; /* number of c2p units in scanline */
|
||||
|
||||
while (h--) {
|
||||
sha = shaLine;
|
||||
win = (CARD32 *) (*pBuf->window) (pScreen,
|
||||
y,
|
||||
off,
|
||||
SHADOW_WINDOW_WRITE,
|
||||
&winStride,
|
||||
pBuf->closure);
|
||||
if (!win)
|
||||
return;
|
||||
for (i = 0; i < n; i++) {
|
||||
memcpy(d.bytes, sha, sizeof(d.bytes));
|
||||
c2p_32x8(d.words);
|
||||
store_afb8(win++, winStride, d.words);
|
||||
sha += sizeof(d.bytes) / sizeof(*sha);
|
||||
}
|
||||
shaLine += shaStride;
|
||||
y++;
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2013 Geert Uytterhoeven
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Based on shpacked.c, which is Copyright © 2000 Keith Packard
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include <X11/fonts/font.h>
|
||||
#include "dixfontstr.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "mi.h"
|
||||
#include "regionstr.h"
|
||||
#include "globals.h"
|
||||
#include "gcstruct.h"
|
||||
#include "shadow.h"
|
||||
#include "fb.h"
|
||||
#include "c2p_core.h"
|
||||
|
||||
|
||||
/*
|
||||
* Perform a full C2P step on 16 4-bit pixels, stored in 2 32-bit words
|
||||
* containing
|
||||
* - 16 4-bit chunky pixels on input
|
||||
* - permutated planar data (2 planes per 32-bit word) on output
|
||||
*/
|
||||
|
||||
static void c2p_16x4(CARD32 d[2])
|
||||
{
|
||||
transp2(d, 8);
|
||||
transp2(d, 2);
|
||||
transp2x(d, 1);
|
||||
transp2(d, 16);
|
||||
transp2(d, 4);
|
||||
transp2(d, 1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Store a full block of iplan2p4 data after c2p conversion
|
||||
*/
|
||||
|
||||
static inline void store_iplan2p4(void *dst, const CARD32 d[2])
|
||||
{
|
||||
CARD32 *p = dst;
|
||||
|
||||
*p++ = d[0];
|
||||
*p++ = d[1];
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
shadowUpdateIplan2p4(ScreenPtr pScreen, shadowBufPtr pBuf)
|
||||
{
|
||||
RegionPtr damage = DamageRegion(pBuf->pDamage);
|
||||
PixmapPtr pShadow = pBuf->pPixmap;
|
||||
int nbox = RegionNumRects(damage);
|
||||
BoxPtr pbox = RegionRects(damage);
|
||||
FbBits *shaBase;
|
||||
CARD16 *shaLine, *sha;
|
||||
FbStride shaStride;
|
||||
int scrLine;
|
||||
_X_UNUSED int shaBpp, shaXoff, shaYoff;
|
||||
int x, y, w, h;
|
||||
int i, n;
|
||||
CARD16 *win;
|
||||
_X_UNUSED CARD32 winSize;
|
||||
union {
|
||||
CARD8 bytes[8];
|
||||
CARD32 words[2];
|
||||
} d;
|
||||
|
||||
fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
|
||||
shaYoff);
|
||||
shaStride *= sizeof(FbBits) / sizeof(CARD16);
|
||||
|
||||
while (nbox--) {
|
||||
x = pbox->x1;
|
||||
y = pbox->y1;
|
||||
w = pbox->x2 - pbox->x1;
|
||||
h = pbox->y2 - pbox->y1;
|
||||
|
||||
scrLine = (x & -16) / 2;
|
||||
shaLine = (CARD16 *)shaBase + y * shaStride + scrLine / sizeof(CARD16);
|
||||
|
||||
n = ((x & 15) + w + 15) / 16; /* number of c2p units in scanline */
|
||||
|
||||
while (h--) {
|
||||
sha = shaLine;
|
||||
win = (CARD16 *) (*pBuf->window) (pScreen,
|
||||
y,
|
||||
scrLine,
|
||||
SHADOW_WINDOW_WRITE,
|
||||
&winSize,
|
||||
pBuf->closure);
|
||||
if (!win)
|
||||
return;
|
||||
for (i = 0; i < n; i++) {
|
||||
memcpy(d.bytes, sha, sizeof(d.bytes));
|
||||
c2p_16x4(d.words);
|
||||
store_iplan2p4(win, d.words);
|
||||
sha += sizeof(d.bytes) / sizeof(*sha);
|
||||
win += sizeof(d.bytes) / sizeof(*win);
|
||||
}
|
||||
shaLine += shaStride;
|
||||
y++;
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2013 Geert Uytterhoeven
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Based on shpacked.c, which is Copyright © 2000 Keith Packard
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include <X11/fonts/font.h>
|
||||
#include "dixfontstr.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "mi.h"
|
||||
#include "regionstr.h"
|
||||
#include "globals.h"
|
||||
#include "gcstruct.h"
|
||||
#include "shadow.h"
|
||||
#include "fb.h"
|
||||
#include "c2p_core.h"
|
||||
|
||||
|
||||
/*
|
||||
* Perform a full C2P step on 16 8-bit pixels, stored in 4 32-bit words
|
||||
* containing
|
||||
* - 16 8-bit chunky pixels on input
|
||||
* - permutated planar data (2 planes per 32-bit word) on output
|
||||
*/
|
||||
|
||||
static void c2p_16x8(CARD32 d[4])
|
||||
{
|
||||
transp4(d, 8, 2);
|
||||
transp4(d, 1, 2);
|
||||
transp4x(d, 16, 2);
|
||||
transp4x(d, 2, 2);
|
||||
transp4(d, 4, 1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Store a full block of permutated iplan2p8 data after c2p conversion
|
||||
*/
|
||||
|
||||
static inline void store_iplan2p8(void *dst, const CARD32 d[4])
|
||||
{
|
||||
CARD32 *p = dst;
|
||||
|
||||
*p++ = d[1];
|
||||
*p++ = d[3];
|
||||
*p++ = d[0];
|
||||
*p++ = d[2];
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
shadowUpdateIplan2p8(ScreenPtr pScreen, shadowBufPtr pBuf)
|
||||
{
|
||||
RegionPtr damage = DamageRegion(pBuf->pDamage);
|
||||
PixmapPtr pShadow = pBuf->pPixmap;
|
||||
int nbox = RegionNumRects(damage);
|
||||
BoxPtr pbox = RegionRects(damage);
|
||||
FbBits *shaBase;
|
||||
CARD16 *shaLine, *sha;
|
||||
FbStride shaStride;
|
||||
int scrLine;
|
||||
_X_UNUSED int shaBpp, shaXoff, shaYoff;
|
||||
int x, y, w, h;
|
||||
int i, n;
|
||||
CARD16 *win;
|
||||
_X_UNUSED CARD32 winSize;
|
||||
union {
|
||||
CARD8 bytes[16];
|
||||
CARD32 words[4];
|
||||
} d;
|
||||
|
||||
fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
|
||||
shaYoff);
|
||||
shaStride *= sizeof(FbBits) / sizeof(CARD16);
|
||||
|
||||
while (nbox--) {
|
||||
x = pbox->x1;
|
||||
y = pbox->y1;
|
||||
w = pbox->x2 - pbox->x1;
|
||||
h = pbox->y2 - pbox->y1;
|
||||
|
||||
scrLine = x & -16;
|
||||
shaLine = (CARD16 *)shaBase + y * shaStride + scrLine / sizeof(CARD16);
|
||||
|
||||
n = ((x & 15) + w + 15) / 16; /* number of c2p units in scanline */
|
||||
|
||||
while (h--) {
|
||||
sha = shaLine;
|
||||
win = (CARD16 *) (*pBuf->window) (pScreen,
|
||||
y,
|
||||
scrLine,
|
||||
SHADOW_WINDOW_WRITE,
|
||||
&winSize,
|
||||
pBuf->closure);
|
||||
if (!win)
|
||||
return;
|
||||
for (i = 0; i < n; i++) {
|
||||
memcpy(d.bytes, sha, sizeof(d.bytes));
|
||||
c2p_16x8(d.words);
|
||||
store_iplan2p8(win, d.words);
|
||||
sha += sizeof(d.bytes) / sizeof(*sha);
|
||||
win += sizeof(d.bytes) / sizeof(*win);
|
||||
}
|
||||
shaLine += shaStride;
|
||||
y++;
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include <X11/fonts/font.h>
|
||||
#include "dixfontstr.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "mi.h"
|
||||
#include "regionstr.h"
|
||||
#include "globals.h"
|
||||
#include "gcstruct.h"
|
||||
#include "shadow.h"
|
||||
#include "fb.h"
|
||||
|
||||
void
|
||||
shadowUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
|
||||
{
|
||||
RegionPtr damage = DamageRegion(pBuf->pDamage);
|
||||
PixmapPtr pShadow = pBuf->pPixmap;
|
||||
int nbox = RegionNumRects(damage);
|
||||
BoxPtr pbox = RegionRects(damage);
|
||||
FbBits *shaBase, *shaLine, *sha;
|
||||
FbStride shaStride;
|
||||
int scrBase, scrLine, scr;
|
||||
int shaBpp;
|
||||
_X_UNUSED int shaXoff, shaYoff;
|
||||
int x, y, w, h, width;
|
||||
int i;
|
||||
FbBits *winBase = NULL, *win;
|
||||
CARD32 winSize;
|
||||
|
||||
fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
|
||||
shaYoff);
|
||||
while (nbox--) {
|
||||
x = pbox->x1 * shaBpp;
|
||||
y = pbox->y1;
|
||||
w = (pbox->x2 - pbox->x1) * shaBpp;
|
||||
h = pbox->y2 - pbox->y1;
|
||||
|
||||
scrLine = (x >> FB_SHIFT);
|
||||
shaLine = shaBase + y * shaStride + (x >> FB_SHIFT);
|
||||
|
||||
x &= FB_MASK;
|
||||
w = (w + x + FB_MASK) >> FB_SHIFT;
|
||||
|
||||
while (h--) {
|
||||
winSize = 0;
|
||||
scrBase = 0;
|
||||
width = w;
|
||||
scr = scrLine;
|
||||
sha = shaLine;
|
||||
while (width) {
|
||||
/* how much remains in this window */
|
||||
i = scrBase + winSize - scr;
|
||||
if (i <= 0 || scr < scrBase) {
|
||||
winBase = (FbBits *) (*pBuf->window) (pScreen,
|
||||
y,
|
||||
scr * sizeof(FbBits),
|
||||
SHADOW_WINDOW_WRITE,
|
||||
&winSize,
|
||||
pBuf->closure);
|
||||
if (!winBase)
|
||||
return;
|
||||
scrBase = scr;
|
||||
winSize /= sizeof(FbBits);
|
||||
i = winSize;
|
||||
}
|
||||
win = winBase + (scr - scrBase);
|
||||
if (i > width)
|
||||
i = width;
|
||||
width -= i;
|
||||
scr += i;
|
||||
memcpy(win, sha, i * sizeof(FbBits));
|
||||
sha += i;
|
||||
}
|
||||
shaLine += shaStride;
|
||||
y++;
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
}
|
|
@ -1,168 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include <X11/fonts/font.h>
|
||||
#include "dixfontstr.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "mi.h"
|
||||
#include "regionstr.h"
|
||||
#include "globals.h"
|
||||
#include "gcstruct.h"
|
||||
#include "shadow.h"
|
||||
#include "fb.h"
|
||||
|
||||
/*
|
||||
* 32 4-bit pixels per write
|
||||
*/
|
||||
|
||||
#define PL_SHIFT 7
|
||||
#define PL_UNIT (1 << PL_SHIFT)
|
||||
#define PL_MASK (PL_UNIT - 1)
|
||||
|
||||
/*
|
||||
* 32->8 conversion:
|
||||
*
|
||||
* 7 6 5 4 3 2 1 0
|
||||
* A B C D E F G H
|
||||
*
|
||||
* 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
|
||||
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
* m . . . H . . . G . . . F . . . E . . . D . . . C . . . B . . . A
|
||||
* m1 G . . . F . . . E . . . D . . . C . . . B . . . A . . . . . . . m << (7 - (p))
|
||||
* m2 . H . . . G . . . F . . . E . . . D . . . C . . . B . . . A . . (m >> (p)) << 2
|
||||
* m3 G E C A m1 & 0x80808080
|
||||
* m4 H F D B m2 & 0x40404040
|
||||
* m5 G H E F C D A B m3 | m4
|
||||
* m6 G H E F C D G H A B E F m5 | (m5 >> 20)
|
||||
* m7 G H E F C D G H A B C D E F G H m6 | (m6 >> 10)
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#define GetBits(p,o,d) {\
|
||||
m = sha[o]; \
|
||||
m1 = m << (7 - (p)); \
|
||||
m2 = (m >> (p)) << 2; \
|
||||
m3 = m1 & 0x80808080; \
|
||||
m4 = m2 & 0x40404040; \
|
||||
m5 = m3 | m4; \
|
||||
m6 = m5 | (m5 >> 20); \
|
||||
d = m6 | (m6 >> 10); \
|
||||
}
|
||||
#else
|
||||
#define GetBits(p,o,d) {\
|
||||
m = sha[o]; \
|
||||
m5 = ((m << (7 - (p))) & 0x80808080) | (((m >> (p)) << 2) & 0x40404040); \
|
||||
m6 = m5 | (m5 >> 20); \
|
||||
d = m6 | (m6 >> 10); \
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
shadowUpdatePlanar4(ScreenPtr pScreen, shadowBufPtr pBuf)
|
||||
{
|
||||
RegionPtr damage = DamageRegion(pBuf->pDamage);
|
||||
PixmapPtr pShadow = pBuf->pPixmap;
|
||||
int nbox = RegionNumRects(damage);
|
||||
BoxPtr pbox = RegionRects(damage);
|
||||
CARD32 *shaBase, *shaLine, *sha;
|
||||
FbStride shaStride;
|
||||
int scrBase, scrLine, scr;
|
||||
int shaBpp;
|
||||
_X_UNUSED int shaXoff, shaYoff;
|
||||
int x, y, w, h, width;
|
||||
int i;
|
||||
CARD32 *winBase = NULL, *win;
|
||||
CARD32 winSize;
|
||||
int plane;
|
||||
CARD32 m, m5, m6;
|
||||
CARD8 s1, s2, s3, s4;
|
||||
|
||||
fbGetStipDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
|
||||
shaYoff);
|
||||
while (nbox--) {
|
||||
x = (pbox->x1) * shaBpp;
|
||||
y = (pbox->y1);
|
||||
w = (pbox->x2 - pbox->x1) * shaBpp;
|
||||
h = pbox->y2 - pbox->y1;
|
||||
|
||||
w = (w + (x & PL_MASK) + PL_MASK) >> PL_SHIFT;
|
||||
x &= ~PL_MASK;
|
||||
|
||||
scrLine = (x >> PL_SHIFT);
|
||||
shaLine = shaBase + y * shaStride + (x >> FB_SHIFT);
|
||||
|
||||
while (h--) {
|
||||
for (plane = 0; plane < 4; plane++) {
|
||||
width = w;
|
||||
scr = scrLine;
|
||||
sha = shaLine;
|
||||
winSize = 0;
|
||||
scrBase = 0;
|
||||
while (width) {
|
||||
/* how much remains in this window */
|
||||
i = scrBase + winSize - scr;
|
||||
if (i <= 0 || scr < scrBase) {
|
||||
winBase = (CARD32 *) (*pBuf->window) (pScreen,
|
||||
y,
|
||||
(scr << 4) |
|
||||
(plane),
|
||||
SHADOW_WINDOW_WRITE,
|
||||
&winSize,
|
||||
pBuf->closure);
|
||||
if (!winBase)
|
||||
return;
|
||||
winSize >>= 2;
|
||||
scrBase = scr;
|
||||
i = winSize;
|
||||
}
|
||||
win = winBase + (scr - scrBase);
|
||||
if (i > width)
|
||||
i = width;
|
||||
width -= i;
|
||||
scr += i;
|
||||
|
||||
while (i--) {
|
||||
GetBits(plane, 0, s1);
|
||||
GetBits(plane, 1, s2);
|
||||
GetBits(plane, 2, s3);
|
||||
GetBits(plane, 3, s4);
|
||||
*win++ = s1 | (s2 << 8) | (s3 << 16) | (s4 << 24);
|
||||
sha += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
shaLine += shaStride;
|
||||
y++;
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
}
|
|
@ -1,170 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include <X11/fonts/font.h>
|
||||
#include "dixfontstr.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "mi.h"
|
||||
#include "regionstr.h"
|
||||
#include "globals.h"
|
||||
#include "gcstruct.h"
|
||||
#include "shadow.h"
|
||||
#include "fb.h"
|
||||
|
||||
/*
|
||||
* Expose 8bpp depth 4
|
||||
*/
|
||||
|
||||
/*
|
||||
* 32->8 conversion:
|
||||
*
|
||||
* 7 6 5 4 3 2 1 0
|
||||
* A B C D E F G H
|
||||
*
|
||||
* 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
|
||||
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
* m1 D x x x x x x x C x x x x x x x B x x x x x x x A x x x x x x x sha[0] << (7-(p))
|
||||
* m2 x x x x H x x x x x x x G x x x x x x x F x x x x x x x E x x x sha[1] << (3-(p))
|
||||
* m3 D C B A m1 & 0x80808080
|
||||
* m4 H G F E m2 & 0x08080808
|
||||
* m5 D H C G B F A E m3 | m4
|
||||
* m6 D H C G B F m5 >> 9
|
||||
* m7 D H C D G H B C F G A B E F m5 | m6
|
||||
* m8 D H C D G H m7 >> 18
|
||||
* m9 D H C D G H B C D F G H A B C D E F G H m7 | m8
|
||||
*/
|
||||
|
||||
#define PL_SHIFT 8
|
||||
#define PL_UNIT (1 << PL_SHIFT)
|
||||
#define PL_MASK (PL_UNIT - 1)
|
||||
|
||||
#if 0
|
||||
#define GetBits(p,o,d) { \
|
||||
CARD32 m1,m2,m3,m4,m5,m6,m7,m8; \
|
||||
m1 = sha[o] << (7 - (p)); \
|
||||
m2 = sha[(o)+1] << (3 - (p)); \
|
||||
m3 = m1 & 0x80808080; \
|
||||
m4 = m2 & 0x08080808; \
|
||||
m5 = m3 | m4; \
|
||||
m6 = m5 >> 9; \
|
||||
m7 = m5 | m6; \
|
||||
m8 = m7 >> 18; \
|
||||
d = m7 | m8; \
|
||||
}
|
||||
#else
|
||||
#define GetBits(p,o,d) { \
|
||||
CARD32 m5,m7; \
|
||||
m5 = ((sha[o] << (7 - (p))) & 0x80808080) | ((sha[(o)+1] << (3 - (p))) & 0x08080808); \
|
||||
m7 = m5 | (m5 >> 9); \
|
||||
d = m7 | (m7 >> 18); \
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
shadowUpdatePlanar4x8(ScreenPtr pScreen, shadowBufPtr pBuf)
|
||||
{
|
||||
RegionPtr damage = DamageRegion(pBuf->pDamage);
|
||||
PixmapPtr pShadow = pBuf->pPixmap;
|
||||
int nbox = RegionNumRects(damage);
|
||||
BoxPtr pbox = RegionRects(damage);
|
||||
CARD32 *shaBase, *shaLine, *sha;
|
||||
CARD8 s1, s2, s3, s4;
|
||||
FbStride shaStride;
|
||||
int scrBase, scrLine, scr;
|
||||
int shaBpp;
|
||||
_X_UNUSED int shaXoff, shaYoff;
|
||||
int x, y, w, h, width;
|
||||
int i;
|
||||
CARD32 *winBase = NULL, *win;
|
||||
CARD32 winSize;
|
||||
int plane;
|
||||
|
||||
fbGetStipDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
|
||||
shaYoff);
|
||||
while (nbox--) {
|
||||
x = pbox->x1 * shaBpp;
|
||||
y = pbox->y1;
|
||||
w = (pbox->x2 - pbox->x1) * shaBpp;
|
||||
h = pbox->y2 - pbox->y1;
|
||||
|
||||
w = (w + (x & PL_MASK) + PL_MASK) >> PL_SHIFT;
|
||||
x &= ~PL_MASK;
|
||||
|
||||
scrLine = (x >> PL_SHIFT);
|
||||
shaLine = shaBase + y * shaStride + (x >> FB_SHIFT);
|
||||
|
||||
while (h--) {
|
||||
for (plane = 0; plane < 4; plane++) {
|
||||
width = w;
|
||||
scr = scrLine;
|
||||
sha = shaLine;
|
||||
winSize = 0;
|
||||
scrBase = 0;
|
||||
while (width) {
|
||||
/* how much remains in this window */
|
||||
i = scrBase + winSize - scr;
|
||||
if (i <= 0 || scr < scrBase) {
|
||||
winBase = (CARD32 *) (*pBuf->window) (pScreen,
|
||||
y,
|
||||
(scr << 4) |
|
||||
(plane),
|
||||
SHADOW_WINDOW_WRITE,
|
||||
&winSize,
|
||||
pBuf->closure);
|
||||
if (!winBase)
|
||||
return;
|
||||
winSize >>= 2;
|
||||
scrBase = scr;
|
||||
i = winSize;
|
||||
}
|
||||
win = winBase + (scr - scrBase);
|
||||
if (i > width)
|
||||
i = width;
|
||||
width -= i;
|
||||
scr += i;
|
||||
|
||||
while (i--) {
|
||||
GetBits(plane, 0, s1);
|
||||
GetBits(plane, 2, s2);
|
||||
GetBits(plane, 4, s3);
|
||||
GetBits(plane, 6, s4);
|
||||
*win++ = s1 | (s2 << 8) | (s3 << 16) | (s4 << 24);
|
||||
sha += 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
shaLine += shaStride;
|
||||
y++;
|
||||
}
|
||||
pbox++;
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define FUNC shadowUpdateRotate16
|
||||
#define Data CARD16
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "shrotpack.h"
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define FUNC shadowUpdateRotate16_180
|
||||
#define Data CARD16
|
||||
#define ROTATE 180
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "shrotpack.h"
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define FUNC shadowUpdateRotate16_270
|
||||
#define Data CARD16
|
||||
#define ROTATE 270
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "shrotpack.h"
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Copyright 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define FUNC shadowUpdateRotate16_270YX
|
||||
#define Data CARD16
|
||||
#define ROTATE 270
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "shrotpackYX.h"
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define FUNC shadowUpdateRotate16_90
|
||||
#define Data CARD16
|
||||
#define ROTATE 90
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "shrotpack.h"
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Copyright 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define FUNC shadowUpdateRotate16_90YX
|
||||
#define Data CARD16
|
||||
#define ROTATE 90
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "shrotpackYX.h"
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define FUNC shadowUpdateRotate32
|
||||
#define Data CARD32
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "shrotpack.h"
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define FUNC shadowUpdateRotate32_180
|
||||
#define Data CARD32
|
||||
#define ROTATE 180
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "shrotpack.h"
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define FUNC shadowUpdateRotate32_270
|
||||
#define Data CARD32
|
||||
#define ROTATE 270
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "shrotpack.h"
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define FUNC shadowUpdateRotate32_90
|
||||
#define Data CARD32
|
||||
#define ROTATE 90
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "shrotpack.h"
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define FUNC shadowUpdateRotate8
|
||||
#define Data CARD8
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "shrotpack.h"
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define FUNC shadowUpdateRotate8_180
|
||||
#define Data CARD8
|
||||
#define ROTATE 180
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "shrotpack.h"
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define FUNC shadowUpdateRotate8_270
|
||||
#define Data CARD8
|
||||
#define ROTATE 270
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "shrotpack.h"
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define FUNC shadowUpdateRotate8_90
|
||||
#define Data CARD8
|
||||
#define ROTATE 90
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "shrotpack.h"
|
|
@ -1,298 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include <X11/fonts/font.h>
|
||||
#include "dixfontstr.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "mi.h"
|
||||
#include "regionstr.h"
|
||||
#include "globals.h"
|
||||
#include "gcstruct.h"
|
||||
#include "shadow.h"
|
||||
#include "fb.h"
|
||||
|
||||
/*
|
||||
* These indicate which way the source (shadow) is scanned when
|
||||
* walking the screen in a particular direction
|
||||
*/
|
||||
|
||||
#define LEFT_TO_RIGHT 1
|
||||
#define RIGHT_TO_LEFT -1
|
||||
#define TOP_TO_BOTTOM 2
|
||||
#define BOTTOM_TO_TOP -2
|
||||
|
||||
void
|
||||
shadowUpdateRotatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
|
||||
{
|
||||
RegionPtr damage = DamageRegion(pBuf->pDamage);
|
||||
PixmapPtr pShadow = pBuf->pPixmap;
|
||||
int nbox = RegionNumRects(damage);
|
||||
BoxPtr pbox = RegionRects(damage);
|
||||
FbBits *shaBits;
|
||||
FbStride shaStride;
|
||||
int shaBpp;
|
||||
_X_UNUSED int shaXoff, shaYoff;
|
||||
int box_x1, box_x2, box_y1, box_y2;
|
||||
int sha_x1 = 0, sha_y1 = 0;
|
||||
int scr_x1 = 0, scr_x2 = 0, scr_y1 = 0, scr_y2 = 0, scr_w, scr_h;
|
||||
int scr_x, scr_y;
|
||||
int w;
|
||||
int pixelsPerBits;
|
||||
int pixelsMask;
|
||||
FbStride shaStepOverY = 0, shaStepDownY = 0;
|
||||
FbStride shaStepOverX = 0, shaStepDownX = 0;
|
||||
FbBits *shaLine, *sha;
|
||||
int shaHeight = pShadow->drawable.height;
|
||||
int shaWidth = pShadow->drawable.width;
|
||||
FbBits shaMask;
|
||||
int shaFirstShift, shaShift;
|
||||
int o_x_dir;
|
||||
int o_y_dir;
|
||||
int x_dir;
|
||||
int y_dir;
|
||||
|
||||
fbGetDrawable(&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff,
|
||||
shaYoff);
|
||||
pixelsPerBits = (sizeof(FbBits) * 8) / shaBpp;
|
||||
pixelsMask = ~(pixelsPerBits - 1);
|
||||
shaMask = FbBitsMask(FB_UNIT - shaBpp, shaBpp);
|
||||
/*
|
||||
* Compute rotation related constants to walk the shadow
|
||||
*/
|
||||
o_x_dir = LEFT_TO_RIGHT;
|
||||
o_y_dir = TOP_TO_BOTTOM;
|
||||
if (pBuf->randr & SHADOW_REFLECT_X)
|
||||
o_x_dir = -o_x_dir;
|
||||
if (pBuf->randr & SHADOW_REFLECT_Y)
|
||||
o_y_dir = -o_y_dir;
|
||||
switch (pBuf->randr & (SHADOW_ROTATE_ALL)) {
|
||||
case SHADOW_ROTATE_0: /* upper left shadow -> upper left screen */
|
||||
default:
|
||||
x_dir = o_x_dir;
|
||||
y_dir = o_y_dir;
|
||||
break;
|
||||
case SHADOW_ROTATE_90: /* upper right shadow -> upper left screen */
|
||||
x_dir = o_y_dir;
|
||||
y_dir = -o_x_dir;
|
||||
break;
|
||||
case SHADOW_ROTATE_180: /* lower right shadow -> upper left screen */
|
||||
x_dir = -o_x_dir;
|
||||
y_dir = -o_y_dir;
|
||||
break;
|
||||
case SHADOW_ROTATE_270: /* lower left shadow -> upper left screen */
|
||||
x_dir = -o_y_dir;
|
||||
y_dir = o_x_dir;
|
||||
break;
|
||||
}
|
||||
switch (x_dir) {
|
||||
case LEFT_TO_RIGHT:
|
||||
shaStepOverX = shaBpp;
|
||||
shaStepOverY = 0;
|
||||
break;
|
||||
case TOP_TO_BOTTOM:
|
||||
shaStepOverX = 0;
|
||||
shaStepOverY = shaStride;
|
||||
break;
|
||||
case RIGHT_TO_LEFT:
|
||||
shaStepOverX = -shaBpp;
|
||||
shaStepOverY = 0;
|
||||
break;
|
||||
case BOTTOM_TO_TOP:
|
||||
shaStepOverX = 0;
|
||||
shaStepOverY = -shaStride;
|
||||
break;
|
||||
}
|
||||
switch (y_dir) {
|
||||
case TOP_TO_BOTTOM:
|
||||
shaStepDownX = 0;
|
||||
shaStepDownY = shaStride;
|
||||
break;
|
||||
case RIGHT_TO_LEFT:
|
||||
shaStepDownX = -shaBpp;
|
||||
shaStepDownY = 0;
|
||||
break;
|
||||
case BOTTOM_TO_TOP:
|
||||
shaStepDownX = 0;
|
||||
shaStepDownY = -shaStride;
|
||||
break;
|
||||
case LEFT_TO_RIGHT:
|
||||
shaStepDownX = shaBpp;
|
||||
shaStepDownY = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
while (nbox--) {
|
||||
box_x1 = pbox->x1;
|
||||
box_y1 = pbox->y1;
|
||||
box_x2 = pbox->x2;
|
||||
box_y2 = pbox->y2;
|
||||
pbox++;
|
||||
|
||||
/*
|
||||
* Compute screen and shadow locations for this box
|
||||
*/
|
||||
switch (x_dir) {
|
||||
case LEFT_TO_RIGHT:
|
||||
scr_x1 = box_x1 & pixelsMask;
|
||||
scr_x2 = (box_x2 + pixelsPerBits - 1) & pixelsMask;
|
||||
|
||||
sha_x1 = scr_x1;
|
||||
break;
|
||||
case TOP_TO_BOTTOM:
|
||||
scr_x1 = box_y1 & pixelsMask;
|
||||
scr_x2 = (box_y2 + pixelsPerBits - 1) & pixelsMask;
|
||||
|
||||
sha_y1 = scr_x1;
|
||||
break;
|
||||
case RIGHT_TO_LEFT:
|
||||
scr_x1 = (shaWidth - box_x2) & pixelsMask;
|
||||
scr_x2 = (shaWidth - box_x1 + pixelsPerBits - 1) & pixelsMask;
|
||||
|
||||
sha_x1 = (shaWidth - scr_x1 - 1);
|
||||
break;
|
||||
case BOTTOM_TO_TOP:
|
||||
scr_x1 = (shaHeight - box_y2) & pixelsMask;
|
||||
scr_x2 = (shaHeight - box_y1 + pixelsPerBits - 1) & pixelsMask;
|
||||
|
||||
sha_y1 = (shaHeight - scr_x1 - 1);
|
||||
break;
|
||||
}
|
||||
switch (y_dir) {
|
||||
case TOP_TO_BOTTOM:
|
||||
scr_y1 = box_y1;
|
||||
scr_y2 = box_y2;
|
||||
|
||||
sha_y1 = scr_y1;
|
||||
break;
|
||||
case RIGHT_TO_LEFT:
|
||||
scr_y1 = (shaWidth - box_x2);
|
||||
scr_y2 = (shaWidth - box_x1);
|
||||
|
||||
sha_x1 = box_x2 - 1;
|
||||
break;
|
||||
case BOTTOM_TO_TOP:
|
||||
scr_y1 = shaHeight - box_y2;
|
||||
scr_y2 = shaHeight - box_y1;
|
||||
|
||||
sha_y1 = box_y2 - 1;
|
||||
break;
|
||||
case LEFT_TO_RIGHT:
|
||||
scr_y1 = box_x1;
|
||||
scr_y2 = box_x2;
|
||||
|
||||
sha_x1 = box_x1;
|
||||
break;
|
||||
}
|
||||
scr_w = ((scr_x2 - scr_x1) * shaBpp) >> FB_SHIFT;
|
||||
scr_h = scr_y2 - scr_y1;
|
||||
scr_y = scr_y1;
|
||||
|
||||
/* shift amount for first pixel on screen */
|
||||
shaFirstShift = FB_UNIT - ((sha_x1 * shaBpp) & FB_MASK) - shaBpp;
|
||||
|
||||
/* pointer to shadow data first placed on screen */
|
||||
shaLine = (shaBits +
|
||||
sha_y1 * shaStride + ((sha_x1 * shaBpp) >> FB_SHIFT));
|
||||
|
||||
/*
|
||||
* Copy the bits, always write across the physical frame buffer
|
||||
* to take advantage of write combining.
|
||||
*/
|
||||
while (scr_h--) {
|
||||
int p;
|
||||
FbBits bits;
|
||||
FbBits *win;
|
||||
int i;
|
||||
CARD32 winSize;
|
||||
|
||||
sha = shaLine;
|
||||
shaShift = shaFirstShift;
|
||||
w = scr_w;
|
||||
scr_x = scr_x1 * shaBpp >> FB_SHIFT;
|
||||
|
||||
while (w) {
|
||||
/*
|
||||
* Map some of this line
|
||||
*/
|
||||
win = (FbBits *) (*pBuf->window) (pScreen,
|
||||
scr_y,
|
||||
scr_x << 2,
|
||||
SHADOW_WINDOW_WRITE,
|
||||
&winSize, pBuf->closure);
|
||||
i = (winSize >> 2);
|
||||
if (i > w)
|
||||
i = w;
|
||||
w -= i;
|
||||
scr_x += i;
|
||||
/*
|
||||
* Copy the portion of the line mapped
|
||||
*/
|
||||
while (i--) {
|
||||
bits = 0;
|
||||
p = pixelsPerBits;
|
||||
/*
|
||||
* Build one word of output from multiple inputs
|
||||
*
|
||||
* Note that for 90/270 rotations, this will walk
|
||||
* down the shadow hitting each scanline once.
|
||||
* This is probably not very efficient.
|
||||
*/
|
||||
while (p--) {
|
||||
bits = FbScrLeft(bits, shaBpp);
|
||||
bits |= FbScrRight(*sha, shaShift) & shaMask;
|
||||
|
||||
shaShift -= shaStepOverX;
|
||||
if (shaShift >= FB_UNIT) {
|
||||
shaShift -= FB_UNIT;
|
||||
sha--;
|
||||
}
|
||||
else if (shaShift < 0) {
|
||||
shaShift += FB_UNIT;
|
||||
sha++;
|
||||
}
|
||||
sha += shaStepOverY;
|
||||
}
|
||||
*win++ = bits;
|
||||
}
|
||||
}
|
||||
scr_y++;
|
||||
shaFirstShift -= shaStepDownX;
|
||||
if (shaFirstShift >= FB_UNIT) {
|
||||
shaFirstShift -= FB_UNIT;
|
||||
shaLine--;
|
||||
}
|
||||
else if (shaFirstShift < 0) {
|
||||
shaFirstShift += FB_UNIT;
|
||||
shaLine++;
|
||||
}
|
||||
shaLine += shaStepDownY;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,194 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* Copyright © 2000 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Thanks to Daniel Chemko <dchemko@intrinsyc.com> for making the 90 and 180
|
||||
* orientations work.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include <X11/fonts/font.h>
|
||||
#include "dixfontstr.h"
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include "mi.h"
|
||||
#include "regionstr.h"
|
||||
#include "globals.h"
|
||||
#include "gcstruct.h"
|
||||
#include "shadow.h"
|
||||
#include "fb.h"
|
||||
|
||||
#define DANDEBUG 0
|
||||
|
||||
#if ROTATE == 270
|
||||
|
||||
#define SCRLEFT(x,y,w,h) (pScreen->height - ((y) + (h)))
|
||||
#define SCRY(x,y,w,h) (x)
|
||||
#define SCRWIDTH(x,y,w,h) (h)
|
||||
#define FIRSTSHA(x,y,w,h) (((y) + (h) - 1) * shaStride + (x))
|
||||
#define STEPDOWN(x,y,w,h) ((w)--)
|
||||
#define NEXTY(x,y,w,h) ((x)++)
|
||||
#define SHASTEPX(stride) -(stride)
|
||||
#define SHASTEPY(stride) (1)
|
||||
|
||||
#elif ROTATE == 90
|
||||
|
||||
#define SCRLEFT(x,y,w,h) (y)
|
||||
#define SCRY(x,y,w,h) (pScreen->width - ((x) + (w)) - 1)
|
||||
#define SCRWIDTH(x,y,w,h) (h)
|
||||
#define FIRSTSHA(x,y,w,h) ((y) * shaStride + (x + w - 1))
|
||||
#define STEPDOWN(x,y,w,h) ((w)--)
|
||||
#define NEXTY(x,y,w,h) ((void)(x))
|
||||
#define SHASTEPX(stride) (stride)
|
||||
#define SHASTEPY(stride) (-1)
|
||||
|
||||
#elif ROTATE == 180
|
||||
|
||||
#define SCRLEFT(x,y,w,h) (pScreen->width - ((x) + (w)))
|
||||
#define SCRY(x,y,w,h) (pScreen->height - ((y) + (h)) - 1)
|
||||
#define SCRWIDTH(x,y,w,h) (w)
|
||||
#define FIRSTSHA(x,y,w,h) ((y + h - 1) * shaStride + (x + w - 1))
|
||||
#define STEPDOWN(x,y,w,h) ((h)--)
|
||||
#define NEXTY(x,y,w,h) ((void)(y))
|
||||
#define SHASTEPX(stride) (-1)
|
||||
#define SHASTEPY(stride) -(stride)
|
||||
|
||||
#else
|
||||
|
||||
#define SCRLEFT(x,y,w,h) (x)
|
||||
#define SCRY(x,y,w,h) (y)
|
||||
#define SCRWIDTH(x,y,w,h) (w)
|
||||
#define FIRSTSHA(x,y,w,h) ((y) * shaStride + (x))
|
||||
#define STEPDOWN(x,y,w,h) ((h)--)
|
||||
#define NEXTY(x,y,w,h) ((y)++)
|
||||
#define SHASTEPX(stride) (1)
|
||||
#define SHASTEPY(stride) (stride)
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
FUNC(ScreenPtr pScreen, shadowBufPtr pBuf)
|
||||
{
|
||||
RegionPtr damage = DamageRegion(pBuf->pDamage);
|
||||
PixmapPtr pShadow = pBuf->pPixmap;
|
||||
int nbox = RegionNumRects(damage);
|
||||
BoxPtr pbox = RegionRects(damage);
|
||||
FbBits *shaBits;
|
||||
Data *shaBase, *shaLine, *sha;
|
||||
FbStride shaStride;
|
||||
int scrBase, scrLine, scr;
|
||||
int shaBpp;
|
||||
_X_UNUSED int shaXoff, shaYoff;
|
||||
int x, y, w, h, width;
|
||||
int i;
|
||||
Data *winBase = NULL, *win;
|
||||
CARD32 winSize;
|
||||
|
||||
fbGetDrawable(&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff,
|
||||
shaYoff);
|
||||
shaBase = (Data *) shaBits;
|
||||
shaStride = shaStride * sizeof(FbBits) / sizeof(Data);
|
||||
#if (DANDEBUG > 1)
|
||||
ErrorF
|
||||
("-> Entering Shadow Update:\r\n |- Origins: pShadow=%x, pScreen=%x, damage=%x\r\n |- Metrics: shaStride=%d, shaBase=%x, shaBpp=%d\r\n | \n",
|
||||
pShadow, pScreen, damage, shaStride, shaBase, shaBpp);
|
||||
#endif
|
||||
while (nbox--) {
|
||||
x = pbox->x1;
|
||||
y = pbox->y1;
|
||||
w = (pbox->x2 - pbox->x1);
|
||||
h = pbox->y2 - pbox->y1;
|
||||
|
||||
#if (DANDEBUG > 2)
|
||||
ErrorF
|
||||
(" |-> Redrawing box - Metrics: X=%d, Y=%d, Width=%d, Height=%d\n",
|
||||
x, y, w, h);
|
||||
#endif
|
||||
scrLine = SCRLEFT(x, y, w, h);
|
||||
shaLine = shaBase + FIRSTSHA(x, y, w, h);
|
||||
|
||||
while (STEPDOWN(x, y, w, h)) {
|
||||
winSize = 0;
|
||||
scrBase = 0;
|
||||
width = SCRWIDTH(x, y, w, h);
|
||||
scr = scrLine;
|
||||
sha = shaLine;
|
||||
#if (DANDEBUG > 3)
|
||||
ErrorF(" | |-> StepDown - Metrics: width=%d, scr=%x, sha=%x\n",
|
||||
width, scr, sha);
|
||||
#endif
|
||||
while (width) {
|
||||
/* how much remains in this window */
|
||||
i = scrBase + winSize - scr;
|
||||
if (i <= 0 || scr < scrBase) {
|
||||
winBase = (Data *) (*pBuf->window) (pScreen,
|
||||
SCRY(x, y, w, h),
|
||||
scr * sizeof(Data),
|
||||
SHADOW_WINDOW_WRITE,
|
||||
&winSize,
|
||||
pBuf->closure);
|
||||
if (!winBase)
|
||||
return;
|
||||
scrBase = scr;
|
||||
winSize /= sizeof(Data);
|
||||
i = winSize;
|
||||
#if(DANDEBUG > 4)
|
||||
ErrorF
|
||||
(" | | |-> Starting New Line - Metrics: winBase=%x, scrBase=%x, winSize=%d\r\n | | | Xstride=%d, Ystride=%d, w=%d h=%d\n",
|
||||
winBase, scrBase, winSize, SHASTEPX(shaStride),
|
||||
SHASTEPY(shaStride), w, h);
|
||||
#endif
|
||||
}
|
||||
win = winBase + (scr - scrBase);
|
||||
if (i > width)
|
||||
i = width;
|
||||
width -= i;
|
||||
scr += i;
|
||||
#if(DANDEBUG > 5)
|
||||
ErrorF
|
||||
(" | | |-> Writing Line - Metrics: win=%x, sha=%x\n",
|
||||
win, sha);
|
||||
#endif
|
||||
while (i--) {
|
||||
#if(DANDEBUG > 6)
|
||||
ErrorF
|
||||
(" | | |-> Writing Pixel - Metrics: win=%x, sha=%d, remaining=%d\n",
|
||||
win, sha, i);
|
||||
#endif
|
||||
*win++ = *sha;
|
||||
sha += SHASTEPX(shaStride);
|
||||
} /* i */
|
||||
} /* width */
|
||||
shaLine += SHASTEPY(shaStride);
|
||||
NEXTY(x, y, w, h);
|
||||
} /* STEPDOWN */
|
||||
pbox++;
|
||||
} /* nbox */
|
||||
}
|
|
@ -1,152 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2004 Philip Blundell
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Philip Blundell not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Philip Blundell makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* PHILIP BLUNDELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL PHILIP BLUNDELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "dixfontstr.h"
|
||||
#include "mi.h"
|
||||
#include "regionstr.h"
|
||||
#include "globals.h"
|
||||
#include "gcstruct.h"
|
||||
#include "shadow.h"
|
||||
#include "fb.h"
|
||||
|
||||
#if ROTATE == 270
|
||||
|
||||
#define WINSTEPX(stride) (stride)
|
||||
#define WINSTART(x,y) (((pScreen->height - 1) - y) + (x * winStride))
|
||||
#define WINSTEPY() -1
|
||||
|
||||
#elif ROTATE == 90
|
||||
|
||||
#define WINSTEPX(stride) (-stride)
|
||||
#define WINSTEPY() 1
|
||||
#define WINSTART(x,y) (((pScreen->width - 1 - x) * winStride) + y)
|
||||
|
||||
#else
|
||||
|
||||
#error This rotation is not supported here
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __arm__
|
||||
#define PREFETCH
|
||||
#endif
|
||||
|
||||
void
|
||||
FUNC(ScreenPtr pScreen, shadowBufPtr pBuf)
|
||||
{
|
||||
RegionPtr damage = DamageRegion(pBuf->pDamage);
|
||||
PixmapPtr pShadow = pBuf->pPixmap;
|
||||
int nbox = RegionNumRects(damage);
|
||||
BoxPtr pbox = RegionRects(damage);
|
||||
FbBits *shaBits;
|
||||
Data *shaBase, *shaLine, *sha;
|
||||
FbStride shaStride, winStride;
|
||||
int shaBpp;
|
||||
_X_UNUSED int shaXoff, shaYoff;
|
||||
int x, y, w, h;
|
||||
Data *winBase, *win, *winLine;
|
||||
CARD32 winSize;
|
||||
|
||||
fbGetDrawable(&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff,
|
||||
shaYoff);
|
||||
shaBase = (Data *) shaBits;
|
||||
shaStride = shaStride * sizeof(FbBits) / sizeof(Data);
|
||||
|
||||
winBase = (Data *) (*pBuf->window) (pScreen, 0, 0,
|
||||
SHADOW_WINDOW_WRITE,
|
||||
&winSize, pBuf->closure);
|
||||
winStride = (Data *) (*pBuf->window) (pScreen, 1, 0,
|
||||
SHADOW_WINDOW_WRITE,
|
||||
&winSize, pBuf->closure) - winBase;
|
||||
|
||||
while (nbox--) {
|
||||
x = pbox->x1;
|
||||
y = pbox->y1;
|
||||
w = (pbox->x2 - pbox->x1);
|
||||
h = pbox->y2 - pbox->y1;
|
||||
|
||||
shaLine = shaBase + (y * shaStride) + x;
|
||||
#ifdef PREFETCH
|
||||
__builtin_prefetch(shaLine);
|
||||
#endif
|
||||
winLine = winBase + WINSTART(x, y);
|
||||
|
||||
while (h--) {
|
||||
sha = shaLine;
|
||||
win = winLine;
|
||||
|
||||
while (sha < (shaLine + w - 16)) {
|
||||
#ifdef PREFETCH
|
||||
__builtin_prefetch(sha + shaStride);
|
||||
#endif
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
}
|
||||
|
||||
while (sha < (shaLine + w)) {
|
||||
*win = *sha++;
|
||||
win += WINSTEPX(winStride);
|
||||
}
|
||||
|
||||
y++;
|
||||
shaLine += shaStride;
|
||||
winLine += WINSTEPY();
|
||||
}
|
||||
pbox++;
|
||||
} /* nbox */
|
||||
}
|
Loading…
Reference in New Issue
Block a user