1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-16 00:34:19 +00:00

Improved scale factor used in cached images by ComponentAnimator.

This commit is contained in:
jules 2014-10-23 16:44:53 +01:00
parent 03a8f3987e
commit 3e63dc63ee

View file

@ -25,9 +25,7 @@
class ComponentAnimator::AnimationTask
{
public:
AnimationTask (Component* const comp) noexcept : component (comp)
{
}
AnimationTask (Component* c) noexcept : component (c) {}
void reset (const Rectangle<int>& finalBounds,
float finalAlpha,
@ -65,8 +63,8 @@ public:
bool useTimeslice (const int elapsed)
{
if (Component* const c = proxy != nullptr ? static_cast <Component*> (proxy)
: static_cast <Component*> (component))
if (Component* const c = proxy != nullptr ? static_cast<Component*> (proxy)
: static_cast<Component*> (component))
{
msElapsed += elapsed;
double newProgress = msElapsed / (double) msTotal;
@ -149,7 +147,10 @@ public:
else
jassertfalse; // seem to be trying to animate a component that's not visible..
image = c.createComponentSnapshot (c.getLocalBounds(), false, getDesktopScaleFactor());
const float scale = (float) Desktop::getInstance().getDisplays()
.getDisplayContaining (getScreenBounds().getCentre()).scale;
image = c.createComponentSnapshot (c.getLocalBounds(), false, scale);
setVisible (true);
toBehind (&c);
@ -189,14 +190,8 @@ private:
};
//==============================================================================
ComponentAnimator::ComponentAnimator()
: lastTime (0)
{
}
ComponentAnimator::~ComponentAnimator()
{
}
ComponentAnimator::ComponentAnimator() : lastTime (0) {}
ComponentAnimator::~ComponentAnimator() {}
//==============================================================================
ComponentAnimator::AnimationTask* ComponentAnimator::findTaskFor (Component* const component) const noexcept