1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-01 03:10:06 +00:00

DrawableImage: Remove a message thread dependency

This commit is contained in:
Tom Poole 2021-06-21 15:53:58 +01:00
parent efd0373525
commit 8ce68447bb
4 changed files with 31 additions and 24 deletions

View file

@ -40,6 +40,11 @@ DrawableImage::DrawableImage (const DrawableImage& other)
setBounds (other.getBounds());
}
DrawableImage::DrawableImage (const Image& imageToUse)
{
setImageInternal (imageToUse);
}
DrawableImage::~DrawableImage()
{
}
@ -52,13 +57,8 @@ std::unique_ptr<Drawable> DrawableImage::createCopy() const
//==============================================================================
void DrawableImage::setImage (const Image& imageToUse)
{
if (image != imageToUse)
{
image = imageToUse;
setBounds (image.getBounds());
setBoundingBox (image.getBounds().toFloat());
if (setImageInternal (imageToUse))
repaint();
}
}
void DrawableImage::setOpacity (const float newOpacity)
@ -133,6 +133,20 @@ Path DrawableImage::getOutlineAsPath() const
return {}; // not applicable for images
}
//==============================================================================
bool DrawableImage::setImageInternal (const Image& imageToUse)
{
if (image != imageToUse)
{
image = imageToUse;
setBounds (image.getBounds());
setBoundingBox (image.getBounds().toFloat());
return true;
}
return false;
}
//==============================================================================
std::unique_ptr<AccessibilityHandler> DrawableImage::createAccessibilityHandler()
{