Skip to content

Commit c849a19

Browse files
committed
Fix wrong vertical frame mirror for different sized channels
1 parent ce0b490 commit c849a19

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

deflect/server/Frame.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,17 @@ RowOrder Frame::determineRowOrder() const
7474

7575
return frameRowOrder;
7676
}
77+
78+
std::map<uint8_t, QSize> Frame::computeChannelDimensions() const
79+
{
80+
std::map<uint8_t, QSize> sizes;
81+
for (const auto& tile : tiles)
82+
{
83+
auto& size = sizes[tile.channel];
84+
size.setWidth(std::max(size.width(), (int)(tile.width + tile.x)));
85+
size.setHeight(std::max(size.height(), (int)(tile.height + tile.y)));
86+
}
87+
return sizes;
88+
}
7789
}
7890
}

deflect/server/Frame.h

+5
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
#include <QSize>
4747
#include <QString>
4848

49+
#include <map>
50+
4951
namespace deflect
5052
{
5153
namespace server
@@ -64,6 +66,9 @@ struct Frame
6466
/** @return the total dimensions of the given channel of this frame. */
6567
DEFLECT_API QSize computeDimensions(const uint8_t channel = 0) const;
6668

69+
/** @return the total dimensions of all channels of this frame. */
70+
DEFLECT_API std::map<uint8_t, QSize> computeChannelDimensions() const;
71+
6772
/**
6873
* @return the row order of all frame tiles.
6974
* @throws std::runtime_error if not all tiles have the same RowOrder.

deflect/server/FrameDispatcher.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ class FrameDispatcher::Impl
7575

7676
void mirrorTilesPositionsVertically(Frame& frame) const
7777
{
78-
const auto height = frame.computeDimensions().height();
78+
const auto sizes = frame.computeChannelDimensions();
7979
for (auto& tile : frame.tiles)
80-
tile.y = height - tile.y - tile.height;
80+
tile.y = sizes.at(tile.channel).height() - tile.y - tile.height;
8181
}
8282

8383
bool allConnectionsClosed(const QString& uri) const

doc/Changelog.md

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Changelog {#Changelog}
44
## Deflect 1.0
55

66
### 1.0.1 (master)
7+
* [207](https://github.com/BlueBrain/Deflect/pull/207):
8+
Fix wrong vertical frame mirror for different sized channels
79
* [203](https://github.com/BlueBrain/Deflect/pull/203):
810
QmlStreamer resizes the window only if the received size event is within the
911
specified min/max size hints.

0 commit comments

Comments
 (0)