// Horizontal flipping applies only to shape outline and not to the text in the shape.\r
// Applying flip second time restores the original not-flipped transform\r
if (horzFlip ^ vertFlip) {\r
- graphics.translate(anchor.getX() + anchor.getWidth(), anchor.getY());\r
+ final double ax = anchor.getX();\r
+ final double ay = anchor.getY();\r
+ graphics.translate(ax + anchor.getWidth(), ay);\r
graphics.scale(-1, 1);\r
- graphics.translate(-anchor.getX(), -anchor.getY());\r
+ graphics.translate(-ax, -ay);\r
}\r
\r
Double textRot = s.getTextRotation();\r
if (textRot != null && textRot != 0) {\r
- graphics.translate(anchor.getCenterX(), anchor.getCenterY());\r
+ final double cx = anchor.getCenterX();\r
+ final double cy = anchor.getCenterY();\r
+ graphics.translate(cx, cy);\r
graphics.rotate(Math.toRadians(textRot));\r
- graphics.translate(-anchor.getCenterX(), -anchor.getCenterY());\r
+ graphics.translate(-cx, -cy);\r
}\r
\r
// first dry-run to calculate the total height of the text\r
\r
TextDirection textDir = s.getTextDirection();\r
if (textDir == TextDirection.VERTICAL || textDir == TextDirection.VERTICAL_270) {\r
- double deg = (textDir == TextDirection.VERTICAL) ? 90 : 270;\r
- graphics.translate(anchor.getCenterX(), anchor.getCenterY());\r
+ final double deg = (textDir == TextDirection.VERTICAL) ? 90 : 270;\r
+ final double cx = anchor.getCenterX();\r
+ final double cy = anchor.getCenterY();\r
+ graphics.translate(cx, cy);\r
graphics.rotate(Math.toRadians(deg));\r
- graphics.translate(-anchor.getCenterX(), -anchor.getCenterY());\r
+ graphics.translate(-cx, -cy);\r
\r
// old top/left edge is now bottom/left or top/right - as we operate on the already\r
// rotated drawing context, both verticals can be moved in the same direction\r
- double w = anchor.getWidth();\r
- double h = anchor.getHeight();\r
- graphics.translate((w-h)/2d,(h-w)/2d);\r
+ final double w = anchor.getWidth();\r
+ final double h = anchor.getHeight();\r
+ final double dx = (w-h)/2d;\r
+ graphics.translate(dx,-dx);\r
}\r
\r
drawParagraphs(graphics, x, y);\r