27 #include "uiacceltk/HuiEnv.h" |
27 #include "uiacceltk/HuiEnv.h" |
28 #include "uiacceltk/HuiTextureManager.h" |
28 #include "uiacceltk/HuiTextureManager.h" |
29 #include "uiacceltk/HuiTextureProcessor.h" |
29 #include "uiacceltk/HuiTextureProcessor.h" |
30 #include "uiacceltk/HuiUtil.h" |
30 #include "uiacceltk/HuiUtil.h" |
31 #include "uiacceltk/HuiPanic.h" |
31 #include "uiacceltk/HuiPanic.h" |
|
32 |
|
33 #include "huiextension.h" |
32 |
34 |
33 // temporary hack until the openvg headers are fixed.. |
35 // temporary hack until the openvg headers are fixed.. |
34 #ifndef OPENVG_VERSION_1_0_1 |
36 #ifndef OPENVG_VERSION_1_0_1 |
35 #warning using temporary hack to define OPENVG_VERSION_1_0_1, see TSW: SKYA-7QQB8 |
37 #warning using temporary hack to define OPENVG_VERSION_1_0_1, see TSW: SKYA-7QQB8 |
36 #define OPENVG_VERSION_1_0_1 |
38 #define OPENVG_VERSION_1_0_1 |
876 } |
878 } |
877 } |
879 } |
878 |
880 |
879 void CHuiVg10Texture::TextureExtension(const TUid& aExtensionUid, TAny** aExtensionParameters) |
881 void CHuiVg10Texture::TextureExtension(const TUid& aExtensionUid, TAny** aExtensionParameters) |
880 { |
882 { |
881 CHuiTexture::TextureExtension(aExtensionUid, aExtensionParameters); |
883 if ( aExtensionUid == KHuiTexturePartialBitmapUploadUid && |
|
884 aExtensionParameters && *aExtensionParameters ) |
|
885 { |
|
886 THuiTexturePartialBitmapUploadParams* params = |
|
887 static_cast<THuiTexturePartialBitmapUploadParams*>(*aExtensionParameters); |
|
888 PartialBitmapUpload(params); |
|
889 } |
|
890 else |
|
891 { |
|
892 CHuiTexture::TextureExtension(aExtensionUid, aExtensionParameters); |
|
893 } |
882 } |
894 } |
883 |
895 |
884 void CHuiVg10Texture::EnableShadow(TBool aEnable) |
896 void CHuiVg10Texture::EnableShadow(TBool aEnable) |
885 { |
897 { |
886 CHuiTexture::EnableShadow(aEnable); |
898 CHuiTexture::EnableShadow(aEnable); |
999 default: |
1011 default: |
1000 break; |
1012 break; |
1001 } |
1013 } |
1002 |
1014 |
1003 HUI_VG_INVARIANT(); |
1015 HUI_VG_INVARIANT(); |
|
1016 } |
|
1017 |
|
1018 void CHuiVg10Texture::PartialBitmapUpload(THuiTexturePartialBitmapUploadParams* aParams) |
|
1019 { |
|
1020 if ( !aParams->iBitmap || !aParams->iBitmap->Handle() || |
|
1021 aParams->iBitmap->DisplayMode() != EColor16MAP ) |
|
1022 { |
|
1023 // Only specific format supported. |
|
1024 aParams->iErrorCode = KErrArgument; |
|
1025 return; |
|
1026 } |
|
1027 |
|
1028 if ( SegmentCount() != 1 || ((VGImage)SegmentName(0)) == VG_INVALID_HANDLE || |
|
1029 Size() != aParams->iBitmap->SizeInPixels() ) |
|
1030 { |
|
1031 // You must perform initial upload using normal methods. |
|
1032 aParams->iErrorCode = KErrNotReady; |
|
1033 return; |
|
1034 } |
|
1035 |
|
1036 //TRect segmentRect(SegmentSize(0)); |
|
1037 TRect segmentRect(Size()); |
|
1038 TRect rect(aParams->iRect); |
|
1039 rect.Intersection(segmentRect); |
|
1040 |
|
1041 if ( rect != aParams->iRect ) |
|
1042 { |
|
1043 // Rect must be fully within segment rect |
|
1044 aParams->iErrorCode = KErrArgument; |
|
1045 return; |
|
1046 } |
|
1047 |
|
1048 aParams->iErrorCode = KErrNone; |
|
1049 |
|
1050 if ( rect.IsEmpty() ) |
|
1051 { |
|
1052 // Nothing to upload. |
|
1053 return; |
|
1054 } |
|
1055 |
|
1056 PushEGLContext(); |
|
1057 aParams->iBitmap->BeginDataAccess(); |
|
1058 |
|
1059 const TInt scanLineLength = CFbsBitmap::ScanLineLength( |
|
1060 aParams->iBitmap->SizeInPixels().iWidth, EColor16MAP); |
|
1061 const TInt bytesPerPixel = 4; |
|
1062 |
|
1063 TUint8* dataAddress = (TUint8*)aParams->iBitmap->DataAddress(); |
|
1064 dataAddress += rect.iTl.iX * bytesPerPixel; |
|
1065 dataAddress += rect.iTl.iY * scanLineLength; |
|
1066 |
|
1067 vgImageSubData( |
|
1068 (VGImage)SegmentName(0), // image |
|
1069 dataAddress, // data |
|
1070 scanLineLength, // dataStride |
|
1071 VG_sARGB_8888_PRE, // dataFormat |
|
1072 rect.iTl.iX, // x |
|
1073 rect.iTl.iY, // y |
|
1074 rect.Width(), // width |
|
1075 rect.Height() // height |
|
1076 ); |
|
1077 |
|
1078 aParams->iBitmap->EndDataAccess( ETrue ); |
|
1079 PopEGLContext(); |
1004 } |
1080 } |
1005 |
1081 |
1006 #ifdef __NVG |
1082 #ifdef __NVG |
1007 HBufC8* CHuiVg10Texture::ReadNVGDataL(const CFbsBitmap& aBitmap) |
1083 HBufC8* CHuiVg10Texture::ReadNVGDataL(const CFbsBitmap& aBitmap) |
1008 { |
1084 { |
1434 } |
1510 } |
1435 |
1511 |
1436 TSize CHuiVg10Texture::ApplyMargin(VGImage aImage, TSize aSize, EGLDisplay aDisplay, EGLSurface aSurface, EGLContext aContext) |
1512 TSize CHuiVg10Texture::ApplyMargin(VGImage aImage, TSize aSize, EGLDisplay aDisplay, EGLSurface aSurface, EGLContext aContext) |
1437 { |
1513 { |
1438 HUI_VG_INVARIANT(); |
1514 HUI_VG_INVARIANT(); |
1439 |
1515 #ifdef __WINSCW__ |
|
1516 if ( eglMakeCurrent( aDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ) == EGL_FALSE ) |
|
1517 { |
|
1518 HUI_DEBUG1(_L("CHuiVg10Texture::ApplyMargin() - EGL NO_Surface could not be made current, eglErr: %04x"), eglGetError()); |
|
1519 return aSize; |
|
1520 } |
|
1521 #endif |
1440 #ifndef __WINS__ // Should possibly query the supported mode instead? |
1522 #ifndef __WINS__ // Should possibly query the supported mode instead? |
1441 VGImageFormat imageInternalFormat = VG_sARGB_8888_PRE; |
1523 VGImageFormat imageInternalFormat = VG_sARGB_8888_PRE; |
1442 #else |
1524 #else |
1443 // This doesn't work in the Emulator anyways.. => remove? |
1525 // This doesn't work in the Emulator anyways.. => remove? |
1444 VGImageFormat imageInternalFormat = VG_sARGB_8888; |
1526 VGImageFormat imageInternalFormat = VG_sARGB_8888; |
1483 } |
1565 } |
1484 } |
1566 } |
1485 } |
1567 } |
1486 delete buf; |
1568 delete buf; |
1487 HUI_VG_INVARIANT(); |
1569 HUI_VG_INVARIANT(); |
1488 |
1570 #ifdef __WINSCW__ |
|
1571 // Make the PBuffer surface current again |
|
1572 if ( eglMakeCurrent(aDisplay, aSurface, aSurface, aContext) == EGL_FALSE ) |
|
1573 { |
|
1574 HUI_DEBUG1(_L("CHuiVg10Texture::ApplyMargin() - EGL aSurface could not be made current, eglErr: %04x"), eglGetError()); |
|
1575 return aSize; |
|
1576 } |
|
1577 #endif |
1489 // If icon size has to be changed, clear out old area for new DrawNVG round! |
1578 // If icon size has to be changed, clear out old area for new DrawNVG round! |
1490 if(aSize.iHeight > HaN) |
1579 if(aSize.iHeight > HaN) |
1491 { |
1580 { |
1492 vgLoadIdentity(); |
1581 vgLoadIdentity(); |
1493 |
1582 |