+
+ int width = pos(0) + size(0) - bw / 2 - pos(0) + bw / 2;
+ int height = pos(1) + size(1) - bh / 2 - pos(1) + bh / 2;
+
+ if (fixedaspect) {
+ int hstretch = width / image.getWidth();
+ if (hstretch == 0) hstretch = -1 * image.getWidth() / width;
+ int vstretch = height / image.getHeight();
+ if (vstretch == 0) vstretch = -1 * image.getHeight() / height;
+
+ if (hstretch < vstretch) {
+ height = image.getHeight() * width / image.getWidth();
+ } else {
+ width = image.getWidth() * height / image.getHeight();
+ }
+ }
+