javauis/lcdui_akn/javalcdui/javasrc/javax/microedition/lcdui/Graphics.java
branchRCL_3
changeset 21 4376525cdefb
parent 18 9ac0a0a7da70
child 24 6c158198356e
equal deleted inserted replaced
19:71c436fe3ce0 21:4376525cdefb
   155     private int     iStrokeStyle; // one of (SOLID,DOTTED)
   155     private int     iStrokeStyle; // one of (SOLID,DOTTED)
   156     private Font    iFont;
   156     private Font    iFont;
   157     private Font    iScalableFont;
   157     private Font    iScalableFont;
   158     private boolean iFontSet;
   158     private boolean iFontSet;
   159     private boolean iScalableFontSet;
   159     private boolean iScalableFontSet;
   160     private boolean iM3Gdraw;
   160     private boolean iPrevScalingFlag = false;
   161 
   161 
   162     private int iOnScreenWidth;  // width of screen
   162     private int iOnScreenWidth;  // width of screen
   163     private int iOnScreenHeight; // height of screen
   163     private int iOnScreenHeight; // height of screen
   164 
   164 
   165     //flag if is original size set in JAD file
   165     //flag if is original size set in JAD file
   194     {
   194     {
   195         // saving of given parameters
   195         // saving of given parameters
   196         iToolkit = aToolkit;
   196         iToolkit = aToolkit;
   197         iBuffer = aToolkit.iBuffer;
   197         iBuffer = aToolkit.iBuffer;
   198         iTarget = aTarget;
   198         iTarget = aTarget;
   199         iM3Gdraw = false;
       
   200         iIsSetTargetSize = false;
   199         iIsSetTargetSize = false;
   201         // If a Graphics is drawing to image then a image is saved. Null otherwise
   200         // If a Graphics is drawing to image then a image is saved. Null otherwise
   202         iImage = (aTarget instanceof Image) ? (Image)aTarget : null;
   201         iImage = (aTarget instanceof Image) ? (Image)aTarget : null;
   203 
   202 
   204         // creating of native side graphics
   203         // creating of native side graphics
  1402                 synchronized (aImage)
  1401                 synchronized (aImage)
  1403                 {
  1402                 {
  1404                     // Check that aImage haven't been disposed yet
  1403                     // Check that aImage haven't been disposed yet
  1405                     if (aImage.iHandle != 0)
  1404                     if (aImage.iHandle != 0)
  1406                     {
  1405                     {
  1407                         // If downscaling off, 
  1406                         // If downscaling off,
  1408                         // then it only send data to native side
  1407                         // then it only send data to native side
  1409                         iBuffer.write(iHandle,
  1408                         iBuffer.write(iHandle,
  1410                                       OP_DRAW_REGION,
  1409                                       OP_DRAW_REGION,
  1411                                       aImage.iHandle,
  1410                                       aImage.iHandle,
  1412                                       aXsrc,
  1411                                       aXsrc,
  1473             // sending data to native side
  1472             // sending data to native side
  1474             iBuffer.write(iHandle, 20, aDisplayable.getContentHandle(), aX, aY, aWidth, aHeight);
  1473             iBuffer.write(iHandle, 20, aDisplayable.getContentHandle(), aX, aY, aWidth, aHeight);
  1475         }
  1474         }
  1476     }
  1475     }
  1477 
  1476 
  1478     /**
  1477 
  1479      *this function blocking downscaled when M3G drawing some content    
       
  1480      **/    
       
  1481     void M3Gdraw(int aM3Gdraw)
       
  1482     {
       
  1483        if (aM3Gdraw == 0) 
       
  1484           {
       
  1485              iM3Gdraw = false;
       
  1486           }
       
  1487        else
       
  1488        { 
       
  1489           iM3Gdraw = true; 
       
  1490        }
       
  1491     }
       
  1492     /**
  1478     /**
  1493      * This function return flag if Graphics is downscaled.
  1479      * This function return flag if Graphics is downscaled.
  1494      * Graphics is downscaled on if we have set original size, this size is bigger then screen
  1480      * Graphics is downscaled on if we have set original size, this size is bigger then screen
  1495      * (at least on one measure) and iTarget is Canvas in full screen Canvas or a target size is
  1481      * (at least on one measure) and iTarget is Canvas in full screen Canvas or a target size is
  1496      * smaller than original size.
  1482      * smaller than original size.
  1497      * @return true if Graphics is downscaled, false otherwise
  1483      * @return true if Graphics is downscaled, false otherwise
  1498      */ 
  1484      */
  1499     boolean isDownscaled()
  1485     boolean isDownscaled()
  1500     {
  1486     {
  1501        // If M3G is drawnig then downscaling is turn off.
  1487         boolean ret = false;
  1502        if (iM3Gdraw)
  1488         // If M3G is drawnig then downscaling is turn off.
  1503           { 
       
  1504              return false;
       
  1505           }
       
  1506         if ((iTarget instanceof Canvas) && ((Canvas)iTarget).getFullScreenMode()
  1489         if ((iTarget instanceof Canvas) && ((Canvas)iTarget).getFullScreenMode()
  1507                 && iIsSetOriginalSize)
  1490                 && iIsSetOriginalSize && !((Canvas)iTarget).m3gDraw())
  1508         {
  1491         {
  1509             return iOnScreenHeight < iHeight || iOnScreenWidth < iWidth ;
  1492             ret = iOnScreenHeight < iHeight || iOnScreenWidth < iWidth;
  1510         }
  1493         }
  1511         return false;
  1494         // If downscaling is turn off then disable scalable font
       
  1495         if (iPrevScalingFlag != ret && iPrevScalingFlag == true)
       
  1496         {
       
  1497             iFontSet = false;
       
  1498             iScalableFontSet = false;
       
  1499         }
       
  1500         iPrevScalingFlag = ret;
       
  1501         return ret;
  1512     }
  1502     }
  1513 
  1503 
  1514     /**
  1504     /**
  1515      * This function returns downscaled GRB data from input RGB data. It scales
  1505      * This function returns downscaled GRB data from input RGB data. It scales
  1516      * according iOnScreenWidth, iOnScreenHeight, iWidth and iHeight.
  1506      * according iOnScreenWidth, iOnScreenHeight, iWidth and iHeight.