-
-// ------------------------------------------------------------------
-
-
-
-
-ImageBasedPaintRedirector::ImageBasedPaintRedirector(Client *c, QWidget *widget)
- : PaintRedirector(c, widget)
-{
-}
-
-ImageBasedPaintRedirector::~ImageBasedPaintRedirector()
-{
-}
-
-QPaintDevice *ImageBasedPaintRedirector::recreateScratch(const QSize &size)
-{
- m_scratchImage = QImage(size, QImage::Format_ARGB32_Premultiplied);
- return &m_scratchImage;
-}
-
-QPaintDevice *ImageBasedPaintRedirector::scratch()
-{
- return &m_scratchImage;
-}
-
-void ImageBasedPaintRedirector::fillScratch(Qt::GlobalColor color)
-{
- m_scratchImage.fill(color);
-}
-
-void ImageBasedPaintRedirector::discardScratch()
-{
- m_scratchImage = QImage();
-}
-
-
// ------------------------------------------------------------------
-
RasterXRenderPaintRedirector::RasterXRenderPaintRedirector(Client *c, QWidget *widget)
- : ImageBasedPaintRedirector(c, widget)
+ : PaintRedirector(c, widget)
, m_gc(0)
{
for (int i=0; i<PixmapCount; ++i) {
xcb_create_gc(connection(), m_gc, m_pixmaps[border], 0, NULL);
}
- const QImage img(scratchImage().copy(QRect(bounding.topLeft() - b.topLeft(), bounding.size())));
+ const QImage img(m_scratchImage.copy(QRect(bounding.topLeft() - b.topLeft(), bounding.size())));
xcb_put_image(connection(), XCB_IMAGE_FORMAT_Z_PIXMAP, m_pixmaps[border], m_gc,
img.width(), img.height(), offset.x(), offset.y(), 0, 32, img.byteCount(), img.constBits());
}
+QPaintDevice *RasterXRenderPaintRedirector::recreateScratch(const QSize &size)
+{
+ m_scratchImage = QImage(size, QImage::Format_ARGB32_Premultiplied);
+ return &m_scratchImage;
+}
+
+QPaintDevice *RasterXRenderPaintRedirector::scratch()
+{
+ return &m_scratchImage;
+}
+
+void RasterXRenderPaintRedirector::fillScratch(Qt::GlobalColor color)
+{
+ m_scratchImage.fill(color);
+}
+
+void RasterXRenderPaintRedirector::discardScratch()
+{
+ m_scratchImage = QImage();
+}
+
+
+
+// ------------------------------------------------------------------
+
NativeXRenderPaintRedirector::NativeXRenderPaintRedirector(Client *c, QWidget *widget)
: PaintRedirector(c, widget)
{
bool m_requiresRepaint;
};
-class ImageBasedPaintRedirector : public PaintRedirector
-{
- Q_OBJECT
-public:
- virtual ~ImageBasedPaintRedirector();
-protected:
- ImageBasedPaintRedirector(Client *c, QWidget *widget);
- virtual QPaintDevice *recreateScratch(const QSize &size);
- virtual QPaintDevice *scratch();
- virtual void fillScratch(Qt::GlobalColor color);
- virtual void discardScratch();
- const QImage &scratchImage() const;
-private:
- QImage m_scratchImage;
-};
-
class NativeXRenderPaintRedirector : public PaintRedirector
{
Q_OBJECT
QPixmap m_scratch;
};
-class RasterXRenderPaintRedirector : public ImageBasedPaintRedirector
+class RasterXRenderPaintRedirector : public PaintRedirector
{
Q_OBJECT
public:
virtual void resize(DecorationPixmap border, const QSize &size);
virtual void paint(DecorationPixmap border, const QRect &r, const QRect &b, const QRegion ®);
virtual void preparePaint(const QPixmap &pending);
+
+ virtual QPaintDevice *recreateScratch(const QSize &size);
+ virtual QPaintDevice *scratch();
+ virtual void fillScratch(Qt::GlobalColor color);
+ virtual void discardScratch();
private:
QSize m_sizes[PixmapCount];
xcb_pixmap_t m_pixmaps[PixmapCount];
xcb_gcontext_t m_gc;
XRenderPicture* m_pictures[PixmapCount];
QImage m_tempImage;
+ QImage m_scratchImage;
};
template <>
return picture(TopPixmap);
}
-inline
-const QImage &ImageBasedPaintRedirector::scratchImage() const
-{
- return m_scratchImage;
-}
-
} // namespace
#endif