diff --git a/deflect/server/Frame.cpp b/deflect/server/Frame.cpp index 140d044..79296de 100644 --- a/deflect/server/Frame.cpp +++ b/deflect/server/Frame.cpp @@ -74,5 +74,17 @@ RowOrder Frame::determineRowOrder() const return frameRowOrder; } + +std::map Frame::computeChannelDimensions() const +{ + std::map sizes; + for (const auto& tile : tiles) + { + auto& size = sizes[tile.channel]; + size.setWidth(std::max(size.width(), (int)(tile.width + tile.x))); + size.setHeight(std::max(size.height(), (int)(tile.height + tile.y))); + } + return sizes; +} } } diff --git a/deflect/server/Frame.h b/deflect/server/Frame.h index daa1971..71704ef 100644 --- a/deflect/server/Frame.h +++ b/deflect/server/Frame.h @@ -46,6 +46,8 @@ #include #include +#include + namespace deflect { namespace server @@ -64,6 +66,9 @@ struct Frame /** @return the total dimensions of the given channel of this frame. */ DEFLECT_API QSize computeDimensions(const uint8_t channel = 0) const; + /** @return the total dimensions of all channels of this frame. */ + DEFLECT_API std::map computeChannelDimensions() const; + /** * @return the row order of all frame tiles. * @throws std::runtime_error if not all tiles have the same RowOrder. diff --git a/deflect/server/FrameDispatcher.cpp b/deflect/server/FrameDispatcher.cpp index 4e6ba6d..983c58b 100644 --- a/deflect/server/FrameDispatcher.cpp +++ b/deflect/server/FrameDispatcher.cpp @@ -75,9 +75,9 @@ class FrameDispatcher::Impl void mirrorTilesPositionsVertically(Frame& frame) const { - const auto height = frame.computeDimensions().height(); + const auto sizes = frame.computeChannelDimensions(); for (auto& tile : frame.tiles) - tile.y = height - tile.y - tile.height; + tile.y = sizes.at(tile.channel).height() - tile.y - tile.height; } bool allConnectionsClosed(const QString& uri) const diff --git a/doc/Changelog.md b/doc/Changelog.md index b531602..c2cc29c 100644 --- a/doc/Changelog.md +++ b/doc/Changelog.md @@ -4,6 +4,8 @@ Changelog {#Changelog} ## Deflect 1.0 ### 1.0.1 (master) +* [207](https://github.com/BlueBrain/Deflect/pull/207): + Fix wrong vertical frame mirror for different sized channels * [203](https://github.com/BlueBrain/Deflect/pull/203): QmlStreamer resizes the window only if the received size event is within the specified min/max size hints.