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 {
|
else {
|
||||||
PictFormatPtr pSrcFormat = compWindowFormat(pParent);
|
PictFormatPtr pSrcFormat = PictureWindowFormat(pParent);
|
||||||
PictFormatPtr pDstFormat = compWindowFormat(pWin);
|
PictFormatPtr pDstFormat = PictureWindowFormat(pWin);
|
||||||
XID inferiors = IncludeInferiors;
|
XID inferiors = IncludeInferiors;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
|
|
@ -272,8 +272,6 @@ void
|
||||||
#define compCheckTree(s)
|
#define compCheckTree(s)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PictFormatPtr compWindowFormat(WindowPtr pWin);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
compSetPixmap(WindowPtr pWin, PixmapPtr pPixmap);
|
compSetPixmap(WindowPtr pWin, PixmapPtr pPixmap);
|
||||||
|
|
||||||
|
|
|
@ -631,28 +631,6 @@ compGetRedirectBorderClip(WindowPtr pWin)
|
||||||
return &cw->borderClip;
|
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
|
static void
|
||||||
compWindowUpdateAutomatic(WindowPtr pWin)
|
compWindowUpdateAutomatic(WindowPtr pWin)
|
||||||
{
|
{
|
||||||
|
@ -660,8 +638,8 @@ compWindowUpdateAutomatic(WindowPtr pWin)
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||||
WindowPtr pParent = pWin->parent;
|
WindowPtr pParent = pWin->parent;
|
||||||
PixmapPtr pSrcPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
PixmapPtr pSrcPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||||
PictFormatPtr pSrcFormat = compWindowFormat(pWin);
|
PictFormatPtr pSrcFormat = PictureWindowFormat(pWin);
|
||||||
PictFormatPtr pDstFormat = compWindowFormat(pWin->parent);
|
PictFormatPtr pDstFormat = PictureWindowFormat(pWin->parent);
|
||||||
int error;
|
int error;
|
||||||
RegionPtr pRegion = DamageRegion(cw->damage);
|
RegionPtr pRegion = DamageRegion(cw->damage);
|
||||||
PicturePtr pSrcPicture = CreatePicture(0, &pSrcPixmap->drawable,
|
PicturePtr pSrcPicture = CreatePicture(0, &pSrcPixmap->drawable,
|
||||||
|
|
13
dix/window.c
13
dix/window.c
|
@ -3660,3 +3660,16 @@ SetRootClip(ScreenPtr pScreen, Bool enable)
|
||||||
WindowsRestructured();
|
WindowsRestructured();
|
||||||
FlushAllOutput();
|
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? */
|
/* 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 F(x) IntToxFixed(x)
|
||||||
|
|
||||||
#define toF(x) ((float) (x) / 65536.0f)
|
#define toF(x) ((float) (x) / 65536.0f)
|
||||||
|
@ -79,7 +57,7 @@ xf86RotateCrtcRedisplay(xf86CrtcPtr crtc, RegionPtr region)
|
||||||
ScreenPtr screen = scrn->pScreen;
|
ScreenPtr screen = scrn->pScreen;
|
||||||
WindowPtr root = screen->root;
|
WindowPtr root = screen->root;
|
||||||
PixmapPtr dst_pixmap = crtc->rotatedPixmap;
|
PixmapPtr dst_pixmap = crtc->rotatedPixmap;
|
||||||
PictFormatPtr format = compWindowFormat(screen->root);
|
PictFormatPtr format = PictureWindowFormat(screen->root);
|
||||||
int error;
|
int error;
|
||||||
PicturePtr src, dst;
|
PicturePtr src, dst;
|
||||||
int n = RegionNumRects(region);
|
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 SetRootClip(ScreenPtr pScreen, Bool enable);
|
||||||
extern _X_EXPORT void PrintWindowTree(void);
|
extern _X_EXPORT void PrintWindowTree(void);
|
||||||
|
|
||||||
|
extern _X_EXPORT VisualPtr WindowGetVisual(WindowPtr /*pWin*/);
|
||||||
#endif /* WINDOW_H */
|
#endif /* WINDOW_H */
|
||||||
|
|
|
@ -151,19 +151,6 @@ miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
|
||||||
#ifdef ARGB_CURSOR
|
#ifdef ARGB_CURSOR
|
||||||
#define EnsurePicture(picture,draw,win) (picture || miDCMakePicture(&picture,draw,win))
|
#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
|
static PicturePtr
|
||||||
miDCMakePicture(PicturePtr * ppPicture, DrawablePtr pDraw, WindowPtr pWin)
|
miDCMakePicture(PicturePtr * ppPicture, DrawablePtr pDraw, WindowPtr pWin)
|
||||||
{
|
{
|
||||||
|
@ -174,10 +161,7 @@ miDCMakePicture(PicturePtr * ppPicture, DrawablePtr pDraw, WindowPtr pWin)
|
||||||
PicturePtr pPicture;
|
PicturePtr pPicture;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
pVisual = miDCGetWindowVisual(pWin);
|
pFormat = PictureWindowFormat(pWin);
|
||||||
if (!pVisual)
|
|
||||||
return 0;
|
|
||||||
pFormat = PictureMatchVisual(pScreen, pDraw->depth, pVisual);
|
|
||||||
if (!pFormat)
|
if (!pFormat)
|
||||||
return 0;
|
return 0;
|
||||||
pPicture = CreatePicture(0, pDraw, pFormat,
|
pPicture = CreatePicture(0, pDraw, pFormat,
|
||||||
|
|
|
@ -50,6 +50,14 @@ RESTYPE PictFormatType;
|
||||||
RESTYPE GlyphSetType;
|
RESTYPE GlyphSetType;
|
||||||
int PictureCmapPolicy = PictureCmapPolicyDefault;
|
int PictureCmapPolicy = PictureCmapPolicyDefault;
|
||||||
|
|
||||||
|
PictFormatPtr
|
||||||
|
PictureWindowFormat(WindowPtr pWindow)
|
||||||
|
{
|
||||||
|
ScreenPtr pScreen = pWindow->drawable.pScreen;
|
||||||
|
return PictureMatchVisual(pScreen, pWindow->drawable.depth,
|
||||||
|
WindowGetVisual(pWindow));
|
||||||
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
PictureDestroyWindow(WindowPtr pWindow)
|
PictureDestroyWindow(WindowPtr pWindow)
|
||||||
{
|
{
|
||||||
|
|
|
@ -377,6 +377,9 @@ extern _X_EXPORT RESTYPE GlyphSetType;
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
|
extern _X_EXPORT PictFormatPtr
|
||||||
|
PictureWindowFormat(WindowPtr pWindow);
|
||||||
|
|
||||||
extern _X_EXPORT Bool
|
extern _X_EXPORT Bool
|
||||||
PictureDestroyWindow(WindowPtr pWindow);
|
PictureDestroyWindow(WindowPtr pWindow);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user