Skip to content

Commit

Permalink
Fix wrong vertical frame mirror for different sized channels
Browse files Browse the repository at this point in the history
  • Loading branch information
tribal-tec committed Nov 21, 2018
1 parent ce0b490 commit c849a19
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
12 changes: 12 additions & 0 deletions deflect/server/Frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,17 @@ RowOrder Frame::determineRowOrder() const

return frameRowOrder;
}

std::map<uint8_t, QSize> Frame::computeChannelDimensions() const
{
std::map<uint8_t, QSize> 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;
}
}
}
5 changes: 5 additions & 0 deletions deflect/server/Frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
#include <QSize>
#include <QString>

#include <map>

namespace deflect
{
namespace server
Expand All @@ -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<uint8_t, QSize> computeChannelDimensions() const;

/**
* @return the row order of all frame tiles.
* @throws std::runtime_error if not all tiles have the same RowOrder.
Expand Down
4 changes: 2 additions & 2 deletions deflect/server/FrameDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions doc/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit c849a19

Please sign in to comment.