From cb71968f793e8d7bdba32ebbf142bf69a89d55c4 Mon Sep 17 00:00:00 2001 From: GiWoong Kim Date: Mon, 16 Sep 2013 12:06:29 +0900 Subject: [PATCH] display: define optional blank-guide schema Change-Id: Ibd7814362b243d85a839bdfc98bff17c9ee56687 Signed-off-by: GiWoong Kim --- tizen/src/maru_sdl.c | 91 +++++++++-------- tizen/src/maru_shm.c | 18 +++- .../emulator/skin/dbi/BlankGuideType.java | 97 +++++++++++++++++++ .../tizen/emulator/skin/dbi/EmulatorUI.java | 28 +++++- .../emulator/skin/dbi/ObjectFactory.java | 18 +++- .../tizen/emulator/skin/dbi/OptionType.java | 95 ++++++++++++++++++ .../skins/emul-general-3btn/default.dbi | 3 + .../skin/comm/sock/SocketCommunicator.java | 64 +++++------- tizen/src/skin/client/xsd/dbi.xsd | 11 +++ 9 files changed, 340 insertions(+), 85 deletions(-) create mode 100644 tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/BlankGuideType.java create mode 100644 tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/OptionType.java diff --git a/tizen/src/maru_sdl.c b/tizen/src/maru_sdl.c index f530ea1248..0012082967 100644 --- a/tizen/src/maru_sdl.c +++ b/tizen/src/maru_sdl.c @@ -62,6 +62,8 @@ static int sdl_alteration; static unsigned int sdl_skip_update; static unsigned int sdl_skip_count; + +static bool blank_guide_enable; static unsigned int blank_cnt; #define MAX_BLANK_FRAME_CNT 10 #define BLANK_GUIDE_IMAGE_PATH "../images/" @@ -485,47 +487,49 @@ static void qemu_ds_sdl_refresh(DisplayChangeListener *dcl) /* do nothing */ return; } else if (blank_cnt == MAX_BLANK_FRAME_CNT) { - /* draw guide image */ - INFO("draw a blank guide image\n"); - - SDL_Surface *guide = get_blank_guide_image(); - if (guide != NULL && get_emul_skin_enable() == 1) { - int dst_x = 0; int dst_y = 0; - int dst_w = 0; int dst_h = 0; - - if (current_scale_factor != 1.0) { - /* guide image scaling */ - SDL_Surface *scaled_guide = SDL_CreateRGBSurface( - SDL_SWSURFACE, - guide->w * current_scale_factor, - guide->h * current_scale_factor, - get_emul_sdl_bpp(), - guide->format->Rmask, guide->format->Gmask, - guide->format->Bmask, guide->format->Amask); - - scaled_guide = maru_do_pixman_scale(guide, scaled_guide); - - dst_w = scaled_guide->w; - dst_h = scaled_guide->h; - dst_x = (surface_screen->w - dst_w) / 2; - dst_y = (surface_screen->h - dst_h) / 2; - SDL_Rect dst_rect = { dst_x, dst_y, dst_w, dst_h }; - - SDL_BlitSurface(scaled_guide, NULL, - surface_screen, &dst_rect); - SDL_UpdateRect(surface_screen, 0, 0, 0, 0); - - SDL_FreeSurface(scaled_guide); - } else { - dst_w = guide->w; - dst_h = guide->h; - dst_x = (surface_screen->w - dst_w) / 2; - dst_y = (surface_screen->h - dst_h) / 2; - SDL_Rect dst_rect = { dst_x, dst_y, dst_w, dst_h }; - - SDL_BlitSurface(guide, NULL, - surface_screen, &dst_rect); - SDL_UpdateRect(surface_screen, 0, 0, 0, 0); + if (blank_guide_enable == true) { + INFO("draw a blank guide image\n"); + + SDL_Surface *guide = get_blank_guide_image(); + if (guide != NULL && get_emul_skin_enable() == 1) { + /* draw guide image */ + int dst_x = 0; int dst_y = 0; + int dst_w = 0; int dst_h = 0; + + if (current_scale_factor != 1.0) { + /* guide image scaling */ + SDL_Surface *scaled_guide = SDL_CreateRGBSurface( + SDL_SWSURFACE, + guide->w * current_scale_factor, + guide->h * current_scale_factor, + get_emul_sdl_bpp(), + guide->format->Rmask, guide->format->Gmask, + guide->format->Bmask, guide->format->Amask); + + scaled_guide = maru_do_pixman_scale(guide, scaled_guide); + + dst_w = scaled_guide->w; + dst_h = scaled_guide->h; + dst_x = (surface_screen->w - dst_w) / 2; + dst_y = (surface_screen->h - dst_h) / 2; + SDL_Rect dst_rect = { dst_x, dst_y, dst_w, dst_h }; + + SDL_BlitSurface(scaled_guide, NULL, + surface_screen, &dst_rect); + SDL_UpdateRect(surface_screen, 0, 0, 0, 0); + + SDL_FreeSurface(scaled_guide); + } else { + dst_w = guide->w; + dst_h = guide->h; + dst_x = (surface_screen->w - dst_w) / 2; + dst_y = (surface_screen->h - dst_h) / 2; + SDL_Rect dst_rect = { dst_x, dst_y, dst_w, dst_h }; + + SDL_BlitSurface(guide, NULL, + surface_screen, &dst_rect); + SDL_UpdateRect(surface_screen, 0, 0, 0, 0); + } } } } else if (blank_cnt == 0) { @@ -790,6 +794,7 @@ void maruskin_sdl_init(uint64 swt_handle, { gchar SDL_windowhack[32] = { 0, }; long window_id = swt_handle; + blank_guide_enable = blank_guide; INFO("maru sdl init\n"); @@ -806,6 +811,10 @@ void maruskin_sdl_init(uint64 swt_handle, set_emul_sdl_bpp(SDL_BPP); init_multi_touch_state(); + if (blank_guide_enable == true) { + INFO("blank guide is on\n"); + } + qemu_bh_schedule(sdl_init_bh); } diff --git a/tizen/src/maru_shm.c b/tizen/src/maru_shm.c index 271bf3e431..d7cacb69c5 100644 --- a/tizen/src/maru_shm.c +++ b/tizen/src/maru_shm.c @@ -48,6 +48,8 @@ static int skin_shmid; static int shm_skip_update; static int shm_skip_count; + +static bool blank_guide_enable; static int blank_cnt; #define MAX_BLANK_FRAME_CNT 10 @@ -143,11 +145,13 @@ static void qemu_ds_shm_refresh(DisplayChangeListener *dcl) /* do nothing */ return; } else if (blank_cnt == MAX_BLANK_FRAME_CNT) { - /* draw guide image */ - INFO("draw a blank guide image\n"); + if (blank_guide_enable == true) { + INFO("draw a blank guide image\n"); - if (get_emul_skin_enable() == 1) { - notify_draw_blank_guide(); + if (get_emul_skin_enable() == 1) { + /* draw guide image */ + notify_draw_blank_guide(); + } } } else if (blank_cnt == 0) { INFO("skipping of the display updating is started\n"); @@ -191,11 +195,17 @@ void maruskin_shm_init(uint64 swt_handle, unsigned int display_width, unsigned int display_height, bool blank_guide) { + blank_guide_enable = blank_guide; + INFO("maru shm init\n"); set_emul_lcd_size(display_width, display_height); set_emul_sdl_bpp(32); + if (blank_guide_enable == true) { + INFO("blank guide is on\n"); + } + /* byte */ int shm_size = get_emul_lcd_width() * get_emul_lcd_height() * 4; diff --git a/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/BlankGuideType.java b/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/BlankGuideType.java new file mode 100644 index 0000000000..57315c94c9 --- /dev/null +++ b/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/BlankGuideType.java @@ -0,0 +1,97 @@ +/** + * XML Binding + * + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * GiWoong Kim + * YeongKyoon Lee + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2013.09.16 at 11:45:09 AM KST +// + + +package org.tizen.emulator.skin.dbi; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for blankGuideType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="blankGuideType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <attribute name="visible" type="{http://www.w3.org/2001/XMLSchema}boolean" default="true" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "blankGuideType") +public class BlankGuideType { + + @XmlAttribute(name = "visible") + protected Boolean visible; + + /** + * Gets the value of the visible property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public boolean isVisible() { + if (visible == null) { + return true; + } else { + return visible; + } + } + + /** + * Sets the value of the visible property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setVisible(Boolean value) { + this.visible = value; + } + +} diff --git a/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/EmulatorUI.java b/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/EmulatorUI.java index 346792414d..d4685b55a5 100644 --- a/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/EmulatorUI.java +++ b/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/EmulatorUI.java @@ -30,7 +30,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2013.07.11 at 12:12:25 PM KST +// Generated on: 2013.09.16 at 11:45:09 AM KST // @@ -57,6 +57,7 @@ import javax.xml.bind.annotation.XmlType; * <element name="rotations" type="{http://www.tizen.org/emulator/skin/dbi}rotationsType"/> * <element name="hover" type="{http://www.tizen.org/emulator/skin/dbi}hoverType" minOccurs="0"/> * <element name="popupMenu" type="{http://www.tizen.org/emulator/skin/dbi}popupMenuType" minOccurs="0"/> + * <element name="option" type="{http://www.tizen.org/emulator/skin/dbi}optionType" minOccurs="0"/> * </all> * </restriction> * </complexContent> @@ -78,6 +79,7 @@ public class EmulatorUI { protected RotationsType rotations; protected HoverType hover; protected PopupMenuType popupMenu; + protected OptionType option; /** * Gets the value of the dbiVersion property. @@ -167,4 +169,28 @@ public class EmulatorUI { this.popupMenu = value; } + /** + * Gets the value of the option property. + * + * @return + * possible object is + * {@link OptionType } + * + */ + public OptionType getOption() { + return option; + } + + /** + * Sets the value of the option property. + * + * @param value + * allowed object is + * {@link OptionType } + * + */ + public void setOption(OptionType value) { + this.option = value; + } + } diff --git a/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/ObjectFactory.java b/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/ObjectFactory.java index 1ad06909d9..4ca04e9000 100644 --- a/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/ObjectFactory.java +++ b/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/ObjectFactory.java @@ -30,7 +30,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2013.07.11 at 12:12:25 PM KST +// Generated on: 2013.09.16 at 11:45:09 AM KST // @@ -96,6 +96,14 @@ public class ObjectFactory { return new PopupMenuType(); } + /** + * Create an instance of {@link OptionType } + * + */ + public OptionType createOptionType() { + return new OptionType(); + } + /** * Create an instance of {@link EventInfoType } * @@ -152,6 +160,14 @@ public class ObjectFactory { return new DisplayType(); } + /** + * Create an instance of {@link BlankGuideType } + * + */ + public BlankGuideType createBlankGuideType() { + return new BlankGuideType(); + } + /** * Create an instance of {@link MenuItemType } * diff --git a/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/OptionType.java b/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/OptionType.java new file mode 100644 index 0000000000..570d2d2af4 --- /dev/null +++ b/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/OptionType.java @@ -0,0 +1,95 @@ +/** + * XML Binding + * + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * GiWoong Kim + * YeongKyoon Lee + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2013.09.16 at 11:45:09 AM KST +// + + +package org.tizen.emulator.skin.dbi; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for optionType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="optionType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <all>
+ *         <element name="blankGuide" type="{http://www.tizen.org/emulator/skin/dbi}blankGuideType" minOccurs="0"/>
+ *       </all>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "optionType", propOrder = { + +}) +public class OptionType { + + protected BlankGuideType blankGuide; + + /** + * Gets the value of the blankGuide property. + * + * @return + * possible object is + * {@link BlankGuideType } + * + */ + public BlankGuideType getBlankGuide() { + return blankGuide; + } + + /** + * Sets the value of the blankGuide property. + * + * @param value + * allowed object is + * {@link BlankGuideType } + * + */ + public void setBlankGuide(BlankGuideType value) { + this.blankGuide = value; + } + +} diff --git a/tizen/src/skin/client/skins/emul-general-3btn/default.dbi b/tizen/src/skin/client/skins/emul-general-3btn/default.dbi index 259092e6c2..e5ad74fe1b 100644 --- a/tizen/src/skin/client/skins/emul-general-3btn/default.dbi +++ b/tizen/src/skin/client/skins/emul-general-3btn/default.dbi @@ -72,4 +72,7 @@ + diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/SocketCommunicator.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/SocketCommunicator.java index 146e4d7157..2912fa0be5 100755 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/SocketCommunicator.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/SocketCommunicator.java @@ -1,5 +1,5 @@ /** - * + * communticate with Qemu * * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * @@ -53,6 +53,7 @@ import org.tizen.emulator.skin.comm.sock.data.ISendData; import org.tizen.emulator.skin.comm.sock.data.StartData; import org.tizen.emulator.skin.config.EmulatorConfig; import org.tizen.emulator.skin.config.EmulatorConfig.ArgsConstants; +import org.tizen.emulator.skin.dbi.OptionType; import org.tizen.emulator.skin.image.ImageRegistry.ResourceImageName; import org.tizen.emulator.skin.log.SkinLogger; import org.tizen.emulator.skin.util.IOUtil; @@ -240,7 +241,11 @@ public class SocketCommunicator implements ICommunicator { short rotation = EmulatorConfig.DEFAULT_WINDOW_ROTATION; boolean isBlankGuide = true; - // TODO: + OptionType option = config.getDbiContents().getOption(); + if (option != null) { + isBlankGuide = (option.getBlankGuide() == null) ? + true : option.getBlankGuide().isVisible(); + } StartData startData = new StartData(initialData, width, height, scale, rotation, isBlankGuide); @@ -478,40 +483,37 @@ public class SocketCommunicator implements ICommunicator { } - private byte[] readData( DataInputStream is, int length ) throws IOException { - - if ( 0 >= length ) { + private byte[] readData( + DataInputStream is, int length) throws IOException { + if (0 >= length) { return null; } - BufferedInputStream bfis = new BufferedInputStream( is, length ); + BufferedInputStream bfis = new BufferedInputStream(is, length); byte[] data = new byte[length]; int read = 0; int total = 0; - while ( true ) { - - if ( total == length ) { + while (true) { + if (total == length) { break; } - read = bfis.read( data, total, length - total ); + read = bfis.read(data, total, length - total); - if ( 0 > read ) { - if ( total < length ) { + if (0 > read) { + if (total < length) { continue; } } else { total += read; } - } - logger.info( "finished reading stream. read:" + total ); + logger.info("finished reading stream. read:" + total); return data; - } private DataTranfer resetDataTransfer(final DataTranfer dataTransfer) { @@ -539,9 +541,7 @@ public class SocketCommunicator implements ICommunicator { timer.schedule(timerTask, dataTransfer.maxWaitTime + 1000); return dataTransfer; - } - } public synchronized DataTranfer sendDataToQEMU( @@ -633,46 +633,41 @@ public class SocketCommunicator implements ICommunicator { } - public byte[] getReceivedData( DataTranfer dataTranfer ) { - + public byte[] getReceivedData(DataTranfer dataTranfer) { if (null == dataTranfer) { return null; } synchronized (dataTranfer) { - int count = 0; byte[] receivedData = null; long sleep = dataTranfer.sleep; long maxWaitTime = dataTranfer.maxWaitTime; - int limitCount = (int) ( maxWaitTime / sleep ); + int limitCount = (int) (maxWaitTime / sleep); - while ( dataTranfer.isTransferState ) { + while (dataTranfer.isTransferState) { + if (limitCount < count) { + logger.severe("time out for receiving data from skin server."); - if ( limitCount < count ) { - logger.severe( "time out for receiving data from skin server." ); dataTranfer.receivedData = null; break; } try { - dataTranfer.wait( sleep ); - } catch ( InterruptedException e ) { - logger.log( Level.SEVERE, e.getMessage(), e ); + dataTranfer.wait(sleep); + } catch (InterruptedException e) { + logger.log(Level.SEVERE, e.getMessage(), e); } count++; - logger.info( "wait data... count:" + count ); - + logger.info("wait data... count : " + count); } receivedData = dataTranfer.receivedData; dataTranfer.receivedData = null; return receivedData; - } - } public Socket getSocket() { @@ -750,13 +745,6 @@ public class SocketCommunicator implements ICommunicator { skin.shutdown(); } } - - public void resetSkin( EmulatorSkin skin ) { - synchronized ( this ) { - this.skin = skin; - } - } - } class SkinSendData { diff --git a/tizen/src/skin/client/xsd/dbi.xsd b/tizen/src/skin/client/xsd/dbi.xsd index 62ebd8e35a..dec922b415 100644 --- a/tizen/src/skin/client/xsd/dbi.xsd +++ b/tizen/src/skin/client/xsd/dbi.xsd @@ -9,6 +9,7 @@ xmlns:dbi="http://www.tizen.org/emulator/skin/dbi" elementFormDefault="qualified + @@ -105,4 +106,14 @@ xmlns:dbi="http://www.tizen.org/emulator/skin/dbi" elementFormDefault="qualified + + + + + + + + + + \ No newline at end of file -- 2.34.1