Skip to content

Commit

Permalink
minor formatting changed
Browse files Browse the repository at this point in the history
  • Loading branch information
kryptonbutterfly committed Jan 18, 2024
1 parent 07dd701 commit de0b547
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/d/t/totp/misc/ImageUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,22 @@ public static final BufferedImage scaleDownToMax(BufferedImage rawImage, Vec2i m
final int maxHeight = maxSize.y();
final float targetAspect = 1F * maxWidth / maxHeight;
final float imageAspect = 1F * rawImage.getWidth() / rawImage.getHeight();

final float factor;

if (targetAspect > imageAspect)
{
if (rawImage.getHeight() <= maxHeight)
return rawImage;
final float factor = 1F * maxHeight / rawImage.getHeight();
return scale(factor, rawImage);
factor = 1F * maxHeight / rawImage.getHeight();
}
else
{
if (rawImage.getWidth() <= maxWidth)
return rawImage;
final float factor = 1F * maxWidth / rawImage.getWidth();
return scale(factor, rawImage);
factor = 1F * maxWidth / rawImage.getWidth();
}
return scale(factor, rawImage);
}

private static final BufferedImage scale(float factor, BufferedImage rawImage)
Expand Down
6 changes: 2 additions & 4 deletions src/d/t/totp/ui/main/TotpComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ public TotpComponent(TotpEntry entry, RemoveListener removeListener, char[] pass
public void updateCategory(HashMap<String, String> renameMap)
{
final var newName = renameMap.getOrDefault(entry.category, entry.category);
TinyTotp.config.getCategoryByName(newName).if_(cat ->
{
TinyTotp.config.getCategoryByName(newName).if_(cat -> {
entry.category = cat.name;
categoryPanel.setToolTipText(cat.name);
categoryPanel.setBackground(cat.color);
Expand Down Expand Up @@ -156,8 +155,7 @@ private void setIcon(String iconName)

private ActionListener edit(char[] password)
{
return ae -> EventQueue.invokeLater(() ->
{
return ae -> EventQueue.invokeLater(() -> {
final var owner = SwingUtilities.getWindowAncestor(this);
new AddKey(
owner,
Expand Down

0 comments on commit de0b547

Please sign in to comment.