private void arrangeSkin( int lcdWidth, int lcdHeight, int scale, short rotationId ) {
+ Image tempImage = null;
+ Image tempKeyPressedImage = null;
this.currentLcdWidth = lcdWidth;
this.currentLcdHeight = lcdHeight;
this.currentScale = scale;
this.currentAngle = SkinRotation.getAngle( rotationId );
if ( null != currentImage ) {
- currentImage.dispose();
+ tempImage = currentImage;
}
if ( null != currentKeyPressedImage ) {
- currentKeyPressedImage.dispose();
+ tempKeyPressedImage = currentKeyPressedImage;
}
shell.redraw();
currentKeyPressedImage = SkinUtil.createScaledImage( imageRegistry, shell, rotationId, scale,
ImageType.IMG_TYPE_PRESSED );
+ if (tempImage != null) {
+ tempImage.dispose();
+ }
+ if (tempKeyPressedImage != null) {
+ tempKeyPressedImage.dispose();
+ }
+
SkinUtil.trimShell( shell, currentImage );
SkinUtil.adjustLcdGeometry( lcdCanvas, scale, rotationId );
public void run() {
if (currentHoverRegion.width != 0 && currentHoverRegion.height != 0) {
GC gc = new GC(shell);
- gc.setLineWidth(1);
- gc.setForeground(hoverColor);
- gc.drawRectangle(currentHoverRegion.x, currentHoverRegion.y, currentHoverRegion.width, currentHoverRegion.height);
+ if (gc != null) {
+ gc.setLineWidth(1);
+ gc.setForeground(hoverColor);
+ gc.drawRectangle(currentHoverRegion.x, currentHoverRegion.y, currentHoverRegion.width, currentHoverRegion.height);
- gc.dispose();
+ gc.dispose();
+ }
}
}
});
public void run() {
if ( null != currentKeyPressedImage ) {
GC gc = new GC( shell );
+ if (gc != null) {
- /* button */
- gc.drawImage(currentKeyPressedImage,
+ /* button */
+ gc.drawImage(currentKeyPressedImage,
currentPressedRegion.x + 1, currentPressedRegion.y + 1,
currentPressedRegion.width - 1, currentPressedRegion.height - 1, //src
currentPressedRegion.x + 1, currentPressedRegion.y + 1,
currentPressedRegion.width - 1, currentPressedRegion.height - 1); //dst
- /* hover */
- if (currentHoverRegion.width != 0 && currentHoverRegion.height != 0) {
- gc.setLineWidth(1);
- gc.setForeground(hoverColor);
- gc.drawRectangle(currentHoverRegion.x, currentHoverRegion.y, currentHoverRegion.width, currentHoverRegion.height);
- }
+ /* hover */
+ if (currentHoverRegion.width != 0 && currentHoverRegion.height != 0) {
+ gc.setLineWidth(1);
+ gc.setForeground(hoverColor);
+ gc.drawRectangle(currentHoverRegion.x, currentHoverRegion.y, currentHoverRegion.width, currentHoverRegion.height);
+ }
- gc.dispose();
+ gc.dispose();
- SkinUtil.trimShell(shell, currentKeyPressedImage,
+ SkinUtil.trimShell(shell, currentKeyPressedImage,
currentPressedRegion.x, currentPressedRegion.y, currentPressedRegion.width, currentPressedRegion.height);
- currentPressedRegion = null;
+ currentPressedRegion = null;
+ }
}
}
});