Mercurial > hg > svgui
comparison layer/Colour3DPlotLayer.cpp @ 20:1deb5f87a18c
* Add getXForFrame / getFrameForX in preference to using the zoom level everywhere
author | Chris Cannam |
---|---|
date | Mon, 30 Jan 2006 13:19:42 +0000 |
parents | 484e7320f59f |
children | 6b794a2af3d9 |
comparison
equal
deleted
inserted
replaced
19:46d8f5add6f0 | 20:1deb5f87a18c |
---|---|
179 //!!! Strictly speaking we want quite different paint mechanisms | 179 //!!! Strictly speaking we want quite different paint mechanisms |
180 //for models that have more than one bin per pixel in either | 180 //for models that have more than one bin per pixel in either |
181 //direction. This one is only really appropriate for models with | 181 //direction. This one is only really appropriate for models with |
182 //far fewer bins in both directions. | 182 //far fewer bins in both directions. |
183 | 183 |
184 int sx0 = ((startFrame + x0 * zoomLevel) - int(modelStart)) / | 184 int sx0 = int((getFrameForX(x0) - long(modelStart)) / long(modelWindow)); |
185 int(modelWindow); | 185 int sx1 = int((getFrameForX(x1) - long(modelStart)) / long(modelWindow)); |
186 int sx1 = ((startFrame + x1 * zoomLevel) - int(modelStart)) / | |
187 int(modelWindow); | |
188 int sw = sx1 - sx0; | 186 int sw = sx1 - sx0; |
189 int sh = m_model->getYBinCount(); | 187 int sh = m_model->getYBinCount(); |
190 | 188 |
191 /* | 189 /* |
192 std::cerr << "Colour3DPlotLayer::paint: w " << w << ", h " << h << ", sx0 " << sx0 << ", sx1 " << sx1 << ", sw " << sw << ", sh " << sh << std::endl; | 190 std::cerr << "Colour3DPlotLayer::paint: w " << w << ", h " << h << ", sx0 " << sx0 << ", sx1 " << sx1 << ", sw " << sw << ", sh " << sh << std::endl; |
200 if (fx + modelWindow < int(modelStart) || | 198 if (fx + modelWindow < int(modelStart) || |
201 fx > int(modelEnd)) continue; | 199 fx > int(modelEnd)) continue; |
202 | 200 |
203 for (int sy = 0; sy < sh; ++sy) { | 201 for (int sy = 0; sy < sh; ++sy) { |
204 | 202 |
205 int rx0 = ((fx + int(modelStart)) | 203 int rx0 = getXForFrame(fx + int(modelStart)); |
206 - int(startFrame)) / zoomLevel; | 204 int rx1 = getXForFrame(fx + int(modelStart) + int(modelWindow)); |
207 int rx1 = ((fx + int(modelWindow) + int(modelStart)) | |
208 - int(startFrame)) / zoomLevel; | |
209 | 205 |
210 int ry0 = h - (sy * h) / sh - 1; | 206 int ry0 = h - (sy * h) / sh - 1; |
211 int ry1 = h - ((sy + 1) * h) / sh - 2; | 207 int ry1 = h - ((sy + 1) * h) / sh - 2; |
212 QRgb pixel = qRgb(255, 255, 255); | 208 QRgb pixel = qRgb(255, 255, 255); |
213 if (sx >= 0 && sx < m_cache->width() && | 209 if (sx >= 0 && sx < m_cache->width() && |