openMSX
Public Member Functions | List of all members
openmsx::SDLRasterizer< Pixel > Class Template Referencefinal

Rasterizer using a frame buffer approach: it writes pixels to a single rectangular pixel buffer. More...

#include <SDLRasterizer.hh>

Inheritance diagram for openmsx::SDLRasterizer< Pixel >:
Inheritance graph
[legend]
Collaboration diagram for openmsx::SDLRasterizer< Pixel >:
Collaboration graph
[legend]

Public Member Functions

 SDLRasterizer (const SDLRasterizer &)=delete
 
SDLRasterizeroperator= (const SDLRasterizer &)=delete
 
 SDLRasterizer (VDP &vdp, Display &display, OutputSurface &screen, std::unique_ptr< PostProcessor > postProcessor)
 
 ~SDLRasterizer () override
 
PostProcessorgetPostProcessor () const override
 See VDP::getPostProcessor(). More...
 
bool isActive () override
 Will the output of this Rasterizer be displayed? There is no point in producing a frame that will not be displayed. More...
 
void reset () override
 Resynchronize with VDP: all cached states are flushed. More...
 
void frameStart (EmuTime::param time) override
 Indicates the start of a new frame. More...
 
void frameEnd () override
 Indicates the end of the current frame. More...
 
void setDisplayMode (DisplayMode mode) override
 Precalc several values that depend on the display mode. More...
 
void setPalette (unsigned index, int grb) override
 Change an entry in the palette. More...
 
void setBackgroundColor (int index) override
 Changes the background color. More...
 
void setHorizontalAdjust (int adjust) override
 
void setHorizontalScrollLow (byte scroll) override
 
void setBorderMask (bool masked) override
 
void setTransparency (bool enabled) override
 
void setSuperimposeVideoFrame (const RawFrame *videoSource) override
 
void drawBorder (int fromX, int fromY, int limitX, int limitY) override
 Render a rectangle of border pixels on the host screen. More...
 
void drawDisplay (int fromX, int fromY, int displayX, int displayY, int displayWidth, int displayHeight) override
 Render a rectangle of display pixels on the host screen. More...
 
void drawSprites (int fromX, int fromY, int displayX, int displayY, int displayWidth, int displayHeight) override
 Render a rectangle of sprite pixels on the host screen. More...
 
bool isRecording () const override
 Is video recording active? More...
 
- Public Member Functions inherited from openmsx::Rasterizer
virtual ~Rasterizer ()=default
 
virtual PostProcessorgetPostProcessor () const =0
 See VDP::getPostProcessor(). More...
 
virtual bool isActive ()=0
 Will the output of this Rasterizer be displayed? There is no point in producing a frame that will not be displayed. More...
 
virtual void reset ()=0
 Resynchronize with VDP: all cached states are flushed. More...
 
virtual void frameStart (EmuTime::param time)=0
 Indicates the start of a new frame. More...
 
virtual void frameEnd ()=0
 Indicates the end of the current frame. More...
 
virtual void setDisplayMode (DisplayMode mode)=0
 Precalc several values that depend on the display mode. More...
 
virtual void setPalette (unsigned index, int grb)=0
 Change an entry in the palette. More...
 
virtual void setBackgroundColor (int index)=0
 Changes the background color. More...
 
virtual void setHorizontalAdjust (int adjust)=0
 
virtual void setHorizontalScrollLow (byte scroll)=0
 
virtual void setBorderMask (bool masked)=0
 
virtual void setTransparency (bool enabled)=0
 
virtual void setSuperimposeVideoFrame (const RawFrame *videoSource)=0
 
virtual void drawBorder (int fromX, int fromY, int limitX, int limitY)=0
 Render a rectangle of border pixels on the host screen. More...
 
virtual void drawDisplay (int fromX, int fromY, int displayX, int displayY, int displayWidth, int displayHeight)=0
 Render a rectangle of display pixels on the host screen. More...
 
virtual void drawSprites (int fromX, int fromY, int displayX, int displayY, int displayWidth, int displayHeight)=0
 Render a rectangle of sprite pixels on the host screen. More...
 
virtual bool isRecording () const =0
 Is video recording active? More...
 

Additional Inherited Members

- Protected Member Functions inherited from openmsx::Rasterizer
 Rasterizer ()=default
 

Detailed Description

template<std::unsigned_integral Pixel>
class openmsx::SDLRasterizer< Pixel >

Rasterizer using a frame buffer approach: it writes pixels to a single rectangular pixel buffer.

Definition at line 29 of file SDLRasterizer.hh.

Constructor & Destructor Documentation

◆ SDLRasterizer() [1/2]

template<std::unsigned_integral Pixel>
openmsx::SDLRasterizer< Pixel >::SDLRasterizer ( const SDLRasterizer< Pixel > &  )
delete

◆ SDLRasterizer() [2/2]

template<std::unsigned_integral Pixel>
openmsx::SDLRasterizer< Pixel >::SDLRasterizer ( VDP vdp,
Display display,
OutputSurface screen,
std::unique_ptr< PostProcessor postProcessor 
)

◆ ~SDLRasterizer()

template<std::unsigned_integral Pixel>
openmsx::SDLRasterizer< Pixel >::~SDLRasterizer
override

Definition at line 103 of file SDLRasterizer.cc.

Member Function Documentation

◆ drawBorder()

template<std::unsigned_integral Pixel>
void openmsx::SDLRasterizer< Pixel >::drawBorder ( int  fromX,
int  fromY,
int  limitX,
int  limitY 
)
overridevirtual

Render a rectangle of border pixels on the host screen.

The units are absolute lines (Y) and VDP clock ticks (X).

Parameters
fromXX coordinate of render start (inclusive).
fromYY coordinate of render start (inclusive).
limitXX coordinate of render end (exclusive).
limitYY coordinate of render end (exclusive).

Implements openmsx::Rasterizer.

Definition at line 400 of file SDLRasterizer.cc.

References gl::max(), gl::min(), openmsx::VDP::TICKS_PER_LINE, and xrange().

◆ drawDisplay()

template<std::unsigned_integral Pixel>
void openmsx::SDLRasterizer< Pixel >::drawDisplay ( int  fromX,
int  fromY,
int  displayX,
int  displayY,
int  displayWidth,
int  displayHeight 
)
overridevirtual

Render a rectangle of display pixels on the host screen.

Parameters
fromXX coordinate of render start in VDP ticks.
fromYY coordinate of render start in absolute lines.
displayXdisplay coordinate of render start: [0..512).
displayYdisplay coordinate of render start: [0..256).
displayWidthrectangle width in pixels (512 per line).
displayHeightrectangle height in lines.

Implements openmsx::Rasterizer.

Definition at line 438 of file SDLRasterizer.cc.

References ranges::copy(), openmsx::DisplayMode::getLineWidth(), openmsx::DisplayMode::isBitmapMode(), openmsx::DisplayMode::isPlanar(), openmsx::DisplayMode::isTextMode(), gl::min(), subspan(), and xrange().

◆ drawSprites()

template<std::unsigned_integral Pixel>
void openmsx::SDLRasterizer< Pixel >::drawSprites ( int  fromX,
int  fromY,
int  displayX,
int  displayY,
int  displayWidth,
int  displayHeight 
)
overridevirtual

Render a rectangle of sprite pixels on the host screen.

Although the parameters are very similar to drawDisplay, the displayX and displayWidth use range [0..256) instead of [0..512) because VDP sprite coordinates work that way.

Parameters
fromXX coordinate of render start in VDP ticks.
fromYY coordinate of render start in absolute lines.
displayXdisplay coordinate of render start: [0..256).
displayYdisplay coordinate of render start: [0..256).
displayWidthrectangle width in pixels (256 per line).
displayHeightrectangle height in lines.

Implements openmsx::Rasterizer.

Definition at line 568 of file SDLRasterizer.cc.

References openmsx::DisplayMode::GRAPHIC5, openmsx::DisplayMode::GRAPHIC6, gl::min(), and subspan().

◆ frameEnd()

template<std::unsigned_integral Pixel>
void openmsx::SDLRasterizer< Pixel >::frameEnd ( )
overridevirtual

Indicates the end of the current frame.

The rasterizer can perform image post processing.

Implements openmsx::Rasterizer.

Definition at line 172 of file SDLRasterizer.cc.

◆ frameStart()

template<std::unsigned_integral Pixel>
void openmsx::SDLRasterizer< Pixel >::frameStart ( EmuTime::param  time)
overridevirtual

Indicates the start of a new frame.

The rasterizer can fetch per-frame settings from the VDP.

Implements openmsx::Rasterizer.

Definition at line 155 of file SDLRasterizer.cc.

References openmsx::FrameSource::FIELD_EVEN, openmsx::FrameSource::FIELD_NONINTERLACED, and openmsx::FrameSource::FIELD_ODD.

◆ getPostProcessor()

template<std::unsigned_integral Pixel>
PostProcessor * openmsx::SDLRasterizer< Pixel >::getPostProcessor ( ) const
overridevirtual

See VDP::getPostProcessor().

Implements openmsx::Rasterizer.

Definition at line 112 of file SDLRasterizer.cc.

◆ isActive()

template<std::unsigned_integral Pixel>
bool openmsx::SDLRasterizer< Pixel >::isActive ( )
overridevirtual

Will the output of this Rasterizer be displayed? There is no point in producing a frame that will not be displayed.

TODO: Is querying the next pipeline step the best way to solve this, or is it better to explicitly disable the first step in the pipeline?

Implements openmsx::Rasterizer.

Definition at line 118 of file SDLRasterizer.cc.

◆ isRecording()

template<std::unsigned_integral Pixel>
bool openmsx::SDLRasterizer< Pixel >::isRecording ( ) const
overridevirtual

Is video recording active?

Implements openmsx::Rasterizer.

Definition at line 625 of file SDLRasterizer.cc.

◆ operator=()

template<std::unsigned_integral Pixel>
SDLRasterizer & openmsx::SDLRasterizer< Pixel >::operator= ( const SDLRasterizer< Pixel > &  )
delete

◆ reset()

template<std::unsigned_integral Pixel>
void openmsx::SDLRasterizer< Pixel >::reset ( )
overridevirtual

Resynchronize with VDP: all cached states are flushed.

Implements openmsx::Rasterizer.

Definition at line 126 of file SDLRasterizer.cc.

◆ setBackgroundColor()

template<std::unsigned_integral Pixel>
void openmsx::SDLRasterizer< Pixel >::setBackgroundColor ( int  index)
overridevirtual

Changes the background color.

Parameters
indexPalette index of the new background color.

Implements openmsx::Rasterizer.

Definition at line 207 of file SDLRasterizer.cc.

References openmsx::DisplayMode::GRAPHIC7.

◆ setBorderMask()

template<std::unsigned_integral Pixel>
void openmsx::SDLRasterizer< Pixel >::setBorderMask ( bool  masked)
overridevirtual

Implements openmsx::Rasterizer.

Definition at line 226 of file SDLRasterizer.cc.

◆ setDisplayMode()

template<std::unsigned_integral Pixel>
void openmsx::SDLRasterizer< Pixel >::setDisplayMode ( DisplayMode  mode)
overridevirtual

Precalc several values that depend on the display mode.

Parameters
modeThe new display mode.

Implements openmsx::Rasterizer.

Definition at line 177 of file SDLRasterizer.cc.

References openmsx::DisplayMode::getByte(), openmsx::DisplayMode::GRAPHIC7, and openmsx::DisplayMode::isBitmapMode().

◆ setHorizontalAdjust()

template<std::unsigned_integral Pixel>
void openmsx::SDLRasterizer< Pixel >::setHorizontalAdjust ( int  adjust)
overridevirtual

Implements openmsx::Rasterizer.

Definition at line 216 of file SDLRasterizer.cc.

◆ setHorizontalScrollLow()

template<std::unsigned_integral Pixel>
void openmsx::SDLRasterizer< Pixel >::setHorizontalScrollLow ( byte  scroll)
overridevirtual

Implements openmsx::Rasterizer.

Definition at line 221 of file SDLRasterizer.cc.

◆ setPalette()

template<std::unsigned_integral Pixel>
void openmsx::SDLRasterizer< Pixel >::setPalette ( unsigned  index,
int  grb 
)
overridevirtual

Change an entry in the palette.

Parameters
indexThe index [0..15] in the palette that changes.
grbThe new definition for the changed palette index: bit 10..8 is green, bit 6..4 is red and bit 2..0 is blue; all other bits are zero.

Implements openmsx::Rasterizer.

Definition at line 193 of file SDLRasterizer.cc.

◆ setSuperimposeVideoFrame()

template<std::unsigned_integral Pixel>
void openmsx::SDLRasterizer< Pixel >::setSuperimposeVideoFrame ( const RawFrame videoSource)
overridevirtual

Implements openmsx::Rasterizer.

Definition at line 147 of file SDLRasterizer.cc.

◆ setTransparency()

template<std::unsigned_integral Pixel>
void openmsx::SDLRasterizer< Pixel >::setTransparency ( bool  enabled)
overridevirtual

Implements openmsx::Rasterizer.

Definition at line 231 of file SDLRasterizer.cc.


The documentation for this class was generated from the following files: