Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.1 KiB

  1. /*****************************************************************************
  2. *
  3. * emit - Emit routines for MF3216
  4. *
  5. * Date: 7/17/91
  6. * Author: Jeffrey Newman (c-jeffn)
  7. *
  8. * 01-Feb-1992 -by- c-jeffn
  9. *
  10. * Major code cleanup from Code review 1.
  11. *
  12. * Copyright (c) 1991,92 Microsoft Corp
  13. *****************************************************************************/
  14. #include "precomp.h"
  15. #pragma hdrstop
  16. /*----------------------------------------------------------------------------
  17. * Emit (copy) nCount Bytes in pBuffer to the user supplied output buffer.
  18. *
  19. * If this is a size only request, send the bits to the bit-bucket and
  20. * just keep track of the size.
  21. *
  22. * Note: ERROR_BUFFER_OVERFLOW flag is set in pLocalDC if output buffer
  23. * is overrun.
  24. *---------------------------------------------------------------------------*/
  25. BOOL bEmit(PLOCALDC pLocalDC, PVOID pBuffer, DWORD nCount)
  26. {
  27. BOOL b ;
  28. UINT ulBytesEmitted ;
  29. b = TRUE ;
  30. // Test for a size only request.
  31. if (!(pLocalDC->flags & SIZE_ONLY))
  32. {
  33. ulBytesEmitted = pLocalDC->ulBytesEmitted ;
  34. if ((ulBytesEmitted + nCount) <= pLocalDC->cMf16Dest)
  35. {
  36. memcpy(&(pLocalDC->pMf16Bits[ulBytesEmitted]), pBuffer, nCount) ;
  37. b = TRUE ;
  38. }
  39. else
  40. {
  41. // Signal output buffer overflow error.
  42. pLocalDC->flags |= ERR_BUFFER_OVERFLOW;
  43. b = FALSE ;
  44. RIP("MF3216: bEmit, (pLocalDC->ulBytesEmitted + nCount) > cMf16Dest \n") ;
  45. }
  46. }
  47. // Update the local DC byte count
  48. pLocalDC->ulBytesEmitted += nCount ;
  49. return(b) ;
  50. }
  51. /*----------------------------------------------------------------------------
  52. * Update the max record size. Used to update the metafile header.
  53. *---------------------------------------------------------------------------*/
  54. VOID vUpdateMaxRecord(PLOCALDC pLocalDC, PMETARECORD pmr)
  55. {
  56. if (pLocalDC->ulMaxRecord < pmr->rdSize)
  57. pLocalDC->ulMaxRecord = pmr->rdSize;
  58. }