[PATCH xserver 10/11] shadow: Macro cleanup

Adam Jackson ajax at redhat.com
Fri Dec 9 19:52:37 UTC 2016


shadowDamage is just obfuscation. The other two macros won't work
outside shadow.c since the private key is in fact static there (meaning
the extern decl is a lie).

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 hw/xwin/winshadddnl.c      | 2 +-
 hw/xwin/winshadgdi.c       | 2 +-
 miext/shadow/sh3224.c      | 2 +-
 miext/shadow/shadow.c      | 5 ++++-
 miext/shadow/shadow.h      | 7 -------
 miext/shadow/shafb4.c      | 2 +-
 miext/shadow/shafb8.c      | 2 +-
 miext/shadow/shiplan2p4.c  | 2 +-
 miext/shadow/shiplan2p8.c  | 2 +-
 miext/shadow/shpacked.c    | 2 +-
 miext/shadow/shplanar.c    | 2 +-
 miext/shadow/shplanar8.c   | 2 +-
 miext/shadow/shrotate.c    | 2 +-
 miext/shadow/shrotpack.h   | 2 +-
 miext/shadow/shrotpackYX.h | 2 +-
 15 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c
index 0ec5246..6ad32eb 100644
--- a/hw/xwin/winshadddnl.c
+++ b/hw/xwin/winshadddnl.c
@@ -520,7 +520,7 @@ winShadowUpdateDDNL(ScreenPtr pScreen, shadowBufPtr pBuf)
 {
     winScreenPriv(pScreen);
     winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-    RegionPtr damage = shadowDamage(pBuf);
+    RegionPtr damage = DamageRegion(pBuf->pDamage);
     HRESULT ddrval = DD_OK;
     RECT rcDest, rcSrc;
     POINT ptOrigin;
diff --git a/hw/xwin/winshadgdi.c b/hw/xwin/winshadgdi.c
index 22836c5..705cdfb 100644
--- a/hw/xwin/winshadgdi.c
+++ b/hw/xwin/winshadgdi.c
@@ -434,7 +434,7 @@ winShadowUpdateGDI(ScreenPtr pScreen, shadowBufPtr pBuf)
 {
     winScreenPriv(pScreen);
     winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-    RegionPtr damage = shadowDamage(pBuf);
+    RegionPtr damage = DamageRegion(pBuf->pDamage);
     DWORD dwBox = RegionNumRects(damage);
     BoxPtr pBox = RegionRects(damage);
     int x, y, w, h;
diff --git a/miext/shadow/sh3224.c b/miext/shadow/sh3224.c
index ba54121..5d8f274 100644
--- a/miext/shadow/sh3224.c
+++ b/miext/shadow/sh3224.c
@@ -100,7 +100,7 @@ sh24_32BltLine(CARD8 *srcLine,
 void
 shadowUpdate32to24(ScreenPtr pScreen, shadowBufPtr pBuf)
 {
-    RegionPtr damage = shadowDamage(pBuf);
+    RegionPtr damage = DamageRegion(pBuf->pDamage);
     PixmapPtr pShadow = pBuf->pPixmap;
     int nbox = RegionNumRects(damage);
     BoxPtr pbox = RegionRects(damage);
diff --git a/miext/shadow/shadow.c b/miext/shadow/shadow.c
index b8e23da..529402d 100644
--- a/miext/shadow/shadow.c
+++ b/miext/shadow/shadow.c
@@ -37,9 +37,12 @@
 #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; \
diff --git a/miext/shadow/shadow.h b/miext/shadow/shadow.h
index c9a4100..b8cd1b5 100644
--- a/miext/shadow/shadow.h
+++ b/miext/shadow/shadow.h
@@ -68,13 +68,6 @@ typedef struct _shadowBuf {
 #define SHADOW_REFLECT_Y    32
 #define SHADOW_REFLECT_ALL  (SHADOW_REFLECT_X|SHADOW_REFLECT_Y)
 
-extern _X_EXPORT DevPrivateKey shadowScrPrivateKey;
-
-#define shadowGetBuf(pScr) ((shadowBufPtr) \
-    dixLookupPrivate(&(pScr)->devPrivates, shadowScrPrivateKey))
-#define shadowBuf(pScr)            shadowBufPtr pBuf = shadowGetBuf(pScr)
-#define shadowDamage(pBuf)  DamageRegion(pBuf->pDamage)
-
 extern _X_EXPORT Bool
  shadowSetup(ScreenPtr pScreen);
 
diff --git a/miext/shadow/shafb4.c b/miext/shadow/shafb4.c
index d88ae1c..ae59e2d 100644
--- a/miext/shadow/shafb4.c
+++ b/miext/shadow/shafb4.c
@@ -80,7 +80,7 @@ static inline void store_afb4(void *dst, unsigned int stride,
 void
 shadowUpdateAfb4(ScreenPtr pScreen, shadowBufPtr pBuf)
 {
-    RegionPtr damage = shadowDamage(pBuf);
+    RegionPtr damage = DamageRegion(pBuf->pDamage);
     PixmapPtr pShadow = pBuf->pPixmap;
     int nbox = RegionNumRects(damage);
     BoxPtr pbox = RegionRects(damage);
diff --git a/miext/shadow/shafb8.c b/miext/shadow/shafb8.c
index 8d84bfa..d2b73fc 100644
--- a/miext/shadow/shafb8.c
+++ b/miext/shadow/shafb8.c
@@ -84,7 +84,7 @@ static inline void store_afb8(void *dst, unsigned int stride,
 void
 shadowUpdateAfb8(ScreenPtr pScreen, shadowBufPtr pBuf)
 {
-    RegionPtr damage = shadowDamage(pBuf);
+    RegionPtr damage = DamageRegion(pBuf->pDamage);
     PixmapPtr pShadow = pBuf->pPixmap;
     int nbox = RegionNumRects(damage);
     BoxPtr pbox = RegionRects(damage);
diff --git a/miext/shadow/shiplan2p4.c b/miext/shadow/shiplan2p4.c
index 0e46bae..f37c58d 100644
--- a/miext/shadow/shiplan2p4.c
+++ b/miext/shadow/shiplan2p4.c
@@ -78,7 +78,7 @@ static inline void store_iplan2p4(void *dst, const CARD32 d[2])
 void
 shadowUpdateIplan2p4(ScreenPtr pScreen, shadowBufPtr pBuf)
 {
-    RegionPtr damage = shadowDamage(pBuf);
+    RegionPtr damage = DamageRegion(pBuf->pDamage);
     PixmapPtr pShadow = pBuf->pPixmap;
     int nbox = RegionNumRects(damage);
     BoxPtr pbox = RegionRects(damage);
diff --git a/miext/shadow/shiplan2p8.c b/miext/shadow/shiplan2p8.c
index 17d6a13..44cb8d3 100644
--- a/miext/shadow/shiplan2p8.c
+++ b/miext/shadow/shiplan2p8.c
@@ -79,7 +79,7 @@ static inline void store_iplan2p8(void *dst, const CARD32 d[4])
 void
 shadowUpdateIplan2p8(ScreenPtr pScreen, shadowBufPtr pBuf)
 {
-    RegionPtr damage = shadowDamage(pBuf);
+    RegionPtr damage = DamageRegion(pBuf->pDamage);
     PixmapPtr pShadow = pBuf->pPixmap;
     int nbox = RegionNumRects(damage);
     BoxPtr pbox = RegionRects(damage);
diff --git a/miext/shadow/shpacked.c b/miext/shadow/shpacked.c
index 34527bc..5220854 100644
--- a/miext/shadow/shpacked.c
+++ b/miext/shadow/shpacked.c
@@ -43,7 +43,7 @@
 void
 shadowUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
 {
-    RegionPtr damage = shadowDamage(pBuf);
+    RegionPtr damage = DamageRegion(pBuf->pDamage);
     PixmapPtr pShadow = pBuf->pPixmap;
     int nbox = RegionNumRects(damage);
     BoxPtr pbox = RegionRects(damage);
diff --git a/miext/shadow/shplanar.c b/miext/shadow/shplanar.c
index cb5fc54..92c7971 100644
--- a/miext/shadow/shplanar.c
+++ b/miext/shadow/shplanar.c
@@ -89,7 +89,7 @@
 void
 shadowUpdatePlanar4(ScreenPtr pScreen, shadowBufPtr pBuf)
 {
-    RegionPtr damage = shadowDamage(pBuf);
+    RegionPtr damage = DamageRegion(pBuf->pDamage);
     PixmapPtr pShadow = pBuf->pPixmap;
     int nbox = RegionNumRects(damage);
     BoxPtr pbox = RegionRects(damage);
diff --git a/miext/shadow/shplanar8.c b/miext/shadow/shplanar8.c
index 214fa9a..4123359 100644
--- a/miext/shadow/shplanar8.c
+++ b/miext/shadow/shplanar8.c
@@ -92,7 +92,7 @@
 void
 shadowUpdatePlanar4x8(ScreenPtr pScreen, shadowBufPtr pBuf)
 {
-    RegionPtr damage = shadowDamage(pBuf);
+    RegionPtr damage = DamageRegion(pBuf->pDamage);
     PixmapPtr pShadow = pBuf->pPixmap;
     int nbox = RegionNumRects(damage);
     BoxPtr pbox = RegionRects(damage);
diff --git a/miext/shadow/shrotate.c b/miext/shadow/shrotate.c
index 7dc471f..1745537 100644
--- a/miext/shadow/shrotate.c
+++ b/miext/shadow/shrotate.c
@@ -51,7 +51,7 @@
 void
 shadowUpdateRotatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
 {
-    RegionPtr damage = shadowDamage(pBuf);
+    RegionPtr damage = DamageRegion(pBuf->pDamage);
     PixmapPtr pShadow = pBuf->pPixmap;
     int nbox = RegionNumRects(damage);
     BoxPtr pbox = RegionRects(damage);
diff --git a/miext/shadow/shrotpack.h b/miext/shadow/shrotpack.h
index b1cb30d..4814991 100644
--- a/miext/shadow/shrotpack.h
+++ b/miext/shadow/shrotpack.h
@@ -96,7 +96,7 @@
 void
 FUNC(ScreenPtr pScreen, shadowBufPtr pBuf)
 {
-    RegionPtr damage = shadowDamage(pBuf);
+    RegionPtr damage = DamageRegion(pBuf->pDamage);
     PixmapPtr pShadow = pBuf->pPixmap;
     int nbox = RegionNumRects(damage);
     BoxPtr pbox = RegionRects(damage);
diff --git a/miext/shadow/shrotpackYX.h b/miext/shadow/shrotpackYX.h
index f3df6c5..3c5b3a1 100644
--- a/miext/shadow/shrotpackYX.h
+++ b/miext/shadow/shrotpackYX.h
@@ -56,7 +56,7 @@
 void
 FUNC(ScreenPtr pScreen, shadowBufPtr pBuf)
 {
-    RegionPtr damage = shadowDamage(pBuf);
+    RegionPtr damage = DamageRegion(pBuf->pDamage);
     PixmapPtr pShadow = pBuf->pPixmap;
     int nbox = RegionNumRects(damage);
     BoxPtr pbox = RegionRects(damage);
-- 
2.9.3



More information about the xorg-devel mailing list