| 1773 | } |
| 1774 | |
| 1775 | void ImageViewer::updateImage(string_view imageName, bool shallSelect, string_view channel, Box2i bounds, span<const float> imageData) { |
| 1776 | auto image = imageByName(imageName); |
| 1777 | if (!image) { |
| 1778 | tlog::warning("Image {} could not be updated, because it does not exist.", imageName); |
| 1779 | return; |
| 1780 | } |
| 1781 | |
| 1782 | tlog::debug( |
| 1783 | "Updating image: name=\"{}\" channel={} bounds=[{}, {}] data.size={} shallSelect={}", |
| 1784 | imageName, |
| 1785 | channel, |
| 1786 | bounds.min, |
| 1787 | bounds.max, |
| 1788 | imageData.size(), |
| 1789 | shallSelect |
| 1790 | ); |
| 1791 | |
| 1792 | image->updateChannel(channel, bounds, imageData); |
| 1793 | if (shallSelect) { |
| 1794 | selectImage(image); |
| 1795 | } |
| 1796 | |
| 1797 | // This image needs newly computed statistics... so give it a new ID. However, if the image is currently shown, we don't want to |
| 1798 | // overwhelm the CPU, so we only launch new statistics computations every so often. These computations are scheduled from `drawContents` |
| 1799 | // via the `mToBump` set. |
| 1800 | if (image != mCurrentImage && image != mCurrentReference) { |
| 1801 | image->bumpId(); |
| 1802 | } else { |
| 1803 | mToBump.insert(image); |
| 1804 | } |
| 1805 | } |
| 1806 | |
| 1807 | void ImageViewer::updateImageVectorGraphics(string_view imageName, bool shallSelect, bool append, span<const VgCommand> commands) { |
| 1808 | auto image = imageByName(imageName); |
no test coverage detected