comparison layer/Colour3DPlotLayer.cpp @ 1121:d930ff725f64 spectrogram-minor-refactor

Wiring through the magnitude range updates
author Chris Cannam
date Fri, 22 Jul 2016 12:17:55 +0100
parents a42e5a3c63ef
children 343887ac6766
comparison
equal deleted inserted replaced
1120:65cdaf8d6b50 1121:d930ff725f64
607 Layer::setLayerDormant(v, false); 607 Layer::setLayerDormant(v, false);
608 } 608 }
609 } 609 }
610 610
611 bool 611 bool
612 Colour3DPlotLayer::isLayerScrollable(const LayerGeometryProvider *v) const 612 Colour3DPlotLayer::isLayerScrollable(const LayerGeometryProvider */* v */) const
613 { 613 {
614 if (m_normalizeVisibleArea) { 614 if (m_normalizeVisibleArea) {
615 return false; 615 return false;
616 } 616 }
617 if (getRenderer(v)->willRenderOpaque(v)) { 617 //!!! ah hang on, if we're potentially rendering incrementally
618 return true; 618 //!!! they we can't be scrollable
619 } 619 return false;
620 QPoint discard; 620 // if (getRenderer(v)->willRenderOpaque(v)) {
621 return !v->shouldIlluminateLocalFeatures(this, discard); 621 // return true;
622 // }
623 // QPoint discard;
624 // return !v->shouldIlluminateLocalFeatures(this, discard);
622 } 625 }
623 626
624 bool 627 bool
625 Colour3DPlotLayer::getValueExtents(double &min, double &max, 628 Colour3DPlotLayer::getValueExtents(double &min, double &max,
626 bool &logarithmic, QString &unit) const 629 bool &logarithmic, QString &unit) const
1078 1081
1079 void 1082 void
1080 Colour3DPlotLayer::paintWithRenderer(LayerGeometryProvider *v, 1083 Colour3DPlotLayer::paintWithRenderer(LayerGeometryProvider *v,
1081 QPainter &paint, QRect rect) const 1084 QPainter &paint, QRect rect) const
1082 { 1085 {
1083 static int depth = 0;
1084
1085 Colour3DPlotRenderer *renderer = getRenderer(v); 1086 Colour3DPlotRenderer *renderer = getRenderer(v);
1086 1087
1088 Colour3DPlotRenderer::RenderResult result;
1089
1087 if (m_synchronous) { 1090 if (m_synchronous) {
1088 (void)renderer->render(v, paint, rect); 1091
1089 return; 1092 result = renderer->render(v, paint, rect);
1090 } 1093
1091 1094 } else {
1092 ++depth; 1095
1093 cerr << "paint depth " << depth << endl; 1096 result = renderer->renderTimeConstrained(v, paint, rect);
1094 1097
1095 (void)renderer->renderTimeConstrained(v, paint, rect); 1098 //!!! + mag range
1096 1099
1097 //!!! + mag range 1100 QRect uncached = renderer->getLargestUncachedRect(v);
1098 1101 if (uncached.width() > 0) {
1099 QRect uncached = renderer->getLargestUncachedRect(); 1102 cerr << "updating rect at " << uncached.x() << " width "
1100 if (uncached.width() > 0) { 1103 << uncached.width() << endl;
1101 cerr << "updating rect at " << uncached.x() << " width " 1104 v->updatePaintRect(uncached);
1102 << uncached.width() << endl; 1105 }
1103 v->updatePaintRect(uncached); 1106 }
1104 } 1107
1105 1108 //!!! at the mo this measures the range of the whole thing, not
1106 cerr << "exiting paint depth " << depth << endl; 1109 //!!! just the view - need to reset it when view extents change
1107 --depth; 1110
1111 m_viewMags[v->getId()].sample(result.range);
1112
1113 cerr << "mag range in this view: "
1114 << m_viewMags[v->getId()].getMin()
1115 << " -> "
1116 << m_viewMags[v->getId()].getMax()
1117 << endl;
1118
1108 } 1119 }
1109 1120
1110 void 1121 void
1111 Colour3DPlotLayer::paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const 1122 Colour3DPlotLayer::paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const
1112 { 1123 {