Skip to content

Commit

Permalink
some minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Bdtrotte committed Aug 15, 2017
1 parent 5f72b4a commit 5f8d1a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
14 changes: 2 additions & 12 deletions src/libtiled/wangset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,22 +320,12 @@ WangSet::WangSet(Tileset *tileset,

int WangSet::edgeColorCount() const
{
int size = mEdgeColors.size();

if (size > 1)
return size;
else
return 1;
return qMax(1, mEdgeColors.size());
}

int WangSet::cornerColorCount() const
{
int size = mCornerColors.size();

if (size > 1)
return size;
else
return 1;
return qMax(1, mCornerColors.size());
}

void WangSet::setEdgeColorCount(int n)
Expand Down
14 changes: 7 additions & 7 deletions src/tiled/stampbrush.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,15 +441,15 @@ void StampBrush::drawPreviewLayer(const QVector<QPoint> &list)
bounds.x(), bounds.y(),
bounds.width(), bounds.height()));

for (const QPoint p : list) {
WangFiller wangFiller(mWangSet,
dynamic_cast<StaggeredRenderer *>(mapDocument()->renderer()),
mapDocument()->map()->staggerAxis());
WangFiller wangFiller(mWangSet,
dynamic_cast<StaggeredRenderer *>(mapDocument()->renderer()),
mapDocument()->map()->staggerAxis());

for (const QPoint p : list) {
Cell cell = wangFiller.findFittingCell(*tileLayer,
*preview.data(),
paintedRegion,
p);
*preview.data(),
paintedRegion,
p);

preview->setCell(p.x() - bounds.left(),
p.y() - bounds.top(),
Expand Down

0 comments on commit 5f8d1a9

Please sign in to comment.