Stretched Fixed Mode Plugin: Add Integer Scaling option (#2863)
Forces integer scale factor by rounding stretched dimensions towards zero.
This commit is contained in:
committed by
Tomas Slusny
parent
108f441f23
commit
d2871d925c
@@ -40,6 +40,9 @@ public abstract class StretchedFixedModeMixin implements RSClient
|
||||
@Inject
|
||||
private static boolean stretchedFast;
|
||||
|
||||
@Inject
|
||||
private static boolean stretchedIntegerScaling;
|
||||
|
||||
@Inject
|
||||
private static boolean stretchedKeepAspectRatio;
|
||||
|
||||
@@ -77,6 +80,14 @@ public abstract class StretchedFixedModeMixin implements RSClient
|
||||
stretchedFast = state;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setStretchedIntegerScaling(boolean state)
|
||||
{
|
||||
stretchedIntegerScaling = state;
|
||||
cachedStretchedDimensions = null;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setStretchedKeepAspectRatio(boolean state)
|
||||
@@ -122,6 +133,18 @@ public abstract class StretchedFixedModeMixin implements RSClient
|
||||
}
|
||||
}
|
||||
|
||||
if (stretchedIntegerScaling)
|
||||
{
|
||||
if (width > Constants.GAME_FIXED_WIDTH)
|
||||
{
|
||||
width = width - (width % Constants.GAME_FIXED_WIDTH);
|
||||
}
|
||||
if (height > Constants.GAME_FIXED_HEIGHT)
|
||||
{
|
||||
height = height - (height % Constants.GAME_FIXED_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
cachedStretchedDimensions = new Dimension(width, height);
|
||||
lastCanvasDimensions = new Dimension(width, height);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user