Skip to content

Commit

Permalink
Removes 1 pixel offset for icons on Windows
Browse files Browse the repository at this point in the history
From feedback in the forum, we understand that the 1 pixel shift
introduced with #2752 is not necessary anymore.

Issue: https://forum.portfolio-performance.info/t/dark-mode-fur-pp/3739/75
Issue: #3615
Signed-off-by: Nirus2000 <webmaster@nirus-online.de>
[reformatted to code format; rebased to master]
Signed-off-by: Andreas Buchen <andreas.buchen@gmail.com>
  • Loading branch information
Nirus2000 authored and buchen committed Oct 31, 2023
1 parent b47ed0a commit ab7f812
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.HashMap;

import org.eclipse.core.runtime.Platform;
import org.eclipse.swt.graphics.Image;

import name.abuchen.portfolio.model.AttributeType.ImageConverter;
Expand All @@ -22,12 +21,23 @@ private ImageManager()
{
}

/**
* Retrieves an image associated with the given Attributable and
* AttributeType. If not found, a default image is returned.
*
* @return The retrieved image or null if not found.
*/
public Image getImage(Attributable target, AttributeType attr)
{
int xOffset = Platform.OS_WIN32.equals(Platform.getOS()) ? 1 : 0;
return getImage(target, attr, xOffset, 16, 16);
return getImage(target, attr, 0, 16, 16);
}

/**
* Retrieves an image associated with the given Attributable, AttributeType,
* and additional parameters. If not found, a default image is returned.
*
* @return The retrieved image or null if not found.
*/
public Image getImage(Attributable target, AttributeType attr, int xOffset, int width, int height)
{
if (target != null && target.getAttributes().exists(attr) && attr.getConverter() instanceof ImageConverter)
Expand Down

0 comments on commit ab7f812

Please sign in to comment.