From 7a18f14d98bbf7094dd0faa55cb6d90c7645ec80 Mon Sep 17 00:00:00 2001 From: Tor Norbye Date: Mon, 28 Feb 2011 18:50:51 -0800 Subject: [PATCH] Fix Palette preview image scaling on Windows When using palette previews with a scaling factor (e.g. the small or tiny palette modes), the preview images look bad on Windows. This appears to be because SWT on Windows has a different set of defaults for antialiasing and interpolation. This checkin turns on antialiased high interpolation for image painting in the palette (when the palette is scaled) to address the first issue listed in 15071: Layout editor rendering issues in ADT 10 Change-Id: Ie3c619d9105d9d30b1bbe5fb91c195c0f65fee97 --- .../ide/eclipse/adt/internal/editors/layout/gle2/ImageControl.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageControl.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageControl.java index d3349e417..c33c4fe80 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageControl.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageControl.java @@ -147,14 +147,21 @@ public class ImageControl extends Canvas implements MouseTrackListener { int destWidth = imageWidth; int destHeight = imageHeight; + int oldGcAlias = gc.getAntialias(); + int oldGcInterpolation = gc.getInterpolation(); if (mScale != 1.0f) { destWidth = (int) (mScale * destWidth); destHeight = (int) (mScale * destHeight); + gc.setAntialias(SWT.ON); + gc.setInterpolation(SWT.HIGH); } gc.drawImage(mImage, 0, 0, imageWidth, imageHeight, rect.x + mLeftMargin, rect.y + mTopMargin, destWidth, destHeight); + gc.setAntialias(oldGcAlias); + gc.setInterpolation(oldGcInterpolation); + if (mHoverColor != null && mMouseIn) { gc.setAlpha(60); gc.setBackground(mHoverColor); -- 2.11.0