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.

74 lines
1.7 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: CChecker.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: 05-May-2000 - Jeff Vezina [t-jfvez]
  9. *
  10. * Copyright (c) 2000 Microsoft Corporation
  11. *
  12. \**************************************************************************/
  13. #include "CChecker.h"
  14. #include "CFuncTest.h"
  15. extern CFuncTest g_FuncTest;
  16. CChecker::CChecker(BOOL bRegression)
  17. {
  18. strcpy(m_szName,"Checker");
  19. m_bRegression=bRegression;
  20. m_paRegion=NULL;
  21. }
  22. CChecker::~CChecker()
  23. {
  24. if (m_paRegion!=NULL) {
  25. delete m_paRegion;
  26. m_paRegion=NULL;
  27. }
  28. }
  29. BOOL CChecker::Init()
  30. {
  31. // Create clip region pattern
  32. m_paRegion=new Region();
  33. return CSetting::Init();
  34. }
  35. void CChecker::Set(Graphics *g)
  36. {
  37. int cCheckerMax=0;
  38. int nCheckerSize=64;
  39. Matrix mat;
  40. g->ResetClip();
  41. if (!m_bUseSetting)
  42. return;
  43. m_paRegion->MakeInfinite();
  44. Rect horzRect(0, 0, (int)TESTAREAWIDTH, nCheckerSize);
  45. Rect vertRect(0, 0, nCheckerSize, (int)TESTAREAHEIGHT);
  46. Region *horzRegion = new Region(horzRect);
  47. Region *vertRegion = new Region(vertRect);
  48. if (TESTAREAWIDTH>TESTAREAHEIGHT)
  49. cCheckerMax=(int)TESTAREAWIDTH/nCheckerSize*2+1;
  50. else
  51. cCheckerMax=(int)TESTAREAHEIGHT/nCheckerSize*2+1;
  52. for (INT i = 0; i < 5; i++)
  53. {
  54. m_paRegion->Xor(horzRegion);
  55. m_paRegion->Xor(vertRegion);
  56. horzRegion->Translate(0, nCheckerSize*2);
  57. vertRegion->Translate(nCheckerSize*2, 0);
  58. }
  59. delete horzRegion;
  60. delete vertRegion;
  61. g->SetClip(m_paRegion);
  62. }