|
Lines 103-118
public abstract class AbstractCachedSVGFigure extends SVGFigure implements Style
Link Here
|
| 103 |
TransparentFigureGraphicsModifier modifier = new TransparentFigureGraphicsModifier(this, graphics); |
103 |
TransparentFigureGraphicsModifier modifier = new TransparentFigureGraphicsModifier(this, graphics); |
| 104 |
modifier.pushState(); |
104 |
modifier.pushState(); |
| 105 |
|
105 |
|
| 106 |
Rectangle r = getClientArea(); |
106 |
Rectangle svgArea = getClientArea(); |
| 107 |
Image image = getCachedImage(getKey() + getContextKey(graphics), r, graphics); |
107 |
Rectangle scaledArea = new Rectangle(svgArea); |
|
|
108 |
scaledArea.performScale(graphics.getAbsoluteScale()); |
| 109 |
Image image = getCachedImage(getKey() + getContextKey(graphics, scaledArea), scaledArea, graphics); |
| 108 |
// Draw the image |
110 |
// Draw the image |
| 109 |
if (image != null) { |
111 |
if (image != null) { |
| 110 |
graphics.drawImage(image, r.x, r.y); |
112 |
graphics.drawImage(image, // |
|
|
113 |
0, 0, scaledArea.width, scaledArea.height, // |
| 114 |
svgArea.x, svgArea.y, svgArea.width, svgArea.height); |
| 111 |
} |
115 |
} |
| 112 |
modifier.popState(); |
116 |
modifier.popState(); |
| 113 |
} |
117 |
} |
| 114 |
|
118 |
|
| 115 |
private String getContextKey(Graphics graphics) { |
119 |
private String getContextKey(Graphics graphics, Rectangle scaledArea) { |
| 116 |
// CHECKSTYLE:OFF |
120 |
// CHECKSTYLE:OFF |
| 117 |
int aaText = SWT.DEFAULT; |
121 |
int aaText = SWT.DEFAULT; |
| 118 |
try { |
122 |
try { |
|
Lines 125-134
public abstract class AbstractCachedSVGFigure extends SVGFigure implements Style
Link Here
|
| 125 |
StringBuilder result = new StringBuilder(); |
129 |
StringBuilder result = new StringBuilder(); |
| 126 |
result.append(aaText); |
130 |
result.append(aaText); |
| 127 |
result.append(SEPARATOR); |
131 |
result.append(SEPARATOR); |
| 128 |
Rectangle r = getClientArea(); |
132 |
result.append(getSpecifyCanvasWidth() ? scaledArea.width : -1); |
| 129 |
result.append(getSpecifyCanvasWidth() ? r.width : -1); |
|
|
| 130 |
result.append(SEPARATOR); |
133 |
result.append(SEPARATOR); |
| 131 |
result.append(getSpecifyCanvasHeight() ? r.height : -1); |
134 |
result.append(getSpecifyCanvasHeight() ? scaledArea.height : -1); |
| 132 |
|
135 |
|
| 133 |
return result.toString(); |
136 |
return result.toString(); |
| 134 |
} |
137 |
} |
| 135 |
- |
|
|