graphicstest/uibench/s60/src/surfaceutility.cpp
changeset 36 01a6848ebfd7
parent 0 5d03bc08d59c
child 164 25ffed67c7ef
equal deleted inserted replaced
0:5d03bc08d59c 36:01a6848ebfd7
   601 		Mem::Move(linePtr, surfacePtr, info.iStride);
   601 		Mem::Move(linePtr, surfacePtr, info.iStride);
   602 		}
   602 		}
   603 
   603 
   604 	chunk.Close();
   604 	chunk.Close();
   605 
   605 
   606 	TInt err = iSurfaceUpdateSession.SubmitUpdate(0, aSurface, 0, NULL);
   606 	TInt err = iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, 0, NULL);
   607 	if (err!=KErrNone)
   607 	if (err!=KErrNone)
   608 		LOG(("Error submitting update: 0x%X\n", err));
   608 		LOG(("Error submitting update: 0x%X\n", err));
   609 	}
   609 	}
   610 
   610 
   611 /**
   611 /**
   864 			}
   864 			}
   865 		}
   865 		}
   866 
   866 
   867 	chunk.Close();
   867 	chunk.Close();
   868 
   868 
   869 	TInt err = iSurfaceUpdateSession.SubmitUpdate(0, aSurface, 0, NULL);
   869 	TInt err = iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, 0, NULL);
   870 	if (err!=KErrNone)
   870 	if (err!=KErrNone)
   871 		LOG(("Error submitting update: 0x%X\n", err));
   871 		LOG(("Error submitting update: 0x%X\n", err));
   872 	}
   872 	}
   873 
   873 
   874 /**
   874 /**
  1156 			Mem::Move(linePtr, surfacePtr, info.iStride);
  1156 			Mem::Move(linePtr, surfacePtr, info.iStride);
  1157 			}
  1157 			}
  1158 		}
  1158 		}
  1159 	chunk.Close();
  1159 	chunk.Close();
  1160 
  1160 
  1161 	TInt err =iSurfaceUpdateSession.SubmitUpdate(0, aSurface, 0, NULL);
  1161 	TInt err =iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, 0, NULL);
  1162 	if (err!=KErrNone)
  1162 	if (err!=KErrNone)
  1163 		LOG(("Error submitting update: 0x%X\n", err));
  1163 		LOG(("Error submitting update: 0x%X\n", err));
  1164 
  1164 
  1165 	}
  1165 	}
  1166 
  1166 
  1428 		FanFill<TUint>(innerXY,info.iStride/4,(TUint*)surfacePtr,linesTL,linesBR,linesBL,linesTR);
  1428 		FanFill<TUint>(innerXY,info.iStride/4,(TUint*)surfacePtr,linesTL,linesBR,linesBL,linesTR);
  1429 		}
  1429 		}
  1430 	
  1430 	
  1431 	chunk.Close();
  1431 	chunk.Close();
  1432 
  1432 
  1433 	iSurfaceUpdateSession.SubmitUpdate(0, aSurface, 0, NULL);
  1433 	iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, 0, NULL);
  1434 	}
  1434 	}
  1435 /**
  1435 /**
  1436 Fill the given surface with vertical line at the given position
  1436 Fill the given surface with vertical line at the given position
  1437 
  1437 
  1438 Similar to FillSurfaceL(), but with a vertical line overlayed. 
  1438 Similar to FillSurfaceL(), but with a vertical line overlayed. 
  1509 		{
  1509 		{
  1510 		DdaLine<TUint>((info.iSize.iWidth*aPosition)/100,0,(info.iSize.iWidth*aPosition)/100,
  1510 		DdaLine<TUint>((info.iSize.iWidth*aPosition)/100,0,(info.iSize.iWidth*aPosition)/100,
  1511 				info.iSize.iHeight-1,info.iStride/4,(TUint*)surfacePtr,lineColor);
  1511 				info.iSize.iHeight-1,info.iStride/4,(TUint*)surfacePtr,lineColor);
  1512 		}
  1512 		}
  1513 	chunk.Close();
  1513 	chunk.Close();
  1514 	iSurfaceUpdateSession.SubmitUpdate(0, aSurface, 0, NULL);
  1514 	iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, 0, NULL);
  1515 	}
  1515 	}
  1516 /**
  1516 /**
  1517  * Generates a bitmap equivalent to the surface.
  1517  * Generates a bitmap equivalent to the surface.
  1518  * Can reuse an existing bitmap or create a new bitmap.
  1518  * Can reuse an existing bitmap or create a new bitmap.
  1519  * The existing bitmap must be an exact match (eg previously generated by this method)
  1519  * The existing bitmap must be an exact match (eg previously generated by this method)
  1625 Submit an update to a surface to the update server.
  1625 Submit an update to a surface to the update server.
  1626 
  1626 
  1627 @param aScreenNumber	The screen to be updated where the surface is shown.
  1627 @param aScreenNumber	The screen to be updated where the surface is shown.
  1628 @param aSurface	The surface which has been updated.
  1628 @param aSurface	The surface which has been updated.
  1629 @param aRegion	The area of the surface affected, or NULL for all of it.*/
  1629 @param aRegion	The area of the surface affected, or NULL for all of it.*/
  1630 void CSurfaceUtility::SubmitUpdate(TInt aScreenNumber, const TSurfaceId& aSurface, const TRegion* aRegion,TInt aBufferNumber)
  1630 void CSurfaceUtility::SubmitUpdate(TInt /* aScreenNumber */, const TSurfaceId& aSurface, const TRegion* aRegion,TInt aBufferNumber)
  1631 	{
  1631 	{
  1632 	TInt err =iSurfaceUpdateSession.SubmitUpdate(aScreenNumber, aSurface, aBufferNumber, aRegion); 
  1632 	TInt err =iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, aBufferNumber, aRegion); 
  1633 	if (err!=KErrNone)
  1633 	if (err!=KErrNone)
  1634 		LOG(("Error submitting update: 0x%X\n", err));
  1634 		LOG(("Error submitting update: 0x%X\n", err));
  1635 	}
  1635 	}
  1636 
  1636 
  1637 /**
  1637 /**
  1640 @param aChunk	The chunk of memory to be mapped
  1640 @param aChunk	The chunk of memory to be mapped
  1641 @param aScreenNumber	The screen to be updated where the surface is shown.
  1641 @param aScreenNumber	The screen to be updated where the surface is shown.
  1642 @param aSurface	The surface which has been updated.
  1642 @param aSurface	The surface which has been updated.
  1643 @param aRegion	The area of the surface affected, or NULL for all of it.*/
  1643 @param aRegion	The area of the surface affected, or NULL for all of it.*/
  1644 void CSurfaceUtility::MapAndSubmitUpdateL(RChunk& aChunk, 
  1644 void CSurfaceUtility::MapAndSubmitUpdateL(RChunk& aChunk, 
  1645 		                                TInt aScreenNumber, 
  1645 		                                TInt /* aScreenNumber */, 
  1646 		                                const TSurfaceId& aSurface, 
  1646 		                                const TSurfaceId& aSurface, 
  1647 		                                const TRegion* aRegion)
  1647 		                                const TRegion* aRegion)
  1648 	{
  1648 	{
  1649 	User::LeaveIfError(iManager.MapSurface(aSurface, aChunk));
  1649 	User::LeaveIfError(iManager.MapSurface(aSurface, aChunk));
  1650 	aChunk.Close();
  1650 	aChunk.Close();
  1651 	TInt err =iSurfaceUpdateSession.SubmitUpdate(aScreenNumber, aSurface, 0, aRegion); 
  1651 	TInt err =iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, 0, aRegion); 
  1652 	if (err!=KErrNone)
  1652 	if (err!=KErrNone)
  1653 		LOG(("Error submitting update: 0x%X\n", err));
  1653 		LOG(("Error submitting update: 0x%X\n", err));
  1654 	}
  1654 	}
  1655 
  1655 
  1656 void CSurfaceUtility::MapSurfaceL(const TSurfaceId& aSurface, RChunk& aChunk)
  1656 void CSurfaceUtility::MapSurfaceL(const TSurfaceId& aSurface, RChunk& aChunk)
  1676 		// Set up a descriptor for the current line in the surface and get pixels.
  1676 		// Set up a descriptor for the current line in the surface and get pixels.
  1677 		TPtr8 ptr(chunk.Base() + start.iY * stride, stride);
  1677 		TPtr8 ptr(chunk.Base() + start.iY * stride, stride);
  1678 		aBitmap.GetScanLine(ptr, start, size.iWidth, bmpFormat);
  1678 		aBitmap.GetScanLine(ptr, start, size.iWidth, bmpFormat);
  1679 		}
  1679 		}
  1680 
  1680 
  1681 	TInt err =iSurfaceUpdateSession.SubmitUpdate(0, aSurface, 0, NULL);
  1681 	TInt err =iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, 0, NULL);
  1682 	if (err!=KErrNone)
  1682 	if (err!=KErrNone)
  1683 		{
  1683 		{
  1684 		LOG(("Error submitting update: 0x%X\n", err));
  1684 		LOG(("Error submitting update: 0x%X\n", err));
  1685 		}
  1685 		}
  1686 
  1686