Use MIT SHM where possible to speed up drawing

pull/1/head
Timothy Pearson 12 years ago
parent 66e7613e89
commit e8c3a67b5a

@ -44,7 +44,7 @@ libtdegtk_la_SOURCES = $(source_h) $(source_c)
libtdegtk_la_CFLAGS = $(TDEGTK_CFLAGS) $(CAIRO_CFLAGS) $(GTK3_CFLAGS)
libtdegtk_la_CXXFLAGS = $(TDEGTK_CXXFLAGS) $(TDEGTK_CFLAGS) $(CAIRO_CFLAGS) $(GTK3_CFLAGS)
libtdegtk_la_LIBADD = $(TDEGTK_LIBADD) libtqtcairo.la $(all_libraries) $(CAIRO_LIBS) $(GTK3_LIBS) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE)
libtdegtk_la_LIBADD = $(TDEGTK_LIBADD) libtqtcairo.la $(all_libraries) $(CAIRO_LIBS) $(GTK3_LIBS) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI)
libtdegtk_la_LDFLAGS = $(TDEGTK_LDFLAGS) $(CAIRO_LIBS) $(GTK3_LIBS)

@ -18,6 +18,11 @@
**
**********************************************************************/
// If USE_TDE_SPECIFIC_LIBRARIES is set, the painter will use certain TDE libraries
// to increase painting performance. If this dependency is not desired and you can
// live with the corresponding performance loss, comment out the following line:
#define USE_TDE_SPECIFIC_LIBRARIES 1
#include "tqtcairopainter.h"
#define TQT_NO_COMPAT_NAMES
@ -28,6 +33,10 @@
#include "tqfile.h"
#include "tqpaintdevicemetrics.h"
#ifdef USE_TDE_SPECIFIC_LIBRARIES
#include <kpixmapio.h>
#endif // USE_TDE_SPECIFIC_LIBRARIES
#undef Qt
#define CAIRO_PEN_PIXEL_OFFSET (0.5)
@ -661,7 +670,11 @@ void TQt3CairoPaintDevice::updateBrush(bool backgroundStroke, cairo_fill_rule_t
else {
TQPixmap *pm;
pm = m_brush.pixmap();
#ifdef USE_TDE_SPECIFIC_LIBRARIES
brushImage = tdePixmapIO->convertToImage(*pm);
#else // USE_TDE_SPECIFIC_LIBRARIES
brushImage = pm->convertToImage();
#endif
}
cairo_surface_t* brushSurface = TQImageToCairoSurface(brushImage);
@ -1228,6 +1241,11 @@ TQt3CairoPaintDevice::~TQt3CairoPaintDevice()
if (m_intermediateSurface) {
cairo_surface_destroy(m_intermediateSurface);
}
#ifdef USE_TDE_SPECIFIC_LIBRARIES
if (tdePixmapIO) {
delete tdePixmapIO;
}
#endif // USE_TDE_SPECIFIC_LIBRARIES
}
/*!
@ -1247,6 +1265,12 @@ void TQt3CairoPaintDevice::init() {
m_tabStopArray = NULL;
m_transferNeeded = false;
#ifdef USE_TDE_SPECIFIC_LIBRARIES
tdePixmapIO = new KPixmapIO();
#else // USE_TDE_SPECIFIC_LIBRARIES
tdePixmapIO = NULL;
#endif // USE_TDE_SPECIFIC_LIBRARIES
}
void TQt3CairoPaintDevice::updateSurfaceDimensions() const {
@ -1534,10 +1558,19 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
TQPixmap mergedPixmap = TQPixmap(bitmap->width(), bitmap->height());
mergedPixmap.fill(m_pen.color());
mergedPixmap.setMask(*bitmap);
#ifdef USE_TDE_SPECIFIC_LIBRARIES
sourceImage = tdePixmapIO->convertToImage(mergedPixmap);
#else // USE_TDE_SPECIFIC_LIBRARIES
sourceImage = mergedPixmap.convertToImage();
#endif
}
else {
#ifdef USE_TDE_SPECIFIC_LIBRARIES
sourceImage = tdePixmapIO->convertToImage(*p[1].pixmap);
#else // USE_TDE_SPECIFIC_LIBRARIES
sourceImage = p[1].pixmap->convertToImage();
#endif
}
cairo_surface_t* sourceSurface = TQImageToCairoSurface(sourceImage);
cairo_rectangle(FASTEST_AVAILABLE_PAINTER, p[0].rect->x(), p[0].rect->y(), p[0].rect->width(), p[0].rect->height());

@ -37,6 +37,8 @@
typedef TQPtrStack<TQWMatrix> TQWMatrixStack;
class KPixmapIO;
class Q_EXPORT TQt3CairoPaintDevice : public TQPaintDevice // picture class
{
public:
@ -107,6 +109,7 @@ class Q_EXPORT TQt3CairoPaintDevice : public TQPaintDevice // picture class
bool m_tabStopArrayValid;
bool m_transferNeeded;
KPixmapIO* tdePixmapIO;
};
#endif // TQTCAIROPAINTER_H

Loading…
Cancel
Save