javauis/lcdui_akn/javalcdui/javasrc/javax/microedition/lcdui/Canvas.java
branchRCL_3
changeset 77 7cee158cb8cd
parent 66 2455ef1f5bbc
child 83 26b2b12093af
equal deleted inserted replaced
71:d5e927d5853b 77:7cee158cb8cd
    59     private static final int ATTRIB_CONTENT_HANDLE_INDEX      = 0;
    59     private static final int ATTRIB_CONTENT_HANDLE_INDEX      = 0;
    60     private static final int ATTRIB_WIDTH_INDEX               = 1;
    60     private static final int ATTRIB_WIDTH_INDEX               = 1;
    61     private static final int ATTRIB_HEIGHT_INDEX              = 2;
    61     private static final int ATTRIB_HEIGHT_INDEX              = 2;
    62     private static final int ATTRIB_NATIVE_FRAME_BUFFER_INDEX = 3;
    62     private static final int ATTRIB_NATIVE_FRAME_BUFFER_INDEX = 3;
    63     private static final int ATTRIB_BACKGROUND_INDEX          = 4;
    63     private static final int ATTRIB_BACKGROUND_INDEX          = 4;
    64     private static final int ATTRIB_COUNT                     = 5;
    64     private static final int ATTRIB_VIDEO_OVERLAY_INDEX       = 5;
       
    65     private static final int ATTRIB_COUNT                     = 6;
    65 
    66 
    66     /**
    67     /**
    67     * Static constants for media key keycodes
    68     * Static constants for media key keycodes
    68     */
    69     */
    69     private static final int MEDIA_KEY_PLAY                   = -20;
    70     private static final int MEDIA_KEY_PLAY                   = -20;
    92     /**
    93     /**
    93      * This member variable is set <code>true</code> if the <code>Nokia-UI-Enhancement</code>
    94      * This member variable is set <code>true</code> if the <code>Nokia-UI-Enhancement</code>
    94      * attribute is "CanvasHasBackground". The attribute may be placed in the JAD or the manifest.
    95      * attribute is "CanvasHasBackground". The attribute may be placed in the JAD or the manifest.
    95      */
    96      */
    96     private boolean iHasBackgroundImage;
    97     private boolean iHasBackgroundImage;
       
    98     private boolean iVideoOverlayEnabled;
    97     private boolean iIsGameCanvas;
    99     private boolean iIsGameCanvas;
    98     private Object iPaintLock;
   100     private Object iPaintLock;
    99 
   101 
   100     protected Canvas()
   102     protected Canvas()
   101     {
   103     {
   130                 CreateFrameBuffer();
   132                 CreateFrameBuffer();
   131             }
   133             }
   132             // Save the info about background.
   134             // Save the info about background.
   133             iHasBackgroundImage =
   135             iHasBackgroundImage =
   134                 (canvasAttribs[ATTRIB_BACKGROUND_INDEX] != 0);
   136                 (canvasAttribs[ATTRIB_BACKGROUND_INDEX] != 0);
       
   137 
       
   138             iVideoOverlayEnabled = 
       
   139                 (canvasAttribs[ATTRIB_VIDEO_OVERLAY_INDEX] != 0);
   135 
   140 
   136             // If is Toolkit activated, we can add Displayable to Vector
   141             // If is Toolkit activated, we can add Displayable to Vector
   137             // Displayables are removed from Vector when SizeChangedEvent arrives see Displayable.sizeChangedEvent()
   142             // Displayables are removed from Vector when SizeChangedEvent arrives see Displayable.sizeChangedEvent()
   138             if (iToolkit.activated)
   143             if (iToolkit.activated)
   139             {
   144             {
   444                 // is true.
   449                 // is true.
   445                 if (!iFullScreen && iHasBackgroundImage && !iIsGameCanvas)
   450                 if (!iFullScreen && iHasBackgroundImage && !iIsGameCanvas)
   446                 {
   451                 {
   447                     drawBackground(true);
   452                     drawBackground(true);
   448                 }
   453                 }
       
   454 
       
   455                 if (iVideoOverlayEnabled)
       
   456                 {
       
   457                     // Send op code to native canvas about the start of paint,
       
   458                     // to enable overlays. This is done after 
       
   459                     // drawBackground() so that framebuffer can be cleared
       
   460                     // correctly on native side.
       
   461                     iToolkit.canvasPaintStarted(getContentHandle());
       
   462                 }
       
   463 
   449                 paint(graphics);
   464                 paint(graphics);
   450             }
   465             }
   451 
   466 
   452             flush(x, y, w, h);
   467             flush(x, y, w, h);
   453         }
   468         }