Browse Source

Improved scale factor used in cached images by ComponentAnimator.

tags/2021-05-28
jules 11 years ago
parent
commit
3e63dc63ee
1 changed files with 9 additions and 14 deletions
  1. +9
    -14
      modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp

+ 9
- 14
modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp 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


Loading…
Cancel
Save