skin: modified skin region setting 70/13970/1
authorGiWoong Kim <giwoong.kim@samsung.com>
Thu, 19 Dec 2013 09:20:51 +0000 (18:20 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Thu, 19 Dec 2013 09:49:04 +0000 (18:49 +0900)
SWT library has a problem for stretch image on Ubuntu.
So, to avoid a this issue, I applied the different
way(with no side effects) to create a General skin image.

Change-Id: I05edbd22f43691002c9fd79403ec5e1515e6d7b1
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/SkinPatches.java

index 1f8f970..ec26582 100644 (file)
@@ -244,7 +244,9 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                                frameMaker.getPatchedImage(displayBounds.width, displayBounds.height);
 
                /* make window region */
-               Region region = getTrimmingRegion(shell.getDisplay(), generalSkin);
+               Region region = (SwtUtil.isLinuxPlatform() == false) ?
+                               getTrimmingRegion(shell.getDisplay(), generalSkin) : /* color key */
+                               SkinUtil.getTrimmingRegion(generalSkin);
 
                /* update the skin state information */
                currentState.setCurrentScale(scale);
index 7d44500..8fa006c 100644 (file)
@@ -34,6 +34,8 @@ import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.GC;
 import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.PaletteData;
 import org.eclipse.swt.graphics.RGB;
 import org.eclipse.swt.widgets.Display;
 import org.tizen.emulator.skin.log.SkinLogger;
@@ -97,29 +99,19 @@ public class SkinPatches {
                int patchedImageWidth = (patchWidth * 2) + centerPatchWidth;
                int patchedImageHeight = (patchHeight * 2) + centerPatchHeight;
 
-               Image patchedImage = new Image(display,
-                               patchedImageWidth, patchedImageHeight);
+               ImageData imageData = new ImageData(
+                               patchedImageWidth, patchedImageHeight, 32,
+                               new PaletteData(0xFF000000, 0x00FF0000, 0x0000FF00));
+               imageData.transparentPixel = 0;
+               Image patchedImage = new Image(display, imageData);
 
                GC gc = new GC(patchedImage);
-               if (SwtUtil.isLinuxPlatform() == true) {
-                       /*
-                       * Bug in Cairo.  When drawing the image stretched with an interpolation
-                       * algorithm, the edges of the image are faded.  This is not a bug, but
-                       * it is not desired.  To avoid the faded edges, it should be possible to
-                       * use cairo_pattern_set_extend() to set the pattern extend to either
-                       * CAIRO_EXTEND_REFLECT or CAIRO_EXTEND_PAD, but these are not implemented
-                       * in some versions of cairo (1.2.x) and have bugs in others (in 1.4.2 it
-                       * draws with black edges).  The fix is to implement CAIRO_EXTEND_REFLECT
-                       * by creating an image that is 3 times bigger than the original, drawing
-                       * the original image in every quadrant (with an appropriate transform) and
-                       * use this image as the pattern.
-                       */
-                       gc.setInterpolation(SWT.NONE);
+               if (SwtUtil.isLinuxPlatform() == false) {
+                       /* SWT works differently. So, we need a color key */
+                       gc.setBackground(display.getSystemColor(SWT.COLOR_MAGENTA));
+                       gc.fillRectangle(0, 0, patchedImageWidth, patchedImageHeight);
                }
 
-               gc.setBackground(display.getSystemColor(SWT.COLOR_MAGENTA));
-               gc.fillRectangle(0, 0, patchedImageWidth, patchedImageHeight);
-
                /* top side */
                // TODO: copy alphaData
                gc.drawImage(imageLT, 0, 0);