MCPcopy Create free account
hub / github.com/Tom94/tev / sizeToFitImage

Method sizeToFitImage

src/ImageViewer.cpp:2175–2193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2173}
2174
2175Vector2f ImageViewer::sizeToFitImage(const shared_ptr<Image>& image) {
2176 if (!image) {
2177 return m_size;
2178 }
2179
2180 // Convert from image pixel coordinates to nanogui coordinates.
2181 auto requiredSize = Vector2f{image->displaySize()} / pixel_ratio();
2182
2183 // Take into account the size of the UI.
2184 if (mSidebar->visible()) {
2185 requiredSize.x() += mSidebar->fixed_width();
2186 }
2187
2188 if (mFooter->visible()) {
2189 requiredSize.y() += mFooter->fixed_height();
2190 }
2191
2192 return requiredSize;
2193}
2194
2195Vector2f ImageViewer::sizeToFitAllImages() {
2196 Vector2f result = m_size;

Callers

nothing calls this directly

Calls 1

displaySizeMethod · 0.45

Tested by

no test coverage detected