@@ -532,9 +532,7 @@ public Image(Device device, ImageData source, ImageData mask) {
532532public Image (Device device , InputStream stream ) {
533533 super (device );
534534 currentDeviceZoom = DPIUtil .getDeviceZoom ();
535- // FIXME: is this the right zoom? That's what is done in windows Image.getZoom()?
536- int zoom = DPIUtil .getZoomForAutoscaleProperty (currentDeviceZoom );
537- ElementAtZoom <ImageData > image = ImageDataLoader .load (stream , FileFormat .DEFAULT_ZOOM , zoom );
535+ ElementAtZoom <ImageData > image = ImageDataLoader .load (stream , FileFormat .DEFAULT_ZOOM , currentDeviceZoom );
538536 ImageData data = DPIUtil .autoScaleUp (device , image );
539537 init (data );
540538 init ();
@@ -576,9 +574,7 @@ public Image(Device device, String filename) {
576574 super (device );
577575 if (filename == null ) SWT .error (SWT .ERROR_NULL_ARGUMENT );
578576 currentDeviceZoom = DPIUtil .getDeviceZoom ();
579- // FIXME: is this the right zoom? That's what is done in windows Image.getZoom()?
580- int zoom = DPIUtil .getZoomForAutoscaleProperty (currentDeviceZoom );
581- ElementAtZoom <ImageData > image = ImageDataLoader .load (filename , FileFormat .DEFAULT_ZOOM , zoom );
577+ ElementAtZoom <ImageData > image = ImageDataLoader .load (filename , FileFormat .DEFAULT_ZOOM , currentDeviceZoom );
582578 ImageData data = DPIUtil .autoScaleUp (device , image );
583579 init (data );
584580 init ();
@@ -617,17 +613,18 @@ public Image(Device device, ImageFileNameProvider imageFileNameProvider) {
617613 super (device );
618614 this .imageFileNameProvider = imageFileNameProvider ;
619615 currentDeviceZoom = DPIUtil .getDeviceZoom ();
620- ElementAtZoom <String > filename = DPIUtil .validateAndGetImagePathAtZoom (imageFileNameProvider , currentDeviceZoom );
621- ElementAtZoom <ImageData > imageData = ImageDataLoader .load (filename .element (), filename .zoom (), currentDeviceZoom );
622- if (imageData .zoom () == currentDeviceZoom ) {
623- initNative (filename .element ());
624-
625- if (this .surface == 0 ) {
616+ ElementAtZoom <String > fileName = DPIUtil .validateAndGetImagePathAtZoom (imageFileNameProvider , currentDeviceZoom );
617+ if (fileName .zoom () == currentDeviceZoom ) {
618+ initNative (fileName .element ());
619+ }
620+ if (this .surface == 0 ) {
621+ ElementAtZoom <ImageData > imageData = ImageDataLoader .load (fileName .element (), fileName .zoom (), currentDeviceZoom );
622+ if (imageData .zoom () == currentDeviceZoom ) {
626623 init (imageData .element ());
624+ } else {
625+ ImageData resizedData = DPIUtil .autoScaleUp (device , imageData );
626+ init (resizedData );
627627 }
628- } else {
629- ImageData resizedData = DPIUtil .autoScaleUp (device , imageData );
630- init (resizedData );
631628 }
632629 init ();
633630}
0 commit comments