Browse Source

Fixed various MSVC warnings about clashing variable names.

pull/331/head
Vladimír Vondruš 7 years ago
parent
commit
2b30246ff2
  1. 9
      doc/snippets/MagnumAnimation.cpp
  2. 15
      src/Magnum/Animation/Player.hpp
  3. 10
      src/Magnum/Text/Test/AbstractGlyphCacheTest.cpp

9
doc/snippets/MagnumAnimation.cpp

@ -37,9 +37,9 @@ using namespace Magnum::Math::Literals;
int main() {
{
Vector3 a, b;
Float t{};
{
Vector3 a, b;
/* [ease] */
auto lerpBounceIn =
Animation::ease<Vector3, Math::lerp, Animation::Easing::bounceIn>();
@ -303,8 +303,11 @@ const Animation::Track<Float, Vector2> jump{{
Vector2 position = jump.at(2.2f); // y = 0.775
/* [Track-usage] */
static_cast<void>(position);
}
{
const Animation::Track<Float, Vector2> jump;
/* [Track-performance-hint] */
std::size_t hint = 0;
Vector2 position = jump.at(2.2f, hint); // y = 0.775, hint = 2
@ -313,6 +316,7 @@ static_cast<void>(position);
}
{
const Animation::Track<Float, Vector2> jump;
/* [Track-performance-strict] */
std::size_t hint = 0;
Vector2 position = jump.atStrict(2.2f, hint); // y = 0.775, hint = 2
@ -320,9 +324,6 @@ Vector2 position = jump.atStrict(2.2f, hint); // y = 0.775, hint = 2
static_cast<void>(position);
}
static_cast<void>(position);
}
{
/* [Track-performance-cache] */
struct Keyframe {

15
src/Magnum/Animation/Player.hpp

@ -255,14 +255,17 @@ template<class T, class K> Containers::Optional<std::pair<UnsignedInt, K>> playe
}
template<class T, class K> std::pair<UnsignedInt, K> Player<T, K>::elapsed(const T time) const {
const K duration = _duration.size();
/* Get the elapsed time. This is an immutable query, so make copies of the
(otherwise to be modified) internal state. */
T startTime = _startTime;
T pauseTime = _stopPauseTime;
State state = _state;
const K duration = _duration.size();
const Containers::Optional<std::pair<UnsignedInt, K>> elapsed = Implementation::playerElapsed(duration, _playCount, _scaler, time, startTime, pauseTime, state);
if(elapsed) return *elapsed;
{
T startTime = _startTime;
T pauseTime = _stopPauseTime;
State state = _state;
const Containers::Optional<std::pair<UnsignedInt, K>> elapsed = Implementation::playerElapsed(duration, _playCount, _scaler, time, startTime, pauseTime, state);
if(elapsed) return *elapsed;
}
/* If not advancing, the animation can be paused -- calculate the iteration
index and keyframe at which it was paused if the duration is nonzero. If

10
src/Magnum/Text/Test/AbstractGlyphCacheTest.cpp

@ -118,17 +118,17 @@ void AbstractGlyphCacheTest::setImage() {
GlyphCacheFeatures doFeatures() const override { return {}; }
void doSetImage(const Vector2i& offset, const ImageView2D& image) override {
this->offset = offset;
this->size = image.size();
imageOffset = offset;
imageSize = image.size();
}
Vector2i offset, size;
Vector2i imageOffset, imageSize;
} cache{{100, 200}};
cache.setImage({80, 175}, ImageView2D{{}, {20, 25}, nullptr});
CORRADE_COMPARE(cache.offset, (Vector2i{80, 175}));
CORRADE_COMPARE(cache.size, (Vector2i{20, 25}));
CORRADE_COMPARE(cache.imageOffset, (Vector2i{80, 175}));
CORRADE_COMPARE(cache.imageSize, (Vector2i{20, 25}));
}
void AbstractGlyphCacheTest::setImageOutOfBounds() {

Loading…
Cancel
Save