diff options
author | Tim E. Real <termtech@rogers.com> | 2010-12-23 03:52:08 +0000 |
---|---|---|
committer | Tim E. Real <termtech@rogers.com> | 2010-12-23 03:52:08 +0000 |
commit | 3dae7373e3325e5abe8263488913faef1c63c86b (patch) | |
tree | 8bc853dd8df0ba546bd4e78e56246e1be03ef59e /muse2/muse/arranger | |
parent | e2930cc7ceb780eac3a43365535e04fd7189e4aa (diff) |
Fixed *some* gui drawing speed issues.
Diffstat (limited to 'muse2/muse/arranger')
-rw-r--r-- | muse2/muse/arranger/arranger.cpp | 2 | ||||
-rw-r--r-- | muse2/muse/arranger/pcanvas.cpp | 42 | ||||
-rw-r--r-- | muse2/muse/arranger/tlist.cpp | 7 |
3 files changed, 29 insertions, 22 deletions
diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp index 5272ee75..2173e6c7 100644 --- a/muse2/muse/arranger/arranger.cpp +++ b/muse2/muse/arranger/arranger.cpp @@ -379,7 +379,7 @@ Arranger::Arranger(QMainWindow* parent, const char* name) connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int))); connect(hscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setXMag(int))); connect(vscroll, SIGNAL(valueChanged(int)), list, SLOT(setYPos(int))); - connect(hscroll, SIGNAL(scrollChanged(int)), time, SLOT(setXPos(int))); + connect(hscroll, SIGNAL(scrollChanged(int)), time, SLOT(setXPos(int))); // connect(hscroll, SIGNAL(scaleChanged(int)), time, SLOT(setXMag(int))); connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); connect(canvas, SIGNAL(verticalScroll(unsigned)),SLOT(verticalScrollSetYpos(unsigned))); diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index d9c3880e..e6c30f0e 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -106,7 +106,7 @@ NPart::NPart(Part* e) : CItem(Event(), e) { int th = track()->height(); int y = track()->y(); - //printf("NPart::NPart track name:%s, y:%d h:%d\n", track()->name().toLatin1().constData(), y, th); // REMOVE Tim. + //printf("NPart::NPart track name:%s, y:%d h:%d\n", track()->name().toLatin1().constData(), y, th); ///setPos(QPoint(e->tick(), y + 1)); setPos(QPoint(e->tick(), y)); @@ -1417,26 +1417,23 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) if((unsigned int)to > part->lenTick()) to = part->lenTick(); + // Item bounding box x is in tick coordinates, same as rectangle. + if(item->bbox().intersect(rect).isNull()) + { + //printf("PartCanvas::drawItem rectangle is null\n"); + return; + } + QRect r = item->bbox(); - //QRect r = item->bbox().intersect(rect); - int i = part->colorIndex(); - - //printf("part start tick %d part start pixel %d\n", part->tick(), r.x()); - - //printf("PartCanvas::drawItem %s evRefs:%d pTick:%d pLen:%d bb.x:%d bb.w:%d rect.x:%d rect.w:%d r.x:%d r.w:%d\n", part->name().toLatin1().constData(), part->events()->arefCount(), pTick, part->lenTick(), item->bbox().x(), item->bbox().width(), rect.x(), rect.width(), r.x(), r.width()); + + //printf("PartCanvas::drawItem %s evRefs:%d pTick:%d pLen:%d\nbb.x:%d bb.y:%d bb.w:%d bb.h:%d\n" + // "rect.x:%d rect.y:%d rect.w:%d rect.h:%d\nr.x:%d r.y:%d r.w:%d r.h:%d\n", + // part->name().toLatin1().constData(), part->events()->arefCount(), pTick, part->lenTick(), + // bb.x(), bb.y(), bb.width(), bb.height(), + // rect.x(), rect.y(), rect.width(), rect.height(), + // r.x(), r.y(), r.width(), r.height()); - // THIS WAS IN MUSE-1: - // Must be reasonable about very low negative x values! With long songs > 15min - // and with high horizontal magnification, 'ghost' drawings appeared, - // apparently the result of truncation later (xp = -65006 caused ghosting - // at bar 245 with magnification at max.), even with correct clipping region - // applied to painter in View::paint(). Tim. Apr 5 2009 - // Quote: "Warning: Note that QPainter does not attempt to work around - // coordinate limitations in the underlying window system. Some platforms may - // behave incorrectly with coordinates as small as +/-4000." - //if(r.isEmpty()) - // return; - + int i = part->colorIndex(); p.setPen(Qt::black); if (part->mute()) { QColor c(Qt::white); @@ -1626,6 +1623,9 @@ void PartCanvas::drawMoving(QPainter& p, const CItem* item, const QRect&) void PartCanvas::drawWavePart(QPainter& p, const QRect& bb, WavePart* wp, const QRect& _pr) { + //printf("PartCanvas::drawWavePart bb.x:%d bb.y:%d bb.w:%d bb.h:%d pr.x:%d pr.y:%d pr.w:%d pr.h:%d\n", + // bb.x(), bb.y(), bb.width(), bb.height(), _pr.x(), _pr.y(), _pr.width(), _pr.height()); + QRect rr = p.worldMatrix().mapRect(bb); QRect pr = p.worldMatrix().mapRect(_pr); @@ -2620,7 +2620,7 @@ void PartCanvas::viewDropEvent(QDropEvent* event) { //printf("void PartCanvas::viewDropEvent(QDropEvent* event)\n"); if (event->source() == this) { - printf("local DROP\n"); // REMOVE Tim + printf("local DROP\n"); //event->ignore(); // TODO CHECK Tim. return; } @@ -2798,7 +2798,7 @@ void PartCanvas::drawCanvas(QPainter& p, const QRect& rect) ///if (/*config.canvasShowGrid ||*/ !track->isMidiTrack()) { if (config.canvasShowGrid && (track->isMidiTrack() || track->type() == Track::WAVE)) // Tim. { - //printf("PartCanvas::drawCanvas track name:%s, y:%d h:%d\n", track->name().toLatin1().constData(), yy, th); // REMOVE Tim. + //printf("PartCanvas::drawCanvas track name:%s, y:%d h:%d\n", track->name().toLatin1().constData(), yy, th); p.setPen(baseColor.dark(130)); ///p.drawLine(x, yy, x + w, yy); p.drawLine(x, yy + th, x + w, yy + th); // Tim. diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index f0ef8f94..1eda506e 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -59,6 +59,13 @@ static const int WHEEL_DELTA = 120; TList::TList(Header* hdr, QWidget* parent, const char* name) : QWidget(parent) // Qt::WNoAutoErase | Qt::WResizeNoErase are no longer needed according to Qt4 doc { + setBackgroundRole(QPalette::NoRole); + setAttribute(Qt::WA_NoSystemBackground); + setAttribute(Qt::WA_StaticContents); + // This is absolutely required for speed! Otherwise painfully slow because we get + // full rect paint events even on small scrolls! See help on QPainter::scroll(). + setAttribute(Qt::WA_OpaquePaintEvent); + setObjectName(name); ypos = 0; editMode = false; |