@@ -564,14 +564,17 @@ private static boolean hasCodeMiningPrintedBelowLine(ITextViewer viewer, int lin
564564 starty = lineBounds .y ;
565565 }
566566
567- Image image = new Image (widget .getDisplay (), (gc , width , height ) -> {}, widget .getSize ().x , widget .getSize ().y );
567+ Image image = new Image (widget .getDisplay (), (gc , width , height ) -> {
568+ }, (widget .getSize ().x ), (widget .getSize ().y ));
568569 try {
569570 GC gc = new GC (widget );
570571 gc .copyArea (image , 0 , 0 );
571572 gc .dispose ();
572- ImageData imageData = image .getImageData ();
573- for (int x = startx + 1 ; x < image .getBounds ().width && x < imageData .width ; x ++) {
574- for (int y = starty ; y < imageData .height - 10 /*do not include the border*/ ; y ++) {
573+ int zoom = widget .getShell ().nativeZoom ;
574+ ImageData imageData = image .getImageData (zoom );
575+ double zoomFactor = zoom / 100.0 ;
576+ for (int x = (int ) (zoomFactor * startx + 1 ); x < image .getBounds ().width && x < imageData .width ; x ++) {
577+ for (int y = (int ) (zoomFactor * starty ); y < imageData .height - 10 /*do not include the border*/ ; y ++) {
575578 if (!imageData .palette .getRGB (imageData .getPixel (x , y )).equals (widget .getBackground ().getRGB ())) {
576579 // code mining printed
577580 return true ;
@@ -604,14 +607,20 @@ private static boolean hasCodeMiningPrintedAfterTextOnLine(ITextViewer viewer, i
604607 } else {
605608 secondLineBounds = widget .getTextBounds (lineOffset , lineOffset + lineLength );
606609 }
607- Image image = new Image (widget .getDisplay (), (gc , width , height ) -> {}, widget .getSize ().x , widget .getSize ().y );
610+
611+ Image image = new Image (widget .getDisplay (), (gc , width , height ) -> {
612+ }, (widget .getSize ().x ), (widget .getSize ().y ));
608613 GC gc = new GC (widget );
609614 gc .copyArea (image , 0 , 0 );
610615 gc .dispose ();
611- ImageData imageData = image .getImageData ();
616+ int zoom = widget .getShell ().nativeZoom ;
617+ ImageData imageData = image .getImageData (zoom );
618+
612619 secondLineBounds .x += secondLineBounds .width ; // look only area after text
613- for (int x = secondLineBounds .x + 1 ; x < image .getBounds ().width && x < imageData .width ; x ++) {
614- for (int y = secondLineBounds .y ; y < secondLineBounds .y + secondLineBounds .height && y < imageData .height ; y ++) {
620+
621+ double zoomFactor = zoom / 100.0 ;
622+ for (int x = (int ) (zoomFactor * (secondLineBounds .x + 1 )); x < image .getBounds ().width && x < imageData .width ; x ++) {
623+ for (int y = (int ) (zoomFactor * (secondLineBounds .y )); y < zoomFactor * (secondLineBounds .y + secondLineBounds .height ) && y < imageData .height ; y ++) {
615624 if (!imageData .palette .getRGB (imageData .getPixel (x , y )).equals (widget .getBackground ().getRGB ())) {
616625 // code mining printed
617626 image .dispose ();
0 commit comments