windowing/windowserver/tdynamicres/src/surfaceutility.cpp
changeset 36 01a6848ebfd7
parent 0 5d03bc08d59c
equal deleted inserted replaced
0:5d03bc08d59c 36:01a6848ebfd7
   565 		{
   565 		{
   566 		linePtr += info.iStride;
   566 		linePtr += info.iStride;
   567 		Mem::Copy(linePtr, surfacePtr, info.iSize.iWidth * BytesPerPixelL(info.iPixelFormat));
   567 		Mem::Copy(linePtr, surfacePtr, info.iSize.iWidth * BytesPerPixelL(info.iPixelFormat));
   568 		}
   568 		}
   569 	
   569 	
   570 	TInt err = iSurfaceUpdateSession.SubmitUpdate(0, aSurface, 0, NULL);
   570 	TInt err = iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, 0, NULL);
   571 	if (err!=KErrNone)
   571 	if (err!=KErrNone)
   572 		LOG(("Error submitting update: 0x%X\n", err));
   572 		LOG(("Error submitting update: 0x%X\n", err));
   573 
   573 
   574 	CleanupStack::PopAndDestroy(/* chunk */);
   574 	CleanupStack::PopAndDestroy(/* chunk */);
   575 	}
   575 	}
   701 */
   701 */
   702 void CSurfaceUtility::FillRectangleL(TSurfaceId& aSurface, const TPoint& aStartPos, const TSize& aSize, const TRgb& aColor)
   702 void CSurfaceUtility::FillRectangleL(TSurfaceId& aSurface, const TPoint& aStartPos, const TSize& aSize, const TRgb& aColor)
   703 	{
   703 	{
   704 	FillRectangleNoUpdateL(aSurface, aStartPos, aSize, aColor);
   704 	FillRectangleNoUpdateL(aSurface, aStartPos, aSize, aColor);
   705 	
   705 	
   706 	TInt err = iSurfaceUpdateSession.SubmitUpdate(0, aSurface, 0, NULL);
   706 	TInt err = iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, 0, NULL);
   707 	if (err!=KErrNone)
   707 	if (err!=KErrNone)
   708 		LOG(("Error submitting update: 0x%X\n", err));
   708 		LOG(("Error submitting update: 0x%X\n", err));
   709 	}
   709 	}
   710 
   710 
   711 /**
   711 /**
   997 			// Copy first line
   997 			// Copy first line
   998 			Mem::Copy(linePtr, surfacePtr, info.iSize.iWidth * BytesPerPixelL(info.iPixelFormat));
   998 			Mem::Copy(linePtr, surfacePtr, info.iSize.iWidth * BytesPerPixelL(info.iPixelFormat));
   999 			}
   999 			}
  1000 		}
  1000 		}
  1001 
  1001 
  1002 	TInt err =iSurfaceUpdateSession.SubmitUpdate(0, aSurface, 0, NULL);
  1002 	TInt err =iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, 0, NULL);
  1003 	if (err!=KErrNone)
  1003 	if (err!=KErrNone)
  1004 		LOG(("Error submitting update: 0x%X\n", err));
  1004 		LOG(("Error submitting update: 0x%X\n", err));
  1005 	
  1005 	
  1006 	CleanupStack::PopAndDestroy(/* chunk */);
  1006 	CleanupStack::PopAndDestroy(/* chunk */);
  1007 	}
  1007 	}
  1272 			User::Leave(KErrOverflow);
  1272 			User::Leave(KErrOverflow);
  1273 			}
  1273 			}
  1274 		FanFill<TUint>(innerXY,info.iStride/4,(TUint*)surfacePtr,linesTL,linesBR,linesBL,linesTR);
  1274 		FanFill<TUint>(innerXY,info.iStride/4,(TUint*)surfacePtr,linesTL,linesBR,linesBL,linesTR);
  1275 		}
  1275 		}
  1276 	
  1276 	
  1277 	iSurfaceUpdateSession.SubmitUpdate(0, aSurface, 0, NULL);
  1277 	iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, 0, NULL);
  1278 	
  1278 	
  1279 	CleanupStack::PopAndDestroy(/* chunk */);
  1279 	CleanupStack::PopAndDestroy(/* chunk */);
  1280 	}
  1280 	}
  1281 /**
  1281 /**
  1282 Fill the given surface with vertical line at the given position
  1282 Fill the given surface with vertical line at the given position
  1359 				info.iSize.iHeight-1,info.iStride/4,(TUint*)surfacePtr,lineColor);
  1359 				info.iSize.iHeight-1,info.iStride/4,(TUint*)surfacePtr,lineColor);
  1360 		}
  1360 		}
  1361 
  1361 
  1362 	chunk.Close();
  1362 	chunk.Close();
  1363 	
  1363 	
  1364 	iSurfaceUpdateSession.SubmitUpdate(0, aSurface, 0, NULL);
  1364 	iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, 0, NULL);
  1365 	}
  1365 	}
  1366 /**
  1366 /**
  1367  * Generates a bitmap equivalent to the surface.
  1367  * Generates a bitmap equivalent to the surface.
  1368  * Can reuse an existing bitmap or create a new bitmap.
  1368  * Can reuse an existing bitmap or create a new bitmap.
  1369  * The existing bitmap must be an exact match (eg previously generated by this method)
  1369  * The existing bitmap must be an exact match (eg previously generated by this method)
  1477 Submit an update to a surface to the update server.
  1477 Submit an update to a surface to the update server.
  1478 
  1478 
  1479 @param aScreenNumber	The screen to be updated where the surface is shown.
  1479 @param aScreenNumber	The screen to be updated where the surface is shown.
  1480 @param aSurface	The surface which has been updated.
  1480 @param aSurface	The surface which has been updated.
  1481 @param aRegion	The area of the surface affected, or NULL for all of it.*/
  1481 @param aRegion	The area of the surface affected, or NULL for all of it.*/
  1482 void CSurfaceUtility::SubmitUpdate(TInt aScreenNumber, const TSurfaceId& aSurface, const TRegion* aRegion,TInt aBufferNumber)
  1482 void CSurfaceUtility::SubmitUpdate(TInt /* aScreenNumber */, const TSurfaceId& aSurface, const TRegion* aRegion,TInt aBufferNumber)
  1483 	{
  1483 	{
  1484 	TInt err =iSurfaceUpdateSession.SubmitUpdate(aScreenNumber, aSurface, aBufferNumber, aRegion); 
  1484 	TInt err =iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, aBufferNumber, aRegion); 
  1485 	if (err!=KErrNone)
  1485 	if (err!=KErrNone)
  1486 		LOG(("Error submitting update: 0x%X\n", err));
  1486 		LOG(("Error submitting update: 0x%X\n", err));
  1487 	}
  1487 	}
  1488 
  1488 
  1489 /**
  1489 /**
  1492 @param aChunk	The chunk of memory to be mapped
  1492 @param aChunk	The chunk of memory to be mapped
  1493 @param aScreenNumber	The screen to be updated where the surface is shown.
  1493 @param aScreenNumber	The screen to be updated where the surface is shown.
  1494 @param aSurface	The surface which has been updated.
  1494 @param aSurface	The surface which has been updated.
  1495 @param aRegion	The area of the surface affected, or NULL for all of it.*/
  1495 @param aRegion	The area of the surface affected, or NULL for all of it.*/
  1496 void CSurfaceUtility::MapAndSubmitUpdateL(RChunk& aChunk, 
  1496 void CSurfaceUtility::MapAndSubmitUpdateL(RChunk& aChunk, 
  1497 		                                TInt aScreenNumber, 
  1497 		                                TInt /* aScreenNumber */, 
  1498 		                                const TSurfaceId& aSurface, 
  1498 		                                const TSurfaceId& aSurface, 
  1499 		                                const TRegion* aRegion)
  1499 		                                const TRegion* aRegion)
  1500 	{
  1500 	{
  1501 	User::LeaveIfError(iManager.MapSurface(aSurface, aChunk));
  1501 	User::LeaveIfError(iManager.MapSurface(aSurface, aChunk));
  1502 	aChunk.Close();
  1502 	aChunk.Close();
  1503 	TInt err =iSurfaceUpdateSession.SubmitUpdate(aScreenNumber, aSurface, 0, aRegion); 
  1503 	TInt err =iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, 0, aRegion); 
  1504 	if (err!=KErrNone)
  1504 	if (err!=KErrNone)
  1505 		LOG(("Error submitting update: 0x%X\n", err));
  1505 		LOG(("Error submitting update: 0x%X\n", err));
  1506 	}
  1506 	}
  1507 
  1507 
  1508 void CSurfaceUtility::MapSurfaceL(const TSurfaceId& aSurface, RChunk& aChunk)
  1508 void CSurfaceUtility::MapSurfaceL(const TSurfaceId& aSurface, RChunk& aChunk)
  1532 		// Set up a descriptor for the current line in the surface and get pixels.
  1532 		// Set up a descriptor for the current line in the surface and get pixels.
  1533 		TPtr8 ptr(pSurfStart + start.iY * stride, stride);
  1533 		TPtr8 ptr(pSurfStart + start.iY * stride, stride);
  1534 		aBitmap.GetScanLine(ptr, start, size.iWidth, bmpFormat);
  1534 		aBitmap.GetScanLine(ptr, start, size.iWidth, bmpFormat);
  1535 		}
  1535 		}
  1536 
  1536 
  1537 	TInt err =iSurfaceUpdateSession.SubmitUpdate(0, aSurface, 0, NULL);
  1537 	TInt err =iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, 0, NULL);
  1538 	if (err!=KErrNone)
  1538 	if (err!=KErrNone)
  1539 		{
  1539 		{
  1540 		LOG(("Error submitting update: 0x%X\n", err));
  1540 		LOG(("Error submitting update: 0x%X\n", err));
  1541 		}
  1541 		}
  1542 
  1542