Rasterizer.hh 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #ifndef RASTERIZER_HH
  2. #define RASTERIZER_HH
  3. #include "EmuTime.hh"
  4. #include "DisplayMode.hh"
  5. namespace openmsx {
  6. class PostProcessor;
  7. class RawFrame;
  8. class Rasterizer
  9. {
  10. public:
  11. virtual ~Rasterizer() = default;
  12. /** See VDP::getPostProcessor(). */
  13. virtual PostProcessor* getPostProcessor() const = 0;
  14. /** Will the output of this Rasterizer be displayed?
  15. * There is no point in producing a frame that will not be displayed.
  16. * TODO: Is querying the next pipeline step the best way to solve this,
  17. * or is it better to explicitly disable the first step in the pipeline?
  18. */
  19. virtual bool isActive() = 0;
  20. /** Resynchronize with VDP: all cached states are flushed.
  21. */
  22. virtual void reset() = 0;
  23. /** Indicates the start of a new frame.
  24. * The rasterizer can fetch per-frame settings from the VDP.
  25. */
  26. virtual void frameStart(EmuTime::param time) = 0;
  27. /** Indicates the end of the current frame.
  28. * The rasterizer can perform image post processing.
  29. */
  30. virtual void frameEnd() = 0;
  31. /** Precalc several values that depend on the display mode.
  32. * @param mode The new display mode.
  33. */
  34. virtual void setDisplayMode(DisplayMode mode) = 0;
  35. /** Change an entry in the palette.
  36. * @param index The index [0..15] in the palette that changes.
  37. * @param grb The new definition for the changed palette index:
  38. * bit 10..8 is green, bit 6..4 is red and bit 2..0 is blue;
  39. * all other bits are zero.
  40. */
  41. virtual void setPalette(int index, int grb) = 0;
  42. /** Changes the background color.
  43. * @param index Palette index of the new background color.
  44. */
  45. virtual void setBackgroundColor(int index) = 0;
  46. virtual void setHorizontalAdjust(int adjust) = 0;
  47. virtual void setHorizontalScrollLow(byte scroll) = 0;
  48. virtual void setBorderMask(bool masked) = 0;
  49. virtual void setTransparency(bool enabled) = 0;
  50. virtual void setSuperimposeVideoFrame(const RawFrame* videoSource) = 0;
  51. /** Render a rectangle of border pixels on the host screen.
  52. * The units are absolute lines (Y) and VDP clockticks (X).
  53. * @param fromX X coordinate of render start (inclusive).
  54. * @param fromY Y coordinate of render start (inclusive).
  55. * @param limitX X coordinate of render end (exclusive).
  56. * @param limitY Y coordinate of render end (exclusive).
  57. */
  58. virtual void drawBorder(int fromX, int fromY, int limitX, int limitY) = 0;
  59. /** Render a rectangle of display pixels on the host screen.
  60. * @param fromX X coordinate of render start in VDP ticks.
  61. * @param fromY Y coordinate of render start in absolute lines.
  62. * @param displayX display coordinate of render start: [0..512).
  63. * @param displayY display coordinate of render start: [0..256).
  64. * @param displayWidth rectangle width in pixels (512 per line).
  65. * @param displayHeight rectangle height in lines.
  66. */
  67. virtual void drawDisplay(
  68. int fromX, int fromY,
  69. int displayX, int displayY,
  70. int displayWidth, int displayHeight) = 0;
  71. /** Render a rectangle of sprite pixels on the host screen.
  72. * Although the parameters are very similar to drawDisplay,
  73. * the displayX and displayWidth use range [0..256) instead of
  74. * [0..512) because VDP sprite coordinates work that way.
  75. * @param fromX X coordinate of render start in VDP ticks.
  76. * @param fromY Y coordinate of render start in absolute lines.
  77. * @param displayX display coordinate of render start: [0..256).
  78. * @param displayY display coordinate of render start: [0..256).
  79. * @param displayWidth rectangle width in pixels (256 per line).
  80. * @param displayHeight rectangle height in lines.
  81. */
  82. virtual void drawSprites(
  83. int fromX, int fromY,
  84. int displayX, int displayY,
  85. int displayWidth, int displayHeight) = 0;
  86. /** Is video recording active?
  87. */
  88. virtual bool isRecording() const = 0;
  89. protected:
  90. Rasterizer() = default;
  91. };
  92. } // namespace openmsx
  93. #endif