comparison data/fileio/MatrixFile.cpp @ 412:5e4238d08caa

* Provide a proper implementation of SpectrogramLayer::invalidatePixmapCaches(size_t, size_t) -- if the region is only part of the cache's current valid area, crop the valid area instead of resetting it completely. This makes a big difference when first rendering a spectrogram that is zoomed out a long way when the underlying calculation has not yet completed -- as is a common case in Vect for example.
author Chris Cannam
date Wed, 21 May 2008 11:09:15 +0000
parents 52303ec15cd2
children cff476cfce77
comparison
equal deleted inserted replaced
411:52303ec15cd2 412:5e4238d08caa
589 std::cerr << "received last request: actual size is: " << m_cache.x << ", " << m_cache.width << std::endl; 589 std::cerr << "received last request: actual size is: " << m_cache.x << ", " << m_cache.width << std::endl;
590 #endif 590 #endif
591 591
592 if (m_cache.data) { 592 if (m_cache.data) {
593 if (m_spareData) { 593 if (m_spareData) {
594 std::cerr << this << ": Freeing spare data" << std::endl; 594 // std::cerr << this << ": Freeing spare data" << std::endl;
595 free(m_spareData); 595 free(m_spareData);
596 } 596 }
597 std::cerr << this << ": Moving old cache data to spare" << std::endl; 597 // std::cerr << this << ": Moving old cache data to spare" << std::endl;
598 m_spareData = m_cache.data; 598 m_spareData = m_cache.data;
599 } 599 }
600 std::cerr << this << ": Moving request data to cache" << std::endl; 600 // std::cerr << this << ": Moving request data to cache" << std::endl;
601 m_cache.data = request.data; 601 m_cache.data = request.data;
602 602
603 m_readThread->done(m_requestToken); 603 m_readThread->done(m_requestToken);
604 m_requestToken = -1; 604 m_requestToken = -1;
605 } 605 }
619 #ifdef DEBUG_MATRIX_FILE_READ_SET 619 #ifdef DEBUG_MATRIX_FILE_READ_SET
620 std::cerr << "cancelled " << m_requestToken << std::endl; 620 std::cerr << "cancelled " << m_requestToken << std::endl;
621 #endif 621 #endif
622 622
623 if (m_spareData) { 623 if (m_spareData) {
624 std::cerr << this << ": Freeing spare data" << std::endl; 624 // std::cerr << this << ": Freeing spare data" << std::endl;
625 free(m_spareData); 625 free(m_spareData);
626 } 626 }
627 std::cerr << this << ": Moving request data to spare" << std::endl; 627 // std::cerr << this << ": Moving request data to spare" << std::endl;
628 m_spareData = request.data; 628 m_spareData = request.data;
629 m_readThread->done(m_requestToken); 629 m_readThread->done(m_requestToken);
630 630
631 m_requestToken = -1; 631 m_requestToken = -1;
632 } 632 }
639 request.fd = m_fd; 639 request.fd = m_fd;
640 request.mutex = &m_fdMutex; 640 request.mutex = &m_fdMutex;
641 request.start = m_headerSize + rx * m_height * m_cellSize; 641 request.start = m_headerSize + rx * m_height * m_cellSize;
642 request.size = rw * m_height * m_cellSize; 642 request.size = rw * m_height * m_cellSize;
643 643
644 std::cerr << this << ": Moving spare data to request, and resizing to " << rw * m_height * m_cellSize << std::endl; 644 // std::cerr << this << ": Moving spare data to request, and resizing to " << rw * m_height * m_cellSize << std::endl;
645 645
646 request.data = (char *)realloc(m_spareData, rw * m_height * m_cellSize); 646 request.data = (char *)realloc(m_spareData, rw * m_height * m_cellSize);
647 MUNLOCK(request.data, rw * m_height * m_cellSize); 647 MUNLOCK(request.data, rw * m_height * m_cellSize);
648 m_spareData = 0; 648 m_spareData = 0;
649 649