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.

97 lines
2.8 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: CBitmap.cpp
  3. *
  4. * This file contains the code to support the functionality test harness
  5. * for GDI+. This includes menu options and calling the appropriate
  6. * functions for execution.
  7. *
  8. * Created: 08-08-2000 - asecchia
  9. *
  10. * Copyright (c) 2000 Microsoft Corporation
  11. *
  12. \**************************************************************************/
  13. #include "CBitmap.h"
  14. #include "CFuncTest.h"
  15. extern CFuncTest g_FuncTest;
  16. CBitmap::CBitmap(BOOL bRegression, PixelFormat pixelFormat)
  17. {
  18. switch(pixelFormat) {
  19. case PixelFormat1bppIndexed:
  20. sprintf(m_szName,"Bitmap %s ", "1bppIndexed");
  21. break;
  22. case PixelFormat4bppIndexed:
  23. sprintf(m_szName,"Bitmap %s ", "4bppIndexed");
  24. break;
  25. case PixelFormat8bppIndexed:
  26. sprintf(m_szName,"Bitmap %s ", "8bppIndexed");
  27. break;
  28. case PixelFormat16bppGrayScale:
  29. sprintf(m_szName,"Bitmap %s ", "16bppGrayScale");
  30. break;
  31. case PixelFormat16bppRGB555:
  32. sprintf(m_szName,"Bitmap %s ", "16bppRGB555");
  33. break;
  34. case PixelFormat16bppRGB565:
  35. sprintf(m_szName,"Bitmap %s ", "16bppRGB565");
  36. break;
  37. case PixelFormat16bppARGB1555:
  38. sprintf(m_szName,"Bitmap %s ", "16bppARGB1555");
  39. break;
  40. case PixelFormat24bppRGB:
  41. sprintf(m_szName,"Bitmap %s ", "24bppRGB");
  42. break;
  43. case PixelFormat32bppRGB:
  44. sprintf(m_szName,"Bitmap %s ", "32bppRGB");
  45. break;
  46. case PixelFormat32bppARGB:
  47. sprintf(m_szName,"Bitmap %s ", "32bppARGB");
  48. break;
  49. case PixelFormat32bppPARGB:
  50. sprintf(m_szName,"Bitmap %s ", "32bppPARGB");
  51. break;
  52. case PixelFormat48bppRGB:
  53. sprintf(m_szName,"Bitmap %s ", "48bppRGB");
  54. break;
  55. case PixelFormat64bppARGB:
  56. sprintf(m_szName,"Bitmap %s ", "64bppARGB");
  57. break;
  58. case PixelFormat64bppPARGB:
  59. sprintf(m_szName,"Bitmap %s ", "64bppPARGB");
  60. break;
  61. }
  62. m_PixelFormat=pixelFormat;
  63. m_bRegression=bRegression;
  64. }
  65. CBitmap::~CBitmap()
  66. {
  67. }
  68. Graphics *CBitmap::PreDraw(int &nOffsetX,int &nOffsetY)
  69. {
  70. Graphics *g=NULL;
  71. m_bmp = new Bitmap((INT)TESTAREAWIDTH, (INT)TESTAREAHEIGHT, m_PixelFormat);
  72. g = new Graphics(m_bmp);
  73. // Since we are doing the test on another surface
  74. nOffsetX=0;
  75. nOffsetY=0;
  76. return g;
  77. }
  78. void CBitmap::PostDraw(RECT rTestArea)
  79. {
  80. HDC hdcOrig = GetDC(g_FuncTest.m_hWndMain);
  81. Graphics *g = new Graphics(hdcOrig);
  82. g->DrawImage(m_bmp, rTestArea.left, rTestArea.top, 0, 0, (INT)TESTAREAWIDTH, (INT)TESTAREAHEIGHT, UnitPixel);
  83. delete m_bmp;
  84. delete g;
  85. m_bmp = NULL;
  86. ReleaseDC(g_FuncTest.m_hWndMain,hdcOrig);
  87. }