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

Windows: Fix conversion of WindowsBitmapImages to SoftwareBitmapImages

This commit is contained in:
reuk 2024-08-14 14:25:20 +01:00
parent b7db89cb8e
commit 6f2293d91b
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C

View file

@ -1019,8 +1019,18 @@ public:
std::unique_ptr<ImageType> createType() const override std::unique_ptr<ImageType> createType() const override
{ {
// WindowsBitmapImage needs to be a software bitmap, not a D2D bitmap // This type only exists to return a type ID that's different to the SoftwareImageType's ID,
return std::make_unique<SoftwareImageType>(); // so that `SoftwareImageType{}.convert (windowsBitmapImage)` works.
// If we return SoftwareImageType here, then SoftwareImageType{}.convert() will compare the
// type IDs and assume the source image is already of the correct type.
struct Type : public ImageType
{
int getTypeID() const override { return ByteOrder::makeInt ('w', 'b', 'i', 't'); }
ImagePixelData::Ptr create (Image::PixelFormat, int, int, bool) const override { return {}; }
Image convert (const Image&) const override { return {}; }
};
return std::make_unique<Type>();
} }
std::unique_ptr<LowLevelGraphicsContext> createLowLevelContext() override std::unique_ptr<LowLevelGraphicsContext> createLowLevelContext() override