straighten xrender shadow implementation
did not publish function & enum in the baseclass, but inlined the accessor REVIEW: 103232 (cherry picked from commit ecfa39ac3ca1c9823a6b320ff0f7a60ab32f0418)
This commit is contained in:
parent
f3d1261680
commit
634a504ce1
3 changed files with 16 additions and 43 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
4
shadow.h
4
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;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue