Mercurial > hg > svgui
comparison layer/SpectrogramLayer.cpp @ 1091:ac10a087e045 spectrogram-minor-refactor
Time-constrained rendering
author | Chris Cannam |
---|---|
date | Thu, 07 Jul 2016 11:24:28 +0100 |
parents | c8c747783110 |
children | 9b826dd23c84 |
comparison
equal
deleted
inserted
replaced
1090:c8c747783110 | 1091:ac10a087e045 |
---|---|
1534 void | 1534 void |
1535 SpectrogramLayer::paintAlternative(LayerGeometryProvider *v, QPainter &paint, QRect rect) const | 1535 SpectrogramLayer::paintAlternative(LayerGeometryProvider *v, QPainter &paint, QRect rect) const |
1536 { | 1536 { |
1537 Colour3DPlotRenderer *renderer = getRenderer(v); | 1537 Colour3DPlotRenderer *renderer = getRenderer(v); |
1538 | 1538 |
1539 //!!! not time-constrained for now | 1539 if (m_synchronous) { |
1540 Colour3DPlotRenderer::RenderResult result = renderer->render(v, paint, rect); | 1540 (void)renderer->render(v, paint, rect); |
1541 | 1541 return; |
1542 //!!! do | 1542 } |
1543 (void)result; | 1543 |
1544 Colour3DPlotRenderer::RenderResult result = | |
1545 renderer->renderTimeConstrained(v, paint, rect); | |
1546 | |
1547 //!!! + mag range | |
1548 | |
1549 QRect rendered = result.rendered; | |
1550 if (rendered == rect) return; | |
1551 | |
1552 int rLeft = rendered.x(); | |
1553 int rRight = rendered.x() + rendered.width(); | |
1554 | |
1555 if (rLeft < rect.x()) { | |
1556 rLeft = rect.x(); | |
1557 } | |
1558 if (rRight > rect.x() + rect.width()) { | |
1559 rRight = rect.x() + rect.width(); | |
1560 } | |
1561 | |
1562 QRect areaLeft(rect.x(), rect.y(), | |
1563 rLeft - rect.x(), rect.height()); | |
1564 | |
1565 QRect areaRight(rRight, rect.y(), | |
1566 rect.x() + rect.width() - rRight, rect.height()); | |
1567 | |
1568 bool updateLeft = (areaLeft.width() > 0); | |
1569 bool updateRight = (areaRight.width() > 0); | |
1570 | |
1571 if (updateLeft) { | |
1572 if (updateRight) { | |
1573 if (areaLeft.width() > areaRight.width()) { | |
1574 v->updatePaintRect(areaLeft); | |
1575 v->updatePaintRect(areaRight); | |
1576 } else { | |
1577 v->updatePaintRect(areaRight); | |
1578 v->updatePaintRect(areaLeft); | |
1579 } | |
1580 } else { | |
1581 v->updatePaintRect(areaLeft); | |
1582 } | |
1583 } else { | |
1584 v->updatePaintRect(areaRight); | |
1585 } | |
1544 } | 1586 } |
1545 | 1587 |
1546 Colour3DPlotRenderer * | 1588 Colour3DPlotRenderer * |
1547 SpectrogramLayer::getRenderer(LayerGeometryProvider *v) const | 1589 SpectrogramLayer::getRenderer(LayerGeometryProvider *v) const |
1548 { | 1590 { |