From 634a504ce1cd95c09640ffe59d6eeff551066f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Fri, 25 Nov 2011 01:56:56 +0100 Subject: [PATCH] straighten xrender shadow implementation did not publish function & enum in the baseclass, but inlined the accessor REVIEW: 103232 (cherry picked from commit ecfa39ac3ca1c9823a6b320ff0f7a60ab32f0418) --- scene_xrender.cpp | 36 ++---------------------------------- scene_xrender.h | 19 +++++++++++-------- shadow.h | 4 +++- 3 files changed, 16 insertions(+), 43 deletions(-) diff --git a/scene_xrender.cpp b/scene_xrender.cpp index f0a775c608..96adee297f 100644 --- a/scene_xrender.cpp +++ b/scene_xrender.cpp @@ -707,7 +707,7 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintDat for (PaintClipper::Iterator iterator; !iterator.isDone(); iterator.next()) { #define RENDER_SHADOW_TILE(_TILE_, _RECT_) \ -XRenderComposite(display(), PictOpOver, m_xrenderShadow->x11ShadowPictureHandle(WindowQuadShadow##_TILE_), \ +XRenderComposite(display(), PictOpOver, m_xrenderShadow->shadowPixmap(SceneXRenderShadow::ShadowElement##_TILE_).x11PictureHandle(), \ shadowAlpha, renderTarget, 0, 0, 0, 0, _RECT_.x(), _RECT_.y(), _RECT_.width(), _RECT_.height()) //shadow @@ -954,30 +954,6 @@ SceneXRenderShadow::~SceneXRenderShadow() { } -Qt::HANDLE SceneXRenderShadow::x11ShadowPictureHandle(WindowQuadType type) -{ - switch (type) { - case WindowQuadShadowTopRight: - return resizedShadowPixmap(ShadowElementTopRight).x11PictureHandle(); - case WindowQuadShadowTop: - return resizedShadowPixmap(ShadowElementTop).x11PictureHandle(); - case WindowQuadShadowTopLeft: - return resizedShadowPixmap(ShadowElementTopLeft).x11PictureHandle(); - case WindowQuadShadowLeft: - return resizedShadowPixmap(ShadowElementLeft).x11PictureHandle(); - case WindowQuadShadowBottomLeft: - return resizedShadowPixmap(ShadowElementBottomLeft).x11PictureHandle(); - case WindowQuadShadowBottom: - return resizedShadowPixmap(ShadowElementBottom).x11PictureHandle(); - case WindowQuadShadowBottomRight: - return resizedShadowPixmap(ShadowElementBottomRight).x11PictureHandle(); - case WindowQuadShadowRight: - return resizedShadowPixmap(ShadowElementRight).x11PictureHandle(); - default: - return 0; - } -} - void SceneXRenderShadow::layoutShadowRects(QRect& top, QRect& topRight, QRect& right, QRect& bottomRight, QRect& bottom, QRect& bottomLeft, @@ -1019,18 +995,10 @@ void SceneXRenderShadow::buildQuads() QRect stlr, str, strr, srr, sbrr, sbr, sblr, slr; layoutShadowRects(str, strr, srr, sbrr, sbr, sblr, slr, stlr); - m_resizedElements[ShadowElementTop] = shadowPixmap(ShadowElementTop);//.scaled(str.size()); - m_resizedElements[ShadowElementTopLeft] = shadowPixmap(ShadowElementTopLeft);//.scaled(stlr.size()); - m_resizedElements[ShadowElementTopRight] = shadowPixmap(ShadowElementTopRight);//.scaled(strr.size()); - m_resizedElements[ShadowElementLeft] = shadowPixmap(ShadowElementLeft);//.scaled(slr.size()); - m_resizedElements[ShadowElementRight] = shadowPixmap(ShadowElementRight);//.scaled(srr.size()); - m_resizedElements[ShadowElementBottom] = shadowPixmap(ShadowElementBottom);//.scaled(sbr.size()); - m_resizedElements[ShadowElementBottomLeft] = shadowPixmap(ShadowElementBottomLeft);//.scaled(sblr.size()); - m_resizedElements[ShadowElementBottomRight] = shadowPixmap(ShadowElementBottomRight);//.scaled(sbrr.size()); XRenderPictureAttributes attr; attr.repeat = True; for (int i = 0; i < ShadowElementsCount; ++i) { - XRenderChangePicture(display(), m_resizedElements[i].x11PictureHandle(), CPRepeat, &attr); + XRenderChangePicture(display(), shadowPixmap((Shadow::ShadowElements)i).x11PictureHandle(), CPRepeat, &attr); } } diff --git a/scene_xrender.h b/scene_xrender.h index 6c916c8ccc..23ff2addbd 100644 --- a/scene_xrender.h +++ b/scene_xrender.h @@ -150,26 +150,29 @@ class SceneXRenderShadow { public: SceneXRenderShadow(Toplevel *toplevel); + using Shadow::ShadowElements; + using Shadow::ShadowElementTop; + using Shadow::ShadowElementTopRight; + using Shadow::ShadowElementRight; + using Shadow::ShadowElementBottomRight; + using Shadow::ShadowElementBottom; + using Shadow::ShadowElementBottomLeft; + using Shadow::ShadowElementLeft; + using Shadow::ShadowElementTopLeft; + using Shadow::ShadowElementsCount; + using Shadow::shadowPixmap; virtual ~SceneXRenderShadow(); - Qt::HANDLE x11ShadowPictureHandle(WindowQuadType); void layoutShadowRects(QRect& top, QRect& topRight, QRect& right, QRect& bottomRight, QRect& bottom, QRect& bottomLeft, QRect& Left, QRect& topLeft); - const QPixmap &resizedShadowPixmap(ShadowElements element) const { - return m_resizedElements[element]; - }; - protected: virtual void buildQuads(); virtual bool prepareBackend() { return true; }; - -private: - QPixmap m_resizedElements[ShadowElementsCount]; }; } // namespace diff --git a/shadow.h b/shadow.h index 43108184b5..f31a0f9e14 100644 --- a/shadow.h +++ b/shadow.h @@ -112,9 +112,11 @@ protected: ShadowElementTopLeft, ShadowElementsCount }; - const QPixmap &shadowPixmap(ShadowElements element) const { + + inline const QPixmap &shadowPixmap(ShadowElements element) const { return m_shadowElements[element]; }; + int topOffset() const { return m_topOffset; };