Lines 73-87
Link Here
|
73 |
int bufferHeight = getKey().getHeight() == 0 ? origHeight : getKey().getHeight(); |
73 |
int bufferHeight = getKey().getHeight() == 0 ? origHeight : getKey().getHeight(); |
74 |
|
74 |
|
75 |
int newWidth = bufferWidth; |
75 |
int newWidth = bufferWidth; |
76 |
int newHeight = bufferWidth; |
76 |
int newHeight = bufferHeight; |
77 |
|
77 |
|
78 |
if (getKey().shouldMaintainAspectRatio()) { |
78 |
if (getKey().shouldMaintainAspectRatio()) { |
79 |
if (newWidth > newHeight) { |
79 |
double origAspectRatio = origHeight / (double)origWidth; |
80 |
newHeight = (int)Math.round(newWidth * origHeight / (double)origWidth); |
80 |
if (origAspectRatio > newHeight / (double)newWidth) { |
81 |
} |
81 |
newWidth = (int)Math.round(newHeight / origAspectRatio); |
82 |
else { |
82 |
} else { |
83 |
newWidth = (int)Math.round(newHeight * origWidth / (double)origHeight); |
83 |
newHeight = (int)Math.round(newWidth * origAspectRatio); |
84 |
} |
84 |
} |
85 |
|
85 |
|
86 |
double scale = 1.0; |
86 |
double scale = 1.0; |
87 |
if (newWidth > bufferWidth) |
87 |
if (newWidth > bufferWidth) |