diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageData.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageData.java index 6b74adc9c26..679db492abe 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageData.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageData.java @@ -2616,9 +2616,15 @@ static void fillGradientRectangle(GC gc, Device device, RGB fromRGB, RGB toRGB, int redBits, int greenBits, int blueBits, int zoom) { /* Create the bitmap and tile it */ - ImageData band = createGradientBand(width, height, vertical, - fromRGB, toRGB, redBits, greenBits, blueBits); - Image image = new Image(device, band); + ImageDataProvider imageDataProvider = imageZoom -> { + float scaleFactor = imageZoom / 100f; + int scaledWidth = Math.round(width * scaleFactor); + int scaledHeight = Math.round(height * scaleFactor); + return createGradientBand(scaledWidth, scaledHeight, vertical, fromRGB, toRGB, redBits, greenBits, + blueBits); + }; + Image image = new Image(device, imageDataProvider); + ImageData band = image.getImageData(); if ((band.width == 1) || (band.height == 1)) { gc.drawImage(image, 0, 0, DPIUtil.pixelToPoint(band.width, zoom), DPIUtil.pixelToPoint(band.height, zoom), DPIUtil.pixelToPoint(x, zoom), DPIUtil.pixelToPoint(y, zoom), DPIUtil.pixelToPoint(width, zoom),