@@ -2616,34 +2616,30 @@ static void fillGradientRectangle(GC gc, Device device,
26162616 RGB fromRGB , RGB toRGB ,
26172617 int redBits , int greenBits , int blueBits , int zoom ) {
26182618 /* Create the bitmap and tile it */
2619- ImageDataProvider imageDataProvider = imageZoom -> {
2620- int scaledWidth = DPIUtil .pointToPixel (width , imageZoom );
2621- int scaledHeight = DPIUtil .pointToPixel (height , imageZoom );
2622- return createGradientBand (scaledWidth , scaledHeight , vertical , fromRGB , toRGB , redBits , greenBits ,
2619+
2620+ ImageDataAtSizeProvider imageDataAtSizeProvider = (imageWidth , imageHeight ) -> {
2621+ return createGradientBand (imageWidth , imageHeight , vertical , fromRGB , toRGB , redBits , greenBits ,
26232622 blueBits );
26242623 };
2625- Image image = new Image (device , imageDataProvider );
2624+ Image image = new Image (device , imageDataAtSizeProvider );
26262625 ImageData band = image .getImageData (zoom );
26272626 if ((band .width == 1 ) || (band .height == 1 )) {
2628- gc .drawImage (image , 0 , 0 , DPIUtil .pixelToPoint (band .width , zoom ), DPIUtil .pixelToPoint (band .height , zoom ),
2629- DPIUtil .pixelToPoint (x , zoom ), DPIUtil .pixelToPoint (y , zoom ), DPIUtil .pixelToPoint (width , zoom ),
2630- DPIUtil .pixelToPoint (height , zoom ));
2627+ gc .drawImage (image , DPIUtil .pixelToPoint (x , zoom ), DPIUtil .pixelToPoint (y , zoom ),
2628+ DPIUtil .pixelToPoint (width , zoom ), DPIUtil .pixelToPoint (height , zoom ));
26312629 } else {
26322630 if (vertical ) {
26332631 for (int dx = 0 ; dx < width ; dx += band .width ) {
26342632 int blitWidth = width - dx ;
26352633 if (blitWidth > band .width ) blitWidth = band .width ;
2636- gc .drawImage (image , 0 , 0 , DPIUtil .pixelToPoint (blitWidth , zoom ), DPIUtil .pixelToPoint (band .height , zoom ),
2637- DPIUtil .pixelToPoint (dx + x , zoom ), DPIUtil .pixelToPoint (y , zoom ), DPIUtil .pixelToPoint (blitWidth , zoom ),
2638- DPIUtil .pixelToPoint (band .height , zoom ));
2634+ gc .drawImage (image , DPIUtil .pixelToPoint (dx + x , zoom ), DPIUtil .pixelToPoint (y , zoom ),
2635+ DPIUtil .pixelToPoint (blitWidth , zoom ), DPIUtil .pixelToPoint (band .height , zoom ));
26392636 }
26402637 } else {
26412638 for (int dy = 0 ; dy < height ; dy += band .height ) {
26422639 int blitHeight = height - dy ;
26432640 if (blitHeight > band .height ) blitHeight = band .height ;
2644- gc .drawImage (image , 0 , 0 , DPIUtil .pixelToPoint (band .width , zoom ), DPIUtil .pixelToPoint (blitHeight , zoom ),
2645- DPIUtil .pixelToPoint (x , zoom ), DPIUtil .pixelToPoint (dy + y , zoom ), DPIUtil .pixelToPoint (band .width , zoom ),
2646- DPIUtil .pixelToPoint (blitHeight , zoom ));
2641+ gc .drawImage (image , DPIUtil .pixelToPoint (x , zoom ), DPIUtil .pixelToPoint (dy + y , zoom ),
2642+ DPIUtil .pixelToPoint (band .width , zoom ), DPIUtil .pixelToPoint (blitHeight , zoom ));
26472643 }
26482644 }
26492645 }
0 commit comments