Mercurial > hg > svgui
comparison layer/ImageLayer.cpp @ 682:1a0dfcbffaf1
Drop std:: from cout, cerr, endl -- pull these in through Debug.h
author | Chris Cannam |
---|---|
date | Tue, 26 Nov 2013 14:06:40 +0000 |
parents | 4806715f7a19 |
children | 1d526ba11a24 |
comparison
equal
deleted
inserted
replaced
681:eaf4446a1bef | 682:1a0dfcbffaf1 |
---|---|
161 if (x >= px && x < px + width) { | 161 if (x >= px && x < px + width) { |
162 rv.insert(p); | 162 rv.insert(p); |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 // std::cerr << rv.size() << " point(s)" << std::endl; | 166 // cerr << rv.size() << " point(s)" << endl; |
167 | 167 |
168 return rv; | 168 return rv; |
169 } | 169 } |
170 | 170 |
171 QString | 171 QString |
498 //!!! how to reap no-longer-used images? | 498 //!!! how to reap no-longer-used images? |
499 | 499 |
500 bool | 500 bool |
501 ImageLayer::getImageOriginalSize(QString name, QSize &size) const | 501 ImageLayer::getImageOriginalSize(QString name, QSize &size) const |
502 { | 502 { |
503 // std::cerr << "getImageOriginalSize: \"" << name << "\"" << std::endl; | 503 // cerr << "getImageOriginalSize: \"" << name << "\"" << endl; |
504 | 504 |
505 QMutexLocker locker(&m_imageMapMutex); | 505 QMutexLocker locker(&m_imageMapMutex); |
506 if (m_images.find(name) == m_images.end()) { | 506 if (m_images.find(name) == m_images.end()) { |
507 // std::cerr << "don't have, trying to open local" << std::endl; | 507 // cerr << "don't have, trying to open local" << endl; |
508 m_images[name] = QImage(getLocalFilename(name)); | 508 m_images[name] = QImage(getLocalFilename(name)); |
509 } | 509 } |
510 if (m_images[name].isNull()) { | 510 if (m_images[name].isNull()) { |
511 // std::cerr << "null image" << std::endl; | 511 // cerr << "null image" << endl; |
512 return false; | 512 return false; |
513 } else { | 513 } else { |
514 size = m_images[name].size(); | 514 size = m_images[name].size(); |
515 return true; | 515 return true; |
516 } | 516 } |
527 if (!m_scaled[v][name].isNull() && | 527 if (!m_scaled[v][name].isNull() && |
528 ((m_scaled[v][name].width() == maxSize.width() && | 528 ((m_scaled[v][name].width() == maxSize.width() && |
529 m_scaled[v][name].height() <= maxSize.height()) || | 529 m_scaled[v][name].height() <= maxSize.height()) || |
530 (m_scaled[v][name].width() <= maxSize.width() && | 530 (m_scaled[v][name].width() <= maxSize.width() && |
531 m_scaled[v][name].height() == maxSize.height()))) { | 531 m_scaled[v][name].height() == maxSize.height()))) { |
532 // std::cerr << "cache hit" << std::endl; | 532 // cerr << "cache hit" << endl; |
533 return m_scaled[v][name]; | 533 return m_scaled[v][name]; |
534 } | 534 } |
535 | 535 |
536 QMutexLocker locker(&m_imageMapMutex); | 536 QMutexLocker locker(&m_imageMapMutex); |
537 | 537 |
538 if (m_images.find(name) == m_images.end()) { | 538 if (m_images.find(name) == m_images.end()) { |
539 m_images[name] = QImage(getLocalFilename(name)); | 539 m_images[name] = QImage(getLocalFilename(name)); |
540 } | 540 } |
541 | 541 |
542 if (m_images[name].isNull()) { | 542 if (m_images[name].isNull()) { |
543 // std::cerr << "null image" << std::endl; | 543 // cerr << "null image" << endl; |
544 m_scaled[v][name] = QImage(); | 544 m_scaled[v][name] = QImage(); |
545 } else if (m_images[name].width() <= maxSize.width() && | 545 } else if (m_images[name].width() <= maxSize.width() && |
546 m_images[name].height() <= maxSize.height()) { | 546 m_images[name].height() <= maxSize.height()) { |
547 m_scaled[v][name] = m_images[name]; | 547 m_scaled[v][name] = m_images[name]; |
548 } else { | 548 } else { |
625 bool | 625 bool |
626 ImageLayer::addImage(long frame, QString url) | 626 ImageLayer::addImage(long frame, QString url) |
627 { | 627 { |
628 QImage image(getLocalFilename(url)); | 628 QImage image(getLocalFilename(url)); |
629 if (image.isNull()) { | 629 if (image.isNull()) { |
630 std::cerr << "Failed to open image from url \"" << url << "\" (local filename \"" << getLocalFilename(url) << "\"" << std::endl; | 630 cerr << "Failed to open image from url \"" << url << "\" (local filename \"" << getLocalFilename(url) << "\"" << endl; |
631 delete m_fileSources[url]; | 631 delete m_fileSources[url]; |
632 m_fileSources.erase(url); | 632 m_fileSources.erase(url); |
633 return false; | 633 return false; |
634 } | 634 } |
635 | 635 |
913 } | 913 } |
914 | 914 |
915 ProgressDialog dialog(tr("Opening image URL..."), true, 2000); | 915 ProgressDialog dialog(tr("Opening image URL..."), true, 2000); |
916 FileSource *rf = new FileSource(img, &dialog); | 916 FileSource *rf = new FileSource(img, &dialog); |
917 if (rf->isOK()) { | 917 if (rf->isOK()) { |
918 std::cerr << "ok, adding it (local filename = " << rf->getLocalFilename() << ")" << std::endl; | 918 cerr << "ok, adding it (local filename = " << rf->getLocalFilename() << ")" << endl; |
919 m_fileSources[img] = rf; | 919 m_fileSources[img] = rf; |
920 connect(rf, SIGNAL(ready()), this, SLOT(fileSourceReady())); | 920 connect(rf, SIGNAL(ready()), this, SLOT(fileSourceReady())); |
921 } else { | 921 } else { |
922 delete rf; | 922 delete rf; |
923 } | 923 } |
946 QString img; | 946 QString img; |
947 for (FileSourceMap::const_iterator i = m_fileSources.begin(); | 947 for (FileSourceMap::const_iterator i = m_fileSources.begin(); |
948 i != m_fileSources.end(); ++i) { | 948 i != m_fileSources.end(); ++i) { |
949 if (i->second == rf) { | 949 if (i->second == rf) { |
950 img = i->first; | 950 img = i->first; |
951 // std::cerr << "it's image \"" << img << "\"" << std::endl; | 951 // cerr << "it's image \"" << img << "\"" << endl; |
952 break; | 952 break; |
953 } | 953 } |
954 } | 954 } |
955 if (img == "") return; | 955 if (img == "") return; |
956 | 956 |