blitter.h 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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/blitter.h $*
  25. * *
  26. * $Author:: Jani_p $*
  27. * *
  28. * $Modtime:: 5/04/01 7:48p $*
  29. * *
  30. * $Revision:: 3 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if _MSC_VER >= 1000
  36. #pragma once
  37. #endif // _MSC_VER >= 1000
  38. #ifndef BLITTER_H
  39. #define BLITTER_H
  40. /*
  41. ** This is the interface class to the blitter object. The blitter object handles moving
  42. ** pixels. That's all it does. For every type of pixel translation, there should be a
  43. ** blitter object created that supports this interface. The blit blitting routines will
  44. ** call the appropriate method as the pixel are being processed.
  45. */
  46. class Blitter {
  47. public:
  48. /*
  49. ** Blits from source to dest (starts at first pixel). This is the preferred
  50. ** method of pixel blitting and this routine will be called 99% of the time under
  51. ** normal circumstances.
  52. */
  53. virtual void BlitForward(void * dest, void const * source, int length) const = 0;
  54. /*
  55. ** Copies the pixel in reverse order. This only required if the source and dest
  56. ** pixel regions overlap in a certain way. This routine will rarely be called.
  57. */
  58. virtual void BlitBackward(void * dest, void const * source, int length) const = 0;
  59. /*
  60. ** This routine calls the appropriate blit routine. A proper overlap check cannot
  61. ** be performed by this routine because the pixel size information is not present.
  62. ** as such, you should call the appropriate blit routine rather than letting this
  63. ** routine perform the check and call.
  64. */
  65. void Blit(void * dest, void const * source, int length) const {if (dest < source) BlitBackward(dest, source, length); else BlitForward(dest, source, length);}
  66. };
  67. /*
  68. ** This is the blitter object interface for dealing with RLE compressed pixel data. For
  69. ** every type of RLE compressed blitter operation desired, there would be an object created
  70. ** that supports this interface.
  71. */
  72. class RLEBlitter {
  73. public:
  74. /*
  75. ** Blits from the RLE compressed source to the destination buffer. An optional
  76. ** leading pixel skip value can be supplied when a sub-section of an RLE
  77. ** compressed pixel sequence is desired. This is necessary because RLE decompression
  78. ** must begin at the start of the compressed data sequence.
  79. */
  80. virtual void Blit(void * dest, void const * source, int length, int leadskip=0) const = 0;
  81. };
  82. #endif