On Wed, Jun 27, 2012 at 9:36 AM, Dave Airlie <[email protected]> wrote: > From: Dave Airlie <[email protected]> > > This code existed in 3 different forms, perhaps it should be > consolidated. > > Reviewed-by: Keith Packard <[email protected]> > Signed-off-by: Dave Airlie <[email protected]>
Reviewed-by: Alex Deucher <[email protected]> > --- > composite/compalloc.c | 4 ++-- > composite/compint.h | 2 -- > composite/compwindow.c | 26 ++------------------------ > dix/window.c | 13 +++++++++++++ > hw/xfree86/modes/xf86Rotate.c | 24 +----------------------- > include/window.h | 1 + > mi/midispcur.c | 18 +----------------- > render/picture.c | 8 ++++++++ > render/picturestr.h | 3 +++ > 9 files changed, 31 insertions(+), 68 deletions(-) > > diff --git a/composite/compalloc.c b/composite/compalloc.c > index b958b09..cc69c68 100644 > --- a/composite/compalloc.c > +++ b/composite/compalloc.c > @@ -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; > > diff --git a/composite/compint.h b/composite/compint.h > index 9e2713e..30b724e 100644 > --- a/composite/compint.h > +++ b/composite/compint.h > @@ -272,8 +272,6 @@ void > #define compCheckTree(s) > #endif > > -PictFormatPtr compWindowFormat(WindowPtr pWin); > - > void > compSetPixmap(WindowPtr pWin, PixmapPtr pPixmap); > > diff --git a/composite/compwindow.c b/composite/compwindow.c > index 6eb624b..d0bcd18 100644 > --- a/composite/compwindow.c > +++ b/composite/compwindow.c > @@ -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, > diff --git a/dix/window.c b/dix/window.c > index 98f5604..5cc3a50 100644 > --- a/dix/window.c > +++ b/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; > +} > diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c > index 6a661e1..31e0372 100644 > --- a/hw/xfree86/modes/xf86Rotate.c > +++ b/hw/xfree86/modes/xf86Rotate.c > @@ -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); > diff --git a/include/window.h b/include/window.h > index 64c56ae..7842b4d 100644 > --- a/include/window.h > +++ b/include/window.h > @@ -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 */ > diff --git a/mi/midispcur.c b/mi/midispcur.c > index 9ee8242..df141cd 100644 > --- a/mi/midispcur.c > +++ b/mi/midispcur.c > @@ -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, > diff --git a/render/picture.c b/render/picture.c > index 7887853..ebbfa29 100644 > --- a/render/picture.c > +++ b/render/picture.c > @@ -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) > { > diff --git a/render/picturestr.h b/render/picturestr.h > index 6da5656..1cda88a 100644 > --- a/render/picturestr.h > +++ b/render/picturestr.h > @@ -377,6 +377,9 @@ extern _X_EXPORT RESTYPE GlyphSetType; > } \ > } \ > > +extern _X_EXPORT PictFormatPtr > + PictureWindowFormat(WindowPtr pWindow); > + > extern _X_EXPORT Bool > PictureDestroyWindow(WindowPtr pWindow); > > -- > 1.7.10.2 > > _______________________________________________ > [email protected]: X.Org development > Archives: http://lists.x.org/archives/xorg-devel > Info: http://lists.x.org/mailman/listinfo/xorg-devel _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
