Mercurial > hg > svgui
comparison layer/SpectrogramLayer.cpp @ 1096:6288f1b5f49b spectrogram-minor-refactor
Far more pragmatic update strategy
author | Chris Cannam |
---|---|
date | Mon, 11 Jul 2016 14:37:03 +0100 |
parents | cd22f74dc159 |
children | d9f1d2756b59 |
comparison
equal
deleted
inserted
replaced
1095:ba62684a4512 | 1096:6288f1b5f49b |
---|---|
1554 Colour3DPlotRenderer::RenderResult result = | 1554 Colour3DPlotRenderer::RenderResult result = |
1555 renderer->renderTimeConstrained(v, paint, rect); | 1555 renderer->renderTimeConstrained(v, paint, rect); |
1556 | 1556 |
1557 //!!! + mag range | 1557 //!!! + mag range |
1558 | 1558 |
1559 QRect rendered = result.rendered; | 1559 QRect uncached = renderer->getLargestUncachedRect(); |
1560 if (rendered == rect) { | 1560 if (uncached.width() > 0) { |
1561 cerr << "exiting paint depth " << depth << endl; | 1561 cerr << "updating rect at " << uncached.x() << " width " |
1562 --depth; | 1562 << uncached.width() << endl; |
1563 return; | 1563 v->updatePaintRect(uncached); |
1564 } | |
1565 | |
1566 int rLeft = rendered.x(); | |
1567 int rRight = rendered.x() + rendered.width(); | |
1568 | |
1569 if (rLeft < rect.x()) { | |
1570 rLeft = rect.x(); | |
1571 } | |
1572 if (rRight > rect.x() + rect.width()) { | |
1573 rRight = rect.x() + rect.width(); | |
1574 } | |
1575 | |
1576 QRect areaLeft(rect.x(), rect.y(), | |
1577 rLeft - rect.x(), rect.height()); | |
1578 | |
1579 QRect areaRight(rRight, rect.y(), | |
1580 rect.x() + rect.width() - rRight, rect.height()); | |
1581 | |
1582 bool updateLeft = (areaLeft.width() > 0); | |
1583 bool updateRight = (areaRight.width() > 0); | |
1584 | |
1585 if (updateLeft) { | |
1586 if (updateRight) { | |
1587 if (areaLeft.width() > areaRight.width()) { | |
1588 cerr << "update left then right, widths " | |
1589 << areaLeft.width() << " and " | |
1590 << areaRight.width() << endl; | |
1591 v->updatePaintRect(areaLeft); | |
1592 v->updatePaintRect(areaRight); | |
1593 } else { | |
1594 cerr << "update right then left, widths " | |
1595 << areaLeft.width() << " and " | |
1596 << areaRight.width() << endl; | |
1597 v->updatePaintRect(areaRight); | |
1598 v->updatePaintRect(areaLeft); | |
1599 } | |
1600 } else { | |
1601 cerr << "update left, width " << areaLeft.width() << endl; | |
1602 v->updatePaintRect(areaLeft); | |
1603 } | |
1604 } else { | |
1605 cerr << "update right, width " << areaRight.width() << endl; | |
1606 v->updatePaintRect(areaRight); | |
1607 } | 1564 } |
1608 | 1565 |
1609 cerr << "exiting paint depth " << depth << endl; | 1566 cerr << "exiting paint depth " << depth << endl; |
1610 --depth; | 1567 --depth; |
1611 } | 1568 } |