openMSX
Public Types | Public Member Functions | List of all members
openmsx::SDLRasterizer Class 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:
Inheritance graph
[legend]
Collaboration diagram for openmsx::SDLRasterizer:
Collaboration graph
[legend]

Public Types

using Pixel = uint32_t
 

Public Member Functions

 SDLRasterizer (VDP &vdp, Display &display, OutputSurface &screen, std::unique_ptr< PostProcessor > postProcessor)
 
 SDLRasterizer (const SDLRasterizer &)=delete
 
 SDLRasterizer (SDLRasterizer &&)=delete
 
SDLRasterizeroperator= (const SDLRasterizer &)=delete
 
SDLRasterizeroperator= (SDLRasterizer &&)=delete
 
 ~SDLRasterizer () override
 
PostProcessorgetPostProcessor () const override
 See VDP::getPostProcessor().
 
bool isActive () override
 Will the output of this Rasterizer be displayed? There is no point in producing a frame that will not be displayed.
 
void reset () override
 Resynchronize with VDP: all cached states are flushed.
 
void frameStart (EmuTime::param time) override
 Indicates the start of a new frame.
 
void frameEnd () override
 Indicates the end of the current frame.
 
void setDisplayMode (DisplayMode mode) override
 Precalc several values that depend on the display mode.
 
void setPalette (unsigned index, int grb) override
 Change an entry in the palette.
 
void setBackgroundColor (byte index) override
 Changes the background color.
 
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.
 
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.
 
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.
 
bool isRecording () const override
 Is video recording active?
 
- Public Member Functions inherited from openmsx::Rasterizer
virtual ~Rasterizer ()=default
 

Additional Inherited Members

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

Detailed Description

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

Definition at line 28 of file SDLRasterizer.hh.

Member Typedef Documentation

◆ Pixel

Definition at line 32 of file SDLRasterizer.hh.

Constructor & Destructor Documentation

◆ SDLRasterizer() [1/3]

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

◆ SDLRasterizer() [2/3]

openmsx::SDLRasterizer::SDLRasterizer ( const SDLRasterizer )
delete

◆ SDLRasterizer() [3/3]

openmsx::SDLRasterizer::SDLRasterizer ( SDLRasterizer &&  )
delete

◆ ~SDLRasterizer()

openmsx::SDLRasterizer::~SDLRasterizer ( )
override

Member Function Documentation

◆ drawBorder()

void openmsx::SDLRasterizer::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 399 of file SDLRasterizer.cc.

References openmsx::MemoryOps::fill_2(), openmsx::VDP::getDisplayMode(), openmsx::DisplayMode::getLineWidth(), openmsx::VDP::TICKS_PER_LINE, and xrange().

◆ drawDisplay()

void openmsx::SDLRasterizer::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 435 of file SDLRasterizer.cc.

References openmsx::CharacterConverter::convertLine(), ranges::copy(), openmsx::VDP::getDisplayMode(), openmsx::VDP::getEvenOddMask(), openmsx::VDP::getHorizontalScrollHigh(), openmsx::VDP::getLeftBackground(), openmsx::DisplayMode::getLineWidth(), openmsx::VRAMWindow::getMask(), openmsx::DisplayMode::isBitmapMode(), openmsx::VDP::isMSX1VDP(), openmsx::VDP::isMultiPageScrolling(), openmsx::DisplayMode::isPlanar(), openmsx::DisplayMode::isTextMode(), openmsx::VDPVRAM::nameTable, subspan(), and xrange().

◆ drawSprites()

void openmsx::SDLRasterizer::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 564 of file SDLRasterizer.cc.

References openmsx::SpriteConverter::drawMode1(), openmsx::DisplayMode::getByte(), openmsx::VDP::getDisplayMode(), openmsx::VDP::getLeftSprites(), openmsx::DisplayMode::getLineWidth(), openmsx::DisplayMode::getSpriteMode(), openmsx::DisplayMode::GRAPHIC5, openmsx::DisplayMode::GRAPHIC6, and openmsx::VDP::isMSX1VDP().

◆ frameEnd()

void openmsx::SDLRasterizer::frameEnd ( )
overridevirtual

Indicates the end of the current frame.

The rasterizer can perform image post processing.

Implements openmsx::Rasterizer.

Definition at line 182 of file SDLRasterizer.cc.

◆ frameStart()

void openmsx::SDLRasterizer::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 166 of file SDLRasterizer.cc.

References openmsx::FrameSource::EVEN, openmsx::VDP::getEvenOdd(), openmsx::VDP::isInterlaced(), openmsx::VDP::isPalTiming(), openmsx::FrameSource::NONINTERLACED, and openmsx::FrameSource::ODD.

◆ getPostProcessor()

PostProcessor * openmsx::SDLRasterizer::getPostProcessor ( ) const
overridevirtual

See VDP::getPostProcessor().

Implements openmsx::Rasterizer.

Definition at line 128 of file SDLRasterizer.cc.

◆ isActive()

bool openmsx::SDLRasterizer::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 133 of file SDLRasterizer.cc.

References openmsx::MSXDevice::getMotherBoard(), openmsx::MSXMotherBoard::isActive(), and openmsx::MSXMotherBoard::isFastForwarding().

◆ isRecording()

bool openmsx::SDLRasterizer::isRecording ( ) const
overridevirtual

Is video recording active?

Implements openmsx::Rasterizer.

Definition at line 620 of file SDLRasterizer.cc.

◆ operator=() [1/2]

SDLRasterizer & openmsx::SDLRasterizer::operator= ( const SDLRasterizer )
delete

◆ operator=() [2/2]

SDLRasterizer & openmsx::SDLRasterizer::operator= ( SDLRasterizer &&  )
delete

◆ reset()

void openmsx::SDLRasterizer::reset ( )
overridevirtual

Resynchronize with VDP: all cached states are flushed.

Implements openmsx::Rasterizer.

Definition at line 140 of file SDLRasterizer.cc.

References openmsx::VDP::getDisplayMode(), openmsx::VDP::getTransparency(), setDisplayMode(), and openmsx::SpriteConverter::setTransparency().

◆ setBackgroundColor()

void openmsx::SDLRasterizer::setBackgroundColor ( byte  index)
overridevirtual

Changes the background color.

Parameters
indexPalette index of the new background color.

Implements openmsx::Rasterizer.

Definition at line 214 of file SDLRasterizer.cc.

References openmsx::DisplayMode::getByte(), openmsx::VDP::getDisplayMode(), openmsx::VDP::getTransparency(), openmsx::DisplayMode::GRAPHIC7, and openmsx::VDP::isSuperimposing().

◆ setBorderMask()

void openmsx::SDLRasterizer::setBorderMask ( bool  masked)
overridevirtual

Implements openmsx::Rasterizer.

Definition at line 230 of file SDLRasterizer.cc.

◆ setDisplayMode()

void openmsx::SDLRasterizer::setDisplayMode ( DisplayMode  mode)
overridevirtual

◆ setHorizontalAdjust()

void openmsx::SDLRasterizer::setHorizontalAdjust ( int  adjust)
overridevirtual

Implements openmsx::Rasterizer.

Definition at line 222 of file SDLRasterizer.cc.

◆ setHorizontalScrollLow()

void openmsx::SDLRasterizer::setHorizontalScrollLow ( byte  scroll)
overridevirtual

Implements openmsx::Rasterizer.

Definition at line 226 of file SDLRasterizer.cc.

◆ setPalette()

void openmsx::SDLRasterizer::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 201 of file SDLRasterizer.cc.

References openmsx::VDP::getBackgroundColor(), openmsx::VDP::getDisplayMode(), openmsx::VDP::getTransparency(), openmsx::VDP::isSuperimposing(), and openmsx::BitmapConverter::palette16Changed().

◆ setSuperimposeVideoFrame()

void openmsx::SDLRasterizer::setSuperimposeVideoFrame ( const RawFrame videoSource)
overridevirtual

◆ setTransparency()

void openmsx::SDLRasterizer::setTransparency ( bool  enabled)
overridevirtual

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