surfrect.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Command & Conquer *
  23. * *
  24. * $Archive:: /Commando/Code/wwlib/surfrect.h $*
  25. * *
  26. * $Author:: Byon_g $*
  27. * *
  28. * $Modtime:: 11/28/00 2:44p $*
  29. * *
  30. * $Revision:: 2 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef SURFRECT_H
  36. #define SURFRECT_H
  37. #ifdef NEVER
  38. #include "surface.h"
  39. #include "trect.h"
  40. #include "point.h"
  41. #include <assert.h>
  42. /*
  43. ** This class encapsulates a surface and a clipping rectangle. It is intended to be used as
  44. ** a convenience for certain operations that need both a surface and a rectangle. Be aware that
  45. ** all surfaces are imbued with a rectangle that is the full size of the surface.
  46. */
  47. class SurfaceRect {
  48. public:
  49. SurfaceRect(Surface * surfaceptr = NULL, Rect * rect = NULL) : SurfacePtr(surfaceptr), Point(0, 0) {
  50. assert(SurfacePtr != NULL);
  51. if (rect != NULL) Window = *rect; else Window = SurfacePtr->Get_Rect();
  52. }
  53. SurfaceRect(Surface & surface, Rect * rect = NULL) : SurfacePtr(&surface), Point(0, 0) {
  54. if (rect != NULL) Window = *rect; else Window = SurfacePtr->Get_Rect();
  55. }
  56. SurfaceRect(Surface & surface, Rect const & rect) : SurfacePtr(&surface), Window(rect), Point(0, 0) {}
  57. ~SurfaceRect(void) {};
  58. /*
  59. ** Pointer to the surface represented by this class.
  60. */
  61. Surface * SurfacePtr;
  62. /*
  63. ** Clipping rectangle window into the surface.
  64. */
  65. Rect Window;
  66. /*
  67. ** Tracking 2D coordinate into the surface.
  68. */
  69. Point2D Point;
  70. private:
  71. /*
  72. ** Ensures that the copy constructor and assignment operator never
  73. ** get created for this class.
  74. */
  75. SurfaceRect(SurfaceRect const & rvalue);
  76. SurfaceRect operator = (SurfaceRect const & rvalue);
  77. };
  78. #endif
  79. #endif