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.

84 lines
2.0 KiB

  1. #if !defined(MOTION__Context_inl__INCLUDED)
  2. #define MOTION__Context_inl__INCLUDED
  3. #pragma once
  4. #include "Colors.h"
  5. //------------------------------------------------------------------------------
  6. inline MotionSC *
  7. GetMotionSC()
  8. {
  9. return static_cast<MotionSC *> (GetContext()->GetSC(Context::slMotion));
  10. }
  11. //------------------------------------------------------------------------------
  12. inline MotionSC *
  13. GetMotionSC(Context * pContext)
  14. {
  15. return static_cast<MotionSC *> (pContext->GetSC(Context::slMotion));
  16. }
  17. //------------------------------------------------------------------------------
  18. inline
  19. MotionSC::MotionSC()
  20. {
  21. m_dwLastTimeslice = ::GetTickCount();
  22. m_dwPauseTimeslice = 0;
  23. }
  24. //------------------------------------------------------------------------------
  25. inline Scheduler *
  26. MotionSC::GetScheduler()
  27. {
  28. return &m_sch;
  29. }
  30. //------------------------------------------------------------------------------
  31. inline DWORD
  32. MotionSC::GetTimeslice()
  33. {
  34. return m_dwPauseTimeslice;
  35. }
  36. //------------------------------------------------------------------------------
  37. inline void
  38. MotionSC::SetTimeslice(DWORD dwTimeslice)
  39. {
  40. m_dwPauseTimeslice = dwTimeslice;
  41. }
  42. //------------------------------------------------------------------------------
  43. inline HBRUSH
  44. MotionSC::GetBrushI(UINT idxBrush) const
  45. {
  46. AssertMsg(idxBrush <= SC_MAXCOLORS, "Ensure valid color");
  47. if (m_rghbrStd[idxBrush] == NULL) {
  48. m_rghbrStd[idxBrush] = CreateSolidBrush(GdGetColorInfo(idxBrush)->GetColorI());
  49. }
  50. return m_rghbrStd[idxBrush];
  51. }
  52. //------------------------------------------------------------------------------
  53. inline HPEN
  54. MotionSC::GetPenI(UINT idxPen) const
  55. {
  56. AssertMsg(idxPen <= SC_MAXCOLORS, "Ensure valid color");
  57. if (m_rghpenStd[idxPen] == NULL) {
  58. m_rghpenStd[idxPen] = CreatePen(PS_SOLID, 1, GdGetColorInfo(idxPen)->GetColorI());
  59. }
  60. return m_rghpenStd[idxPen];
  61. }
  62. #endif // MOTION__Context_inl__INCLUDED