summaryrefslogtreecommitdiffstats
path: root/tdegtk/tqtcairopainter.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-11-21 21:03:18 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-11-21 21:03:18 -0600
commite8c3a67b5a6c7b9e737071393d00ab0d6d09983d (patch)
tree4b0970270b31e1a484e4ea17950dc97d3b9c4ccb /tdegtk/tqtcairopainter.cpp
parent66e7613e89b623e9a7b3354918090998ecaf8bfd (diff)
downloadgtk3-tqt-engine-e8c3a67b5a6c7b9e737071393d00ab0d6d09983d.tar.gz
gtk3-tqt-engine-e8c3a67b5a6c7b9e737071393d00ab0d6d09983d.zip
Use MIT SHM where possible to speed up drawing
Diffstat (limited to 'tdegtk/tqtcairopainter.cpp')
-rw-r--r--tdegtk/tqtcairopainter.cpp33
1 files changed, 33 insertions, 0 deletions
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());