Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void TileLayer::resize(const QSize &size, const QPoint &offset)
- {
- if (this->size() == size && offset.isNull())
- return;
- QScopedPointer<TileLayer> newLayer(new TileLayer(QString(), 0, 0, size.width(), size.height()));
- // Copy over the preserved part
- QRect area = mBounds.translated(-position() + offset).intersected(newLayer->rect());
- for (int y = area.top(); y <= area.bottom(); ++y)
- for (int x = area.left(); x <= area.right(); ++x)
- newLayer->setCell(x, y, cellAt(x - offset.x(), y - offset.y()));
- mChunks = newLayer->mChunks;
- mBounds = newLayer->mBounds;
- setSize(size);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement