uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp
branchRCL_3
changeset 3 d8a3531bc6b8
parent 0 15bf7259bb7c
child 7 433cbbb6a04b
equal deleted inserted replaced
0:15bf7259bb7c 3:d8a3531bc6b8
  1080         // Create the real image from NVG databuf
  1080         // Create the real image from NVG databuf
  1081         iNVGData = dataBuf;
  1081         iNVGData = dataBuf;
  1082         image = CreateRenderedImage(&nvgEngine, dataBuf, Size());
  1082         image = CreateRenderedImage(&nvgEngine, dataBuf, Size());
  1083         
  1083         
  1084         // New functionality for checking the mask
  1084         // New functionality for checking the mask
  1085         if (header.GetBitmapId() != maskHeader.GetBitmapId() &&
  1085         if (header.GetBitmapId() != maskHeader.GetBitmapId() && maskDataBuf &&
  1086             CompareNvgData(dataBuf, maskDataBuf) != 0)
  1086             CompareNvgData(dataBuf, maskDataBuf) != 0)
  1087             {
  1087             {
  1088             VGImage maskImg = VG_INVALID_HANDLE;
  1088             VGImage maskImg = VG_INVALID_HANDLE;
  1089             // The mask is from different bitmap => we have to create
  1089             // The mask is from different bitmap => we have to create
  1090             // a separate mask image for masking the NVG icon
  1090             // a separate mask image for masking the NVG icon
  1434     }
  1434     }
  1435 
  1435 
  1436 TSize CHuiVg10Texture::ApplyMargin(VGImage aImage, TSize aSize, EGLDisplay aDisplay, EGLSurface aSurface, EGLContext aContext)
  1436 TSize CHuiVg10Texture::ApplyMargin(VGImage aImage, TSize aSize, EGLDisplay aDisplay, EGLSurface aSurface, EGLContext aContext)
  1437     {
  1437     {
  1438     HUI_VG_INVARIANT();
  1438     HUI_VG_INVARIANT();
  1439     // If the icon is also a current EGL surface, the getImageSubData
  1439         
  1440     // won't succeed and return "image in use" -error..
       
  1441     if ( eglMakeCurrent( aDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ) == EGL_FALSE )
       
  1442         {
       
  1443         HUI_DEBUG1(_L("CHuiVg10Texture::ApplyMargin() - EGL NO_Surface could not be made current, eglErr: %04x"), eglGetError());
       
  1444         return aSize;
       
  1445         }
       
  1446     
       
  1447 #ifndef __WINS__ // Should possibly query the supported mode instead?
  1440 #ifndef __WINS__ // Should possibly query the supported mode instead?
  1448     VGImageFormat imageInternalFormat = VG_sARGB_8888_PRE;
  1441     VGImageFormat imageInternalFormat = VG_sARGB_8888_PRE;
  1449 #else
  1442 #else
  1450     // This doesn't work in the Emulator anyways.. => remove?
  1443     // This doesn't work in the Emulator anyways.. => remove?
  1451     VGImageFormat imageInternalFormat = VG_sARGB_8888;
  1444     VGImageFormat imageInternalFormat = VG_sARGB_8888;
  1468     TInt C = 0;
  1461     TInt C = 0;
  1469     TInt hNTN = Ha - 2.0 * 0.12 * Ha;
  1462     TInt hNTN = Ha - 2.0 * 0.12 * Ha;
  1470     TReal R = 1.0;
  1463     TReal R = 1.0;
  1471     TInt HaN = Ha;
  1464     TInt HaN = Ha;
  1472     
  1465     
  1473     const TInt lastColumn = aSize.iHeight - 1;
  1466     const TInt lastColumn = aSize.iWidth - 1;
  1474     for (TInt curRow = 0; curRow < lValidMargin; curRow++)
  1467     for (TInt curRow = 0; curRow < lValidMargin; curRow++)
  1475         {
  1468         {
  1476         const TInt y = (aSize.iHeight - 1) - curRow; // h - 1 is the last line
  1469         const TInt y = (aSize.iHeight - 1) - curRow; // h - 1 is the last line
  1477         // Get just one stride at a time (iWidth wide, 1 pixel high)
  1470         // Get just one stride at a time (iWidth wide, 1 pixel high)
  1478         vgGetImageSubData(aImage, ptr, stride, imageInternalFormat, 0, y, aSize.iWidth, 1);
  1471         vgGetImageSubData(aImage, ptr, stride, imageInternalFormat, 0, y, aSize.iWidth, 1);
  1491             }
  1484             }
  1492         }
  1485         }
  1493     delete buf;
  1486     delete buf;
  1494     HUI_VG_INVARIANT();
  1487     HUI_VG_INVARIANT();
  1495     
  1488     
  1496     // Make the PBuffer surface current again 
       
  1497     if ( eglMakeCurrent(aDisplay, aSurface, aSurface, aContext) == EGL_FALSE )
       
  1498         {
       
  1499         HUI_DEBUG1(_L("CHuiVg10Texture::ApplyMargin() - EGL aSurface could not be made current, eglErr: %04x"), eglGetError());
       
  1500         return aSize;
       
  1501         }
       
  1502     
       
  1503     // If icon size has to be changed, clear out old area for new DrawNVG round!
  1489     // If icon size has to be changed, clear out old area for new DrawNVG round!
  1504     if(aSize.iHeight > HaN)
  1490     if(aSize.iHeight > HaN)
  1505         {
  1491         {
  1506         vgLoadIdentity();
  1492         vgLoadIdentity();
  1507         
  1493