You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug Image.getImageData() is supposed to return an ImageData where, according to the javadocs, "Modifications made to this ImageData will not affect the Image."
In some cases, it DOES return the ImageData that will affect the Image upon modification.
This is because org.eclipse.swt.internal.DPIUtil#scaleImageData(org.eclipse.swt.graphics.Device, org.eclipse.swt.graphics.ImageData, int, int) returns the live imageData variable directly if certain criteria is met (targetZoom == currentZoom) Line Source. When that criteria isn't met, it correctly returns a copy (because it creates a scaled version)
Expected behavior Image.getImageData() should always return a duplicate of ImageData and not the actual ImageData of the Image.
Environment:
Select the platform(s) on which the behavior is seen:
All OS
SWT
Seen on SWT 4.34 (4967r8) on Windows, but probably present on all OS since DPIUtil is cross platform
Workaround (or) Additional context
Lazy workaround is to call scaleTo with same dimensions, ensuring an ImageData that won't modify the original image:
Describe the bug
Image.getImageData()
is supposed to return anImageData
where, according to the javadocs, "Modifications made to thisImageData
will not affect the Image."In some cases, it DOES return the ImageData that will affect the Image upon modification.
This is because
org.eclipse.swt.internal.DPIUtil#scaleImageData(org.eclipse.swt.graphics.Device, org.eclipse.swt.graphics.ImageData, int, int)
returns the liveimageData
variable directly if certain criteria is met (targetZoom == currentZoom
) Line Source. When that criteria isn't met, it correctly returns a copy (because it creates a scaled version)Expected behavior
Image.getImageData()
should always return a duplicate ofImageData
and not the actualImageData
of theImage
.Environment:
Seen on SWT 4.34 (4967r8) on Windows, but probably present on all OS since DPIUtil is cross platform
Workaround (or) Additional context
Lazy workaround is to call scaleTo with same dimensions, ensuring an
ImageData
that won't modify the original image:The text was updated successfully, but these errors were encountered: