mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-16 10:15:13 +00:00
Refactor duplicate scaleFactor calculations.
This commit is contained in:
parent
9c865ab58b
commit
81abee58fa
@ -279,8 +279,8 @@ public class ImageBuilder {
|
|||||||
dx = -minmax.getMinX();
|
dx = -minmax.getMinX();
|
||||||
dy = -minmax.getMinY();
|
dy = -minmax.getMinY();
|
||||||
}
|
}
|
||||||
|
final double scaleFactor = (scale == null ? 1 : scale.getScale(dim.getWidth(), dim.getHeight())) * dpi / 96.0;
|
||||||
final UGraphic2 ug = createUGraphic(fileFormatOption, dim, animationArg, dx, dy);
|
final UGraphic2 ug = createUGraphic(fileFormatOption, dim, animationArg, dx, dy, scaleFactor);
|
||||||
UGraphic ug2 = ug;
|
UGraphic ug2 = ug;
|
||||||
maybeDrawBorder(ug, dim);
|
maybeDrawBorder(ug, dim);
|
||||||
if (randomPixel) {
|
if (randomPixel) {
|
||||||
@ -295,7 +295,6 @@ public class ImageBuilder {
|
|||||||
if (ug instanceof UGraphicG2d) {
|
if (ug instanceof UGraphicG2d) {
|
||||||
final Set<Url> urls = ((UGraphicG2d) ug).getAllUrlsEncountered();
|
final Set<Url> urls = ((UGraphicG2d) ug).getAllUrlsEncountered();
|
||||||
if (urls.size() > 0) {
|
if (urls.size() > 0) {
|
||||||
final double scaleFactor = (scale == null ? 1 : scale.getScale(dim.getWidth(), dim.getHeight())) * dpi / 96.0;
|
|
||||||
final CMapData cmap = CMapData.cmapString(urls, scaleFactor);
|
final CMapData cmap = CMapData.cmapString(urls, scaleFactor);
|
||||||
return new ImageDataComplex(dim, cmap, warningOrError, status);
|
return new ImageDataComplex(dim, cmap, warningOrError, status);
|
||||||
}
|
}
|
||||||
@ -412,8 +411,7 @@ public class ImageBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private UGraphic2 createUGraphic(FileFormatOption option, final Dimension2D dim, Animation animationArg,
|
private UGraphic2 createUGraphic(FileFormatOption option, final Dimension2D dim, Animation animationArg,
|
||||||
double dx, double dy) {
|
double dx, double dy, double scaleFactor) {
|
||||||
final double scaleFactor = (scale == null ? 1 : scale.getScale(dim.getWidth(), dim.getHeight())) * dpi / 96.0;
|
|
||||||
switch (option.getFileFormat()) {
|
switch (option.getFileFormat()) {
|
||||||
case PNG:
|
case PNG:
|
||||||
return createUGraphicPNG(scaleFactor, dim, animationArg, dx, dy,
|
return createUGraphicPNG(scaleFactor, dim, animationArg, dx, dy,
|
||||||
|
Loading…
Reference in New Issue
Block a user