--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp Mon Feb 22 17:57:49 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp Fri Mar 12 15:47:04 2010 +0200
@@ -30,6 +30,8 @@
#include "uiacceltk/HuiUtil.h"
#include "uiacceltk/HuiPanic.h"
+#include "huiextension.h"
+
// temporary hack until the openvg headers are fixed..
#ifndef OPENVG_VERSION_1_0_1
#warning using temporary hack to define OPENVG_VERSION_1_0_1, see TSW: SKYA-7QQB8
@@ -878,7 +880,17 @@
void CHuiVg10Texture::TextureExtension(const TUid& aExtensionUid, TAny** aExtensionParameters)
{
- CHuiTexture::TextureExtension(aExtensionUid, aExtensionParameters);
+ if ( aExtensionUid == KHuiTexturePartialBitmapUploadUid &&
+ aExtensionParameters && *aExtensionParameters )
+ {
+ THuiTexturePartialBitmapUploadParams* params =
+ static_cast<THuiTexturePartialBitmapUploadParams*>(*aExtensionParameters);
+ PartialBitmapUpload(params);
+ }
+ else
+ {
+ CHuiTexture::TextureExtension(aExtensionUid, aExtensionParameters);
+ }
}
void CHuiVg10Texture::EnableShadow(TBool aEnable)
@@ -1003,6 +1015,70 @@
HUI_VG_INVARIANT();
}
+void CHuiVg10Texture::PartialBitmapUpload(THuiTexturePartialBitmapUploadParams* aParams)
+ {
+ if ( !aParams->iBitmap || !aParams->iBitmap->Handle() ||
+ aParams->iBitmap->DisplayMode() != EColor16MAP )
+ {
+ // Only specific format supported.
+ aParams->iErrorCode = KErrArgument;
+ return;
+ }
+
+ if ( SegmentCount() != 1 || ((VGImage)SegmentName(0)) == VG_INVALID_HANDLE ||
+ Size() != aParams->iBitmap->SizeInPixels() )
+ {
+ // You must perform initial upload using normal methods.
+ aParams->iErrorCode = KErrNotReady;
+ return;
+ }
+
+ //TRect segmentRect(SegmentSize(0));
+ TRect segmentRect(Size());
+ TRect rect(aParams->iRect);
+ rect.Intersection(segmentRect);
+
+ if ( rect != aParams->iRect )
+ {
+ // Rect must be fully within segment rect
+ aParams->iErrorCode = KErrArgument;
+ return;
+ }
+
+ aParams->iErrorCode = KErrNone;
+
+ if ( rect.IsEmpty() )
+ {
+ // Nothing to upload.
+ return;
+ }
+
+ PushEGLContext();
+ aParams->iBitmap->BeginDataAccess();
+
+ const TInt scanLineLength = CFbsBitmap::ScanLineLength(
+ aParams->iBitmap->SizeInPixels().iWidth, EColor16MAP);
+ const TInt bytesPerPixel = 4;
+
+ TUint8* dataAddress = (TUint8*)aParams->iBitmap->DataAddress();
+ dataAddress += rect.iTl.iX * bytesPerPixel;
+ dataAddress += rect.iTl.iY * scanLineLength;
+
+ vgImageSubData(
+ (VGImage)SegmentName(0), // image
+ dataAddress, // data
+ scanLineLength, // dataStride
+ VG_sARGB_8888_PRE, // dataFormat
+ rect.iTl.iX, // x
+ rect.iTl.iY, // y
+ rect.Width(), // width
+ rect.Height() // height
+ );
+
+ aParams->iBitmap->EndDataAccess( ETrue );
+ PopEGLContext();
+ }
+
#ifdef __NVG
HBufC8* CHuiVg10Texture::ReadNVGDataL(const CFbsBitmap& aBitmap)
{
@@ -1436,7 +1512,13 @@
TSize CHuiVg10Texture::ApplyMargin(VGImage aImage, TSize aSize, EGLDisplay aDisplay, EGLSurface aSurface, EGLContext aContext)
{
HUI_VG_INVARIANT();
-
+ #ifdef __WINSCW__
+ if ( eglMakeCurrent( aDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ) == EGL_FALSE )
+ {
+ HUI_DEBUG1(_L("CHuiVg10Texture::ApplyMargin() - EGL NO_Surface could not be made current, eglErr: %04x"), eglGetError());
+ return aSize;
+ }
+ #endif
#ifndef __WINS__ // Should possibly query the supported mode instead?
VGImageFormat imageInternalFormat = VG_sARGB_8888_PRE;
#else
@@ -1485,7 +1567,14 @@
}
delete buf;
HUI_VG_INVARIANT();
-
+ #ifdef __WINSCW__
+ // Make the PBuffer surface current again
+ if ( eglMakeCurrent(aDisplay, aSurface, aSurface, aContext) == EGL_FALSE )
+ {
+ HUI_DEBUG1(_L("CHuiVg10Texture::ApplyMargin() - EGL aSurface could not be made current, eglErr: %04x"), eglGetError());
+ return aSize;
+ }
+ #endif
// If icon size has to be changed, clear out old area for new DrawNVG round!
if(aSize.iHeight > HaN)
{