summaryrefslogtreecommitdiffstats
path: root/tdegtk/tqtcairopainter.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2012-11-19 02:10:46 -0600
committerTimothy Pearson <[email protected]>2012-11-19 02:10:46 -0600
commit114c26e88f3814bc9d864faa0b46b00c19b8513b (patch)
treecaaabb45f76279fc883401aa2985be7a1e5e693e /tdegtk/tqtcairopainter.cpp
parent2f93dfb8bfc66c98675499cde3f54fe90049e3ce (diff)
downloadgtk3-tqt-engine-114c26e88f3814bc9d864faa0b46b00c19b8513b.tar.gz
gtk3-tqt-engine-114c26e88f3814bc9d864faa0b46b00c19b8513b.zip
Add GtkSwitch support
Speed up drawing operations on newer GTK/Cairo versions
Diffstat (limited to 'tdegtk/tqtcairopainter.cpp')
-rw-r--r--tdegtk/tqtcairopainter.cpp37
1 files changed, 30 insertions, 7 deletions
diff --git a/tdegtk/tqtcairopainter.cpp b/tdegtk/tqtcairopainter.cpp
index 9c7d010..a2867f0 100644
--- a/tdegtk/tqtcairopainter.cpp
+++ b/tdegtk/tqtcairopainter.cpp
@@ -381,6 +381,8 @@ void TQt3CairoPaintDevice::transferIntermediateSurface() {
cairo_set_source_rgba(m_painter, 0.0, 0.0, 0.0, 0.0);
cairo_paint(m_painter);
cairo_restore(m_painter);
+
+ m_transferNeeded = false;
}
void TQt3CairoPaintDevice::dualStrokePen() {
@@ -394,7 +396,7 @@ void TQt3CairoPaintDevice::dualStrokePen() {
// Draw foreground
updatePen(FALSE);
cairo_stroke(m_painter);
- transferIntermediateSurface();
+ m_transferNeeded = true;
}
void TQt3CairoPaintDevice::dualStrokeBrush(cairo_fill_rule_t fillMethod) {
@@ -408,7 +410,7 @@ void TQt3CairoPaintDevice::dualStrokeBrush(cairo_fill_rule_t fillMethod) {
// Draw foreground
updateBrush(FALSE, fillMethod);
cairo_fill(m_painter);
- transferIntermediateSurface();
+ m_transferNeeded = true;
}
void TQt3CairoPaintDevice::updatePen(bool backgroundStroke) {
@@ -989,7 +991,7 @@ void TQt3CairoPaintDevice::drawText(TQPainter *p, int x, int y, const TQString &
g_object_unref(layout);
- transferIntermediateSurface();
+ m_transferNeeded = true;
}
void TQt3CairoPaintDevice::drawTextInRect(TQPainter *p, TQRect rect, int textFlags, const TQString &str) {
@@ -1084,7 +1086,7 @@ void TQt3CairoPaintDevice::drawTextInRect(TQPainter *p, TQRect rect, int textFla
g_object_unref(layout);
- transferIntermediateSurface();
+ m_transferNeeded = true;
}
void TQt3CairoPaintDevice::setCairoTransformations(cairo_t* cr, bool forceDisable) {
@@ -1186,6 +1188,8 @@ void TQt3CairoPaintDevice::init() {
m_overridePainter = NULL;
m_tabStops = NULL;
m_tabStopArray = NULL;
+
+ m_transferNeeded = false;
}
void TQt3CairoPaintDevice::updateSurfaceDimensions() const {
@@ -1253,7 +1257,7 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
cairo_stroke(m_painter);
}
cairo_restore(m_painter);
- transferIntermediateSurface();
+ m_transferNeeded = true;
}
break;
case PdcMoveTo:
@@ -1485,7 +1489,7 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
cairo_surface_destroy(sourceSurface);
}
cairo_restore(m_painter);
- transferIntermediateSurface();
+ m_transferNeeded = true;
}
break;
case PdcDrawImage:
@@ -1501,11 +1505,12 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
cairo_surface_destroy(sourceSurface);
}
cairo_restore(m_painter);
- transferIntermediateSurface();
+ m_transferNeeded = true;
}
break;
case PdcBegin:
if (!m_painter) {
+ m_transferNeeded = false;
m_bgColor = TQColor(0,0,0);
m_bgColorMode = TQt::TransparentMode;
resetIntermediateSurface();
@@ -1536,6 +1541,9 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
break;
case PdcEnd:
if (m_painter) {
+ if (m_transferNeeded) {
+ transferIntermediateSurface();
+ }
cairo_destroy(m_painter);
m_painter = NULL;
}
@@ -1567,6 +1575,10 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
break;
case PdcSetROP:
if ((p) && (m_painter)) {
+ if (m_transferNeeded) {
+ transferIntermediateSurface();
+ }
+
TQt::RasterOp rop = (TQt::RasterOp)p[0].ival;
m_rop = rop;
}
@@ -1726,11 +1738,17 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
break;
case PdcSetClip:
if ((p) && (m_painter)) {
+ if (m_transferNeeded) {
+ transferIntermediateSurface();
+ }
m_clipRegionEnabled = p[0].ival;
}
break;
case PdcSetClipRegion:
if ((p) && (m_painter)) {
+ if (m_transferNeeded) {
+ transferIntermediateSurface();
+ }
// SLOW
TQRect tqt3br = p[0].rgn->boundingRect();
if (!tqt3br.isNull()) {
@@ -1751,6 +1769,11 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
}
}
break;
+ case PdcFlush:
+ case PdcFlushRegion:
+ if (m_transferNeeded) {
+ transferIntermediateSurface();
+ }
default:
#if defined(QT_CHECK_RANGE)
tqWarning( "TQt3CairoPaintDevice::cmd: Invalid command %d", c );