31 #include "uiacceltk/HuiUtil.h" |
31 #include "uiacceltk/HuiUtil.h" |
32 #include "uiacceltk/HuiPanic.h" |
32 #include "uiacceltk/HuiPanic.h" |
33 #include "uiacceltk/huifixmath.h" |
33 #include "uiacceltk/huifixmath.h" |
34 #include "HuiRenderSurface.h" |
34 #include "HuiRenderSurface.h" |
35 #include "../../CommonInc/uiacceltkdomaincrkeys.h" |
35 #include "../../CommonInc/uiacceltkdomaincrkeys.h" |
|
36 |
|
37 #include "huiextension.h" |
36 |
38 |
37 #include <e32math.h> |
39 #include <e32math.h> |
38 #include <VG/vgu.h> |
40 #include <VG/vgu.h> |
39 #ifdef __NVG |
41 #ifdef __NVG |
40 #pragma message( "NVG Defined!" ) |
42 #pragma message( "NVG Defined!" ) |
1477 destinationRect.iTl.iX += 0.5f; |
1479 destinationRect.iTl.iX += 0.5f; |
1478 destinationRect.iTl.iY += 0.5f; |
1480 destinationRect.iTl.iY += 0.5f; |
1479 destinationRect.iBr.iX -= 0.5f; |
1481 destinationRect.iBr.iX -= 0.5f; |
1480 destinationRect.iBr.iY -= 0.5f; |
1482 destinationRect.iBr.iY -= 0.5f; |
1481 |
1483 |
1482 VGfloat alpha = PenAlpha(); |
1484 VGfloat alpha = PenAlpha()/255.0f; |
1483 vgClearPath(iEllipsePath, VG_PATH_CAPABILITY_APPEND_TO); |
1485 vgClearPath(iEllipsePath, VG_PATH_CAPABILITY_APPEND_TO); |
1484 |
1486 |
1485 VGfloat cx = (destinationRect.iTl.iX + destinationRect.iBr.iX) / 2.f; |
1487 VGfloat cx = (destinationRect.iTl.iX + destinationRect.iBr.iX) / 2.f; |
1486 VGfloat cy = (destinationRect.iTl.iY + destinationRect.iBr.iY) / 2.f; |
1488 VGfloat cy = (destinationRect.iTl.iY + destinationRect.iBr.iY) / 2.f; |
1487 VGfloat width = destinationRect.Width(); |
1489 VGfloat width = destinationRect.Width(); |
2320 vgLoadIdentity(); |
2322 vgLoadIdentity(); |
2321 vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE); |
2323 vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE); |
2322 } |
2324 } |
2323 } |
2325 } |
2324 |
2326 |
|
2327 void CHuiVg10Gc::GcExtension(const TUid& aExtensionUid, TAny** aExtensionParams) |
|
2328 { |
|
2329 if ( aExtensionUid == KHuiGcCopyScreenToBitmap && aExtensionParams && *aExtensionParams) |
|
2330 { |
|
2331 THuiGcCopyScreenToBitmapParams* params = static_cast<THuiGcCopyScreenToBitmapParams*>(*aExtensionParams); |
|
2332 params->iErrorCode = DoCopyScreenToBitmap(params->iBitmap); |
|
2333 } |
|
2334 else |
|
2335 { |
|
2336 CHuiGc::GcExtension(aExtensionUid, aExtensionParams); |
|
2337 } |
|
2338 } |
|
2339 |
|
2340 TInt CHuiVg10Gc::DoCopyScreenToBitmap(CFbsBitmap* aBitmap) |
|
2341 { |
|
2342 if (!aBitmap || |
|
2343 !aBitmap->Handle() || |
|
2344 aBitmap->IsCompressedInRAM() || |
|
2345 aBitmap->ExtendedBitmapType() != KNullUid ) |
|
2346 { |
|
2347 return KErrNotSupported; |
|
2348 } |
|
2349 |
|
2350 VGImageFormat dataFormat = VG_sARGB_8888_PRE; |
|
2351 TBool displayModeSupported = ETrue; |
|
2352 switch (aBitmap->DisplayMode()) |
|
2353 { |
|
2354 case EColor16MAP: |
|
2355 dataFormat = VG_sARGB_8888_PRE; |
|
2356 break; |
|
2357 case EColor64K: |
|
2358 dataFormat = VG_sRGB_565; |
|
2359 break; |
|
2360 case EColor16MU: |
|
2361 dataFormat = VG_sXRGB_8888; |
|
2362 break; |
|
2363 case EColor16MA: |
|
2364 dataFormat = VG_sARGB_8888; |
|
2365 break; |
|
2366 |
|
2367 default: |
|
2368 displayModeSupported = EFalse; |
|
2369 break; |
|
2370 } |
|
2371 |
|
2372 if (!displayModeSupported) |
|
2373 { |
|
2374 return KErrNotSupported; |
|
2375 } |
|
2376 |
|
2377 TRect copyRect(aBitmap->SizeInPixels()); |
|
2378 if (copyRect.IsEmpty()) |
|
2379 { |
|
2380 return KErrArgument; |
|
2381 } |
|
2382 |
|
2383 TInt dataStride = CFbsBitmap::ScanLineLength(copyRect.Width(), |
|
2384 aBitmap->DisplayMode()); |
|
2385 |
|
2386 aBitmap->BeginDataAccess(); |
|
2387 TUint8* data = (TUint8*)aBitmap->DataAddress(); |
|
2388 |
|
2389 // image is upside down.. |
|
2390 data += (copyRect.Height() - 1)*dataStride; |
|
2391 dataStride = -dataStride; |
|
2392 |
|
2393 vgReadPixels( |
|
2394 data, |
|
2395 dataStride, |
|
2396 dataFormat, |
|
2397 0, // sx |
|
2398 0, // sy |
|
2399 copyRect.Width(), // width |
|
2400 copyRect.Height() // height |
|
2401 ); |
|
2402 |
|
2403 aBitmap->EndDataAccess(EFalse); |
|
2404 return KErrNone; |
|
2405 } |
2325 |
2406 |
2326 // End of file |
2407 // End of file |
2327 |
2408 |