diff options
author | Timothy Pearson <[email protected]> | 2012-11-21 21:03:18 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-11-21 21:03:18 -0600 |
commit | e8c3a67b5a6c7b9e737071393d00ab0d6d09983d (patch) | |
tree | 4b0970270b31e1a484e4ea17950dc97d3b9c4ccb /tdegtk | |
parent | 66e7613e89b623e9a7b3354918090998ecaf8bfd (diff) | |
download | gtk3-tqt-engine-e8c3a67b5a6c7b9e737071393d00ab0d6d09983d.tar.gz gtk3-tqt-engine-e8c3a67b5a6c7b9e737071393d00ab0d6d09983d.zip |
Use MIT SHM where possible to speed up drawing
Diffstat (limited to 'tdegtk')
-rw-r--r-- | tdegtk/Makefile.am | 2 | ||||
-rw-r--r-- | tdegtk/tqtcairopainter.cpp | 33 | ||||
-rw-r--r-- | tdegtk/tqtcairopainter.h | 3 |
3 files changed, 37 insertions, 1 deletions
diff --git a/tdegtk/Makefile.am b/tdegtk/Makefile.am index 3f92391..c35b406 100644 --- a/tdegtk/Makefile.am +++ b/tdegtk/Makefile.am @@ -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) diff --git a/tdegtk/tqtcairopainter.cpp b/tdegtk/tqtcairopainter.cpp index 4c64df8..d926541 100644 --- a/tdegtk/tqtcairopainter.cpp +++ b/tdegtk/tqtcairopainter.cpp @@ -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()); diff --git a/tdegtk/tqtcairopainter.h b/tdegtk/tqtcairopainter.h index 5e7dc55..dcca6f9 100644 --- a/tdegtk/tqtcairopainter.h +++ b/tdegtk/tqtcairopainter.h @@ -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 |