1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

ScaledImage: Use in a few more places

This commit is contained in:
reuk 2021-11-25 18:14:31 +00:00
parent 34fdea0708
commit 03428561ed
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
10 changed files with 42 additions and 28 deletions

View file

@ -36,14 +36,14 @@ public:
{
}
SharedCursorHandle (const Image& image, Point<int> hotSpot, float scaleFactor)
: info { image, hotSpot, scaleFactor },
SharedCursorHandle (const ScaledImage& image, Point<int> hotSpot)
: info { image, hotSpot },
handle (info),
standardType (MouseCursor::NormalCursor),
standard (false)
{
// your hotspot needs to be within the bounds of the image!
jassert (image.getBounds().contains (hotSpot));
jassert (image.getImage().getBounds().contains (hotSpot));
}
static std::shared_ptr<SharedCursorHandle> createStandard (const MouseCursor::StandardCursorType type)
@ -92,12 +92,17 @@ MouseCursor::MouseCursor (const StandardCursorType type)
}
MouseCursor::MouseCursor (const Image& image, int hotSpotX, int hotSpotY)
: MouseCursor (image, hotSpotX, hotSpotY, 1.0f)
: MouseCursor (ScaledImage (image), { hotSpotX, hotSpotY })
{
}
MouseCursor::MouseCursor (const Image& image, int hotSpotX, int hotSpotY, float scaleFactor)
: cursorHandle (std::make_shared<SharedCursorHandle> (image, Point<int> { hotSpotX, hotSpotY }, scaleFactor))
: MouseCursor (ScaledImage (image, scaleFactor), { hotSpotX, hotSpotY })
{
}
MouseCursor::MouseCursor (const ScaledImage& image, Point<int> hotSpot)
: cursorHandle (std::make_shared<SharedCursorHandle> (image, hotSpot))
{
}