comparison layer/WaveformLayer.cpp @ 587:4806715f7a19

Seems to be a bad idea to use plain DEBUG symbol on OS/X (system wants it)
author Chris Cannam
date Tue, 14 Jun 2011 15:27:05 +0100
parents f4960f8ce798
children 5b72899d692b
comparison
equal deleted inserted replaced
586:1ae54a29e59e 587:4806715f7a19
286 } 286 }
287 287
288 void 288 void
289 WaveformLayer::setChannel(int channel) 289 WaveformLayer::setChannel(int channel)
290 { 290 {
291 // DEBUG << "WaveformLayer::setChannel(" << channel << ")" << endl; 291 // SVDEBUG << "WaveformLayer::setChannel(" << channel << ")" << endl;
292 292
293 if (m_channel == channel) return; 293 if (m_channel == channel) return;
294 m_channel = channel; 294 m_channel = channel;
295 m_cacheValid = false; 295 m_cacheValid = false;
296 emit layerParametersChanged(); 296 emit layerParametersChanged();
380 } 380 }
381 381
382 merging = (m_channelMode == MergeChannels && rawChannels > 1); 382 merging = (m_channelMode == MergeChannels && rawChannels > 1);
383 mixing = (m_channelMode == MixChannels && rawChannels > 1); 383 mixing = (m_channelMode == MixChannels && rawChannels > 1);
384 384
385 // DEBUG << "WaveformLayer::getChannelArrangement: min " << min << ", max " << max << ", merging " << merging << ", channels " << channels << endl; 385 // SVDEBUG << "WaveformLayer::getChannelArrangement: min " << min << ", max " << max << ", merging " << merging << ", channels " << channels << endl;
386 386
387 return channels; 387 return channels;
388 } 388 }
389 389
390 bool 390 bool
472 472
473 int zoomLevel = v->getZoomLevel(); 473 int zoomLevel = v->getZoomLevel();
474 474
475 #ifdef DEBUG_WAVEFORM_PAINT 475 #ifdef DEBUG_WAVEFORM_PAINT
476 Profiler profiler("WaveformLayer::paint", true); 476 Profiler profiler("WaveformLayer::paint", true);
477 DEBUG << "WaveformLayer::paint (" << rect.x() << "," << rect.y() 477 SVDEBUG << "WaveformLayer::paint (" << rect.x() << "," << rect.y()
478 << ") [" << rect.width() << "x" << rect.height() << "]: zoom " << zoomLevel << ", start " << startFrame << endl; 478 << ") [" << rect.width() << "x" << rect.height() << "]: zoom " << zoomLevel << ", start " << startFrame << endl;
479 #endif 479 #endif
480 480
481 size_t channels = 0, minChannel = 0, maxChannel = 0; 481 size_t channels = 0, minChannel = 0, maxChannel = 0;
482 bool mergingChannels = false, mixingChannels = false; 482 bool mergingChannels = false, mixingChannels = false;
492 QPainter *paint; 492 QPainter *paint;
493 493
494 if (m_aggressive) { 494 if (m_aggressive) {
495 495
496 #ifdef DEBUG_WAVEFORM_PAINT 496 #ifdef DEBUG_WAVEFORM_PAINT
497 DEBUG << "WaveformLayer::paint: aggressive is true" << endl; 497 SVDEBUG << "WaveformLayer::paint: aggressive is true" << endl;
498 #endif 498 #endif
499 499
500 if (m_cacheValid && (zoomLevel != m_cacheZoomLevel)) { 500 if (m_cacheValid && (zoomLevel != m_cacheZoomLevel)) {
501 m_cacheValid = false; 501 m_cacheValid = false;
502 } 502 }
503 503
504 if (!m_cache || m_cache->width() != w || m_cache->height() != h) { 504 if (!m_cache || m_cache->width() != w || m_cache->height() != h) {
505 #ifdef DEBUG_WAVEFORM_PAINT 505 #ifdef DEBUG_WAVEFORM_PAINT
506 if (m_cache) { 506 if (m_cache) {
507 DEBUG << "WaveformLayer::paint: cache size " << m_cache->width() << "x" << m_cache->height() << " differs from view size " << w << "x" << h << ": regenerating aggressive cache" << endl; 507 SVDEBUG << "WaveformLayer::paint: cache size " << m_cache->width() << "x" << m_cache->height() << " differs from view size " << w << "x" << h << ": regenerating aggressive cache" << endl;
508 } 508 }
509 #endif 509 #endif
510 delete m_cache; 510 delete m_cache;
511 m_cache = new QPixmap(w, h); 511 m_cache = new QPixmap(w, h);
512 m_cacheValid = false; 512 m_cacheValid = false;
560 560
561 getSourceFramesForX(v, x0, modelZoomLevel, frame0, spare); 561 getSourceFramesForX(v, x0, modelZoomLevel, frame0, spare);
562 getSourceFramesForX(v, x1, modelZoomLevel, spare, frame1); 562 getSourceFramesForX(v, x1, modelZoomLevel, spare, frame1);
563 563
564 #ifdef DEBUG_WAVEFORM_PAINT 564 #ifdef DEBUG_WAVEFORM_PAINT
565 DEBUG << "Painting waveform from " << frame0 << " to " << frame1 << " (" << (x1-x0+1) << " pixels at zoom " << zoomLevel << " and model zoom " << modelZoomLevel << ")" << endl; 565 SVDEBUG << "Painting waveform from " << frame0 << " to " << frame1 << " (" << (x1-x0+1) << " pixels at zoom " << zoomLevel << " and model zoom " << modelZoomLevel << ")" << endl;
566 #endif 566 #endif
567 567
568 RangeSummarisableTimeValueModel::RangeBlock *ranges = 568 RangeSummarisableTimeValueModel::RangeBlock *ranges =
569 new RangeSummarisableTimeValueModel::RangeBlock; 569 new RangeSummarisableTimeValueModel::RangeBlock;
570 570
701 701
702 size_t i0 = (f0 - frame0) / modelZoomLevel; 702 size_t i0 = (f0 - frame0) / modelZoomLevel;
703 size_t i1 = (f1 - frame0) / modelZoomLevel; 703 size_t i1 = (f1 - frame0) / modelZoomLevel;
704 704
705 #ifdef DEBUG_WAVEFORM_PAINT 705 #ifdef DEBUG_WAVEFORM_PAINT
706 DEBUG << "WaveformLayer::paint: pixel " << x << ": i0 " << i0 << " (f " << f0 << "), i1 " << i1 << " (f " << f1 << ")" << endl; 706 SVDEBUG << "WaveformLayer::paint: pixel " << x << ": i0 " << i0 << " (f " << f0 << "), i1 " << i1 << " (f " << f1 << ")" << endl;
707 #endif 707 #endif
708 708
709 if (i1 > i0 + 1) { 709 if (i1 > i0 + 1) {
710 DEBUG << "WaveformLayer::paint: ERROR: i1 " << i1 << " > i0 " << i0 << " plus one (zoom = " << zoomLevel << ", model zoom = " << modelZoomLevel << ")" << endl; 710 SVDEBUG << "WaveformLayer::paint: ERROR: i1 " << i1 << " > i0 " << i0 << " plus one (zoom = " << zoomLevel << ", model zoom = " << modelZoomLevel << ")" << endl;
711 } 711 }
712 712
713 if (ranges && i0 < ranges->size()) { 713 if (ranges && i0 < ranges->size()) {
714 714
715 range = (*ranges)[i0]; 715 range = (*ranges)[i0];