Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 327962
Collapse All | Expand All

(-)src/org/eclipse/draw2d/ScaledGraphics.java (-19 / +23 lines)
Lines 302-312 Link Here
302
	/** @see Graphics#drawImage(Image, int, int) */
302
	/** @see Graphics#drawImage(Image, int, int) */
303
	public void drawImage(Image srcImage, int x, int y) {
303
	public void drawImage(Image srcImage, int x, int y) {
304
		org.eclipse.swt.graphics.Rectangle size = srcImage.getBounds();
304
		org.eclipse.swt.graphics.Rectangle size = srcImage.getBounds();
305
		graphics.drawImage(srcImage, 0, 0, size.width, size.height,
305
		graphics.drawImage(srcImage, 0, 0, size.width, size.height, (int) (Math
306
				(int) (Math.floor((x * zoom + fractionalX))),
306
				.floor((x * zoom + fractionalX))), (int) (Math
307
				(int) (Math.floor((y * zoom + fractionalY))),
307
				.floor((y * zoom + fractionalY))), (int) (Math
308
				(int) (Math.floor((size.width * zoom + fractionalX))),
308
				.floor((size.width * zoom + fractionalX))), (int) (Math
309
				(int) (Math.floor((size.height * zoom + fractionalY))));
309
				.floor((size.height * zoom + fractionalY))));
310
	}
310
	}
311
311
312
	/** @see Graphics#drawImage(Image, int, int, int, int, int, int, int, int) */
312
	/** @see Graphics#drawImage(Image, int, int, int, int, int, int, int, int) */
Lines 323-331 Link Here
323
	/** @see Graphics#drawLine(int, int, int, int) */
323
	/** @see Graphics#drawLine(int, int, int, int) */
324
	public void drawLine(int x1, int y1, int x2, int y2) {
324
	public void drawLine(int x1, int y1, int x2, int y2) {
325
		graphics.drawLine((int) (Math.floor((x1 * zoom + fractionalX))),
325
		graphics.drawLine((int) (Math.floor((x1 * zoom + fractionalX))),
326
				(int) (Math.floor((y1 * zoom + fractionalY))),
326
				(int) (Math.floor((y1 * zoom + fractionalY))), (int) (Math
327
				(int) (Math.floor((x2 * zoom + fractionalX))),
327
						.floor((x2 * zoom + fractionalX))), (int) (Math
328
				(int) (Math.floor((y2 * zoom + fractionalY))));
328
						.floor((y2 * zoom + fractionalY))));
329
	}
329
	}
330
330
331
	/** @see Graphics#drawOval(int, int, int, int) */
331
	/** @see Graphics#drawOval(int, int, int, int) */
Lines 345-352 Link Here
345
345
346
	/** @see Graphics#drawPoint(int, int) */
346
	/** @see Graphics#drawPoint(int, int) */
347
	public void drawPoint(int x, int y) {
347
	public void drawPoint(int x, int y) {
348
		graphics.drawPoint((int) Math.floor(x * zoom + fractionalX),
348
		graphics.drawPoint((int) Math.floor(x * zoom + fractionalX), (int) Math
349
				(int) Math.floor(y * zoom + fractionalY));
349
				.floor(y * zoom + fractionalY));
350
	}
350
	}
351
351
352
	/**
352
	/**
Lines 416-425 Link Here
416
			return;
416
			return;
417
		}
417
		}
418
		try {
418
		try {
419
			graphics.drawTextLayout(scaled,
419
			graphics.drawTextLayout(scaled, (int) Math.floor(x * zoom
420
					(int) Math.floor(x * zoom + fractionalX),
420
					+ fractionalX), (int) Math.floor(y * zoom + fractionalY),
421
					(int) Math.floor(y * zoom + fractionalY), selectionStart,
421
					selectionStart, selectionEnd, selectionBackground,
422
					selectionEnd, selectionBackground, selectionForeground);
422
					selectionForeground);
423
		} finally {
423
		} finally {
424
			scaled.dispose();
424
			scaled.dispose();
425
		}
425
		}
Lines 867-873 Link Here
867
		double dyFloat = dy * zoom + fractionalY;
867
		double dyFloat = dy * zoom + fractionalY;
868
		fractionalX = dxFloat - Math.floor(dxFloat);
868
		fractionalX = dxFloat - Math.floor(dxFloat);
869
		fractionalY = dyFloat - Math.floor(dyFloat);
869
		fractionalY = dyFloat - Math.floor(dyFloat);
870
		graphics.translate((int) Math.floor(dxFloat), (int) Math.floor(dyFloat));
870
		graphics
871
				.translate((int) Math.floor(dxFloat), (int) Math.floor(dyFloat));
871
	}
872
	}
872
873
873
	/** @see Graphics#translate(float, float) */
874
	/** @see Graphics#translate(float, float) */
Lines 876-891 Link Here
876
		double dyFloat = dy * zoom + fractionalY;
877
		double dyFloat = dy * zoom + fractionalY;
877
		fractionalX = dxFloat - Math.floor(dxFloat);
878
		fractionalX = dxFloat - Math.floor(dxFloat);
878
		fractionalY = dyFloat - Math.floor(dyFloat);
879
		fractionalY = dyFloat - Math.floor(dyFloat);
879
		graphics.translate((int) Math.floor(dxFloat), (int) Math.floor(dyFloat));
880
		graphics
881
				.translate((int) Math.floor(dxFloat), (int) Math.floor(dyFloat));
880
	}
882
	}
881
883
882
	private Rectangle zoomClipRect(Rectangle r) {
884
	private Rectangle zoomClipRect(Rectangle r) {
883
		tempRECT.x = (int) (Math.floor(r.x * zoom + fractionalX));
885
		tempRECT.x = (int) (Math.floor(r.x * zoom + fractionalX));
884
		tempRECT.y = (int) (Math.floor(r.y * zoom + fractionalY));
886
		tempRECT.y = (int) (Math.floor(r.y * zoom + fractionalY));
885
		tempRECT.width = (int) (Math
887
		tempRECT.width = (int) (Math
886
				.ceil(((r.x + r.width) * zoom + fractionalX))) - tempRECT.x;
888
				.ceil(((r.x + r.width) * zoom + fractionalX)))
889
				- tempRECT.x;
887
		tempRECT.height = (int) (Math
890
		tempRECT.height = (int) (Math
888
				.ceil(((r.y + r.height) * zoom + fractionalY))) - tempRECT.y;
891
				.ceil(((r.y + r.height) * zoom + fractionalY)))
892
				- tempRECT.y;
889
		return tempRECT;
893
		return tempRECT;
890
	}
894
	}
891
895
Lines 915-921 Link Here
915
	}
919
	}
916
920
917
	float zoomLineWidth(float w) {
921
	float zoomLineWidth(float w) {
918
		return w;
922
		return (float) (w * zoom);
919
	}
923
	}
920
924
921
	private int[] zoomPointList(int[] points) {
925
	private int[] zoomPointList(int[] points) {

Return to bug 327962