File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
modules/juce_gui_basics/components Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -214,14 +214,20 @@ class Component::EffectState
214214 auto scale = g.getInternalContext ().getPhysicalPixelScaleFactor ();
215215 auto scaledBounds = c.getLocalBounds () * scale;
216216
217- if (effectImage.getBounds () != scaledBounds)
217+ const auto preferredType = g.getInternalContext ().getPreferredImageTypeForTemporaryImages ();
218+ const auto pixelData = effectImage.getPixelData ();
219+ const auto shouldCreateImage = pixelData == nullptr
220+ || pixelData->width != scaledBounds.getWidth ()
221+ || pixelData->height != scaledBounds.getHeight ()
222+ || pixelData->createType ()->getTypeID () != preferredType->getTypeID ();
223+
224+ if (shouldCreateImage)
218225 {
219- auto tempImageType = g.getInternalContext ().getPreferredImageTypeForTemporaryImages ();
220226 effectImage = Image { c.isOpaque () ? Image::RGB : Image::ARGB,
221227 scaledBounds.getWidth (),
222228 scaledBounds.getHeight (),
223229 false ,
224- *tempImageType };
230+ *preferredType };
225231 effectImage.setBackupEnabled (false );
226232 }
227233
You can’t perform that action at this time.
0 commit comments