dix/render: consolidate window format matching code.
This code existed in 3 different forms, perhaps it should be consolidated. Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
a7b97b0fa8
commit
957bf959fb
|
@ -560,8 +560,8 @@ compNewPixmap(WindowPtr pWin, int x, int y, int w, int h)
|
|||
}
|
||||
}
|
||||
else {
|
||||
PictFormatPtr pSrcFormat = compWindowFormat(pParent);
|
||||
PictFormatPtr pDstFormat = compWindowFormat(pWin);
|
||||
PictFormatPtr pSrcFormat = PictureWindowFormat(pParent);
|
||||
PictFormatPtr pDstFormat = PictureWindowFormat(pWin);
|
||||
XID inferiors = IncludeInferiors;
|
||||
int error;
|
||||
|
||||
|
|
|
@ -272,8 +272,6 @@ void
|
|||
#define compCheckTree(s)
|
||||
#endif
|
||||
|
||||
PictFormatPtr compWindowFormat(WindowPtr pWin);
|
||||
|
||||
void
|
||||
compSetPixmap(WindowPtr pWin, PixmapPtr pPixmap);
|
||||
|
||||
|
|
|
@ -631,28 +631,6 @@ compGetRedirectBorderClip(WindowPtr pWin)
|
|||
return &cw->borderClip;
|
||||
}
|
||||
|
||||
static VisualPtr
|
||||
compGetWindowVisual(WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
VisualID vid = wVisual(pWin);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pScreen->numVisuals; i++)
|
||||
if (pScreen->visuals[i].vid == vid)
|
||||
return &pScreen->visuals[i];
|
||||
return 0;
|
||||
}
|
||||
|
||||
PictFormatPtr
|
||||
compWindowFormat(WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
|
||||
return PictureMatchVisual(pScreen, pWin->drawable.depth,
|
||||
compGetWindowVisual(pWin));
|
||||
}
|
||||
|
||||
static void
|
||||
compWindowUpdateAutomatic(WindowPtr pWin)
|
||||
{
|
||||
|
@ -660,8 +638,8 @@ compWindowUpdateAutomatic(WindowPtr pWin)
|
|||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
WindowPtr pParent = pWin->parent;
|
||||
PixmapPtr pSrcPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||
PictFormatPtr pSrcFormat = compWindowFormat(pWin);
|
||||
PictFormatPtr pDstFormat = compWindowFormat(pWin->parent);
|
||||
PictFormatPtr pSrcFormat = PictureWindowFormat(pWin);
|
||||
PictFormatPtr pDstFormat = PictureWindowFormat(pWin->parent);
|
||||
int error;
|
||||
RegionPtr pRegion = DamageRegion(cw->damage);
|
||||
PicturePtr pSrcPicture = CreatePicture(0, &pSrcPixmap->drawable,
|
||||
|
|
13
dix/window.c
13
dix/window.c
|
@ -3660,3 +3660,16 @@ SetRootClip(ScreenPtr pScreen, Bool enable)
|
|||
WindowsRestructured();
|
||||
FlushAllOutput();
|
||||
}
|
||||
|
||||
VisualPtr
|
||||
WindowGetVisual(WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
VisualID vid = wVisual(pWin);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pScreen->numVisuals; i++)
|
||||
if (pScreen->visuals[i].vid == vid)
|
||||
return &pScreen->visuals[i];
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -46,28 +46,6 @@
|
|||
|
||||
/* borrowed from composite extension, move to Render and publish? */
|
||||
|
||||
static VisualPtr
|
||||
compGetWindowVisual(WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
VisualID vid = wVisual(pWin);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pScreen->numVisuals; i++)
|
||||
if (pScreen->visuals[i].vid == vid)
|
||||
return &pScreen->visuals[i];
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PictFormatPtr
|
||||
compWindowFormat(WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
|
||||
return PictureMatchVisual(pScreen, pWin->drawable.depth,
|
||||
compGetWindowVisual(pWin));
|
||||
}
|
||||
|
||||
#define F(x) IntToxFixed(x)
|
||||
|
||||
#define toF(x) ((float) (x) / 65536.0f)
|
||||
|
@ -79,7 +57,7 @@ xf86RotateCrtcRedisplay(xf86CrtcPtr crtc, RegionPtr region)
|
|||
ScreenPtr screen = scrn->pScreen;
|
||||
WindowPtr root = screen->root;
|
||||
PixmapPtr dst_pixmap = crtc->rotatedPixmap;
|
||||
PictFormatPtr format = compWindowFormat(screen->root);
|
||||
PictFormatPtr format = PictureWindowFormat(screen->root);
|
||||
int error;
|
||||
PicturePtr src, dst;
|
||||
int n = RegionNumRects(region);
|
||||
|
|
|
@ -229,4 +229,5 @@ extern _X_EXPORT void EnableMapUnmapEvents(WindowPtr /* pWin */ );
|
|||
extern _X_EXPORT void SetRootClip(ScreenPtr pScreen, Bool enable);
|
||||
extern _X_EXPORT void PrintWindowTree(void);
|
||||
|
||||
extern _X_EXPORT VisualPtr WindowGetVisual(WindowPtr /*pWin*/);
|
||||
#endif /* WINDOW_H */
|
||||
|
|
|
@ -151,19 +151,6 @@ miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
|
|||
#ifdef ARGB_CURSOR
|
||||
#define EnsurePicture(picture,draw,win) (picture || miDCMakePicture(&picture,draw,win))
|
||||
|
||||
static VisualPtr
|
||||
miDCGetWindowVisual(WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
VisualID vid = wVisual(pWin);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pScreen->numVisuals; i++)
|
||||
if (pScreen->visuals[i].vid == vid)
|
||||
return &pScreen->visuals[i];
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PicturePtr
|
||||
miDCMakePicture(PicturePtr * ppPicture, DrawablePtr pDraw, WindowPtr pWin)
|
||||
{
|
||||
|
@ -174,10 +161,7 @@ miDCMakePicture(PicturePtr * ppPicture, DrawablePtr pDraw, WindowPtr pWin)
|
|||
PicturePtr pPicture;
|
||||
int error;
|
||||
|
||||
pVisual = miDCGetWindowVisual(pWin);
|
||||
if (!pVisual)
|
||||
return 0;
|
||||
pFormat = PictureMatchVisual(pScreen, pDraw->depth, pVisual);
|
||||
pFormat = PictureWindowFormat(pWin);
|
||||
if (!pFormat)
|
||||
return 0;
|
||||
pPicture = CreatePicture(0, pDraw, pFormat,
|
||||
|
|
|
@ -50,6 +50,14 @@ RESTYPE PictFormatType;
|
|||
RESTYPE GlyphSetType;
|
||||
int PictureCmapPolicy = PictureCmapPolicyDefault;
|
||||
|
||||
PictFormatPtr
|
||||
PictureWindowFormat(WindowPtr pWindow)
|
||||
{
|
||||
ScreenPtr pScreen = pWindow->drawable.pScreen;
|
||||
return PictureMatchVisual(pScreen, pWindow->drawable.depth,
|
||||
WindowGetVisual(pWindow));
|
||||
}
|
||||
|
||||
Bool
|
||||
PictureDestroyWindow(WindowPtr pWindow)
|
||||
{
|
||||
|
|
|
@ -377,6 +377,9 @@ extern _X_EXPORT RESTYPE GlyphSetType;
|
|||
} \
|
||||
} \
|
||||
|
||||
extern _X_EXPORT PictFormatPtr
|
||||
PictureWindowFormat(WindowPtr pWindow);
|
||||
|
||||
extern _X_EXPORT Bool
|
||||
PictureDestroyWindow(WindowPtr pWindow);
|
||||
|
||||
|
|
Loading…
Reference in New Issue