openMSX
Public Member Functions | Protected Member Functions | List of all members
openmsx::SDLOutputSurface Class Reference

A frame buffer where pixels can be written to. More...

#include <SDLOutputSurface.hh>

Inheritance diagram for openmsx::SDLOutputSurface:
Inheritance graph
[legend]
Collaboration diagram for openmsx::SDLOutputSurface:
Collaboration graph
[legend]

Public Member Functions

 SDLOutputSurface (const SDLOutputSurface &)=delete
 
SDLOutputSurfaceoperator= (const SDLOutputSurface &)=delete
 
SDL_Surface * getSDLSurface () const
 
SDL_Renderer * getSDLRenderer () const
 
SDLDirectPixelAccess getDirectPixelAccess ()
 Return a SDLDirectPixelAccess object. More...
 
virtual void flushFrameBuffer ()
 Copy frame buffer to display buffer. More...
 
virtual void clearScreen ()
 Clear frame buffer (paint it black). More...
 
- Public Member Functions inherited from openmsx::OutputSurface
 OutputSurface (const OutputSurface &)=delete
 
OutputSurfaceoperator= (const OutputSurface &)=delete
 
virtual ~OutputSurface ()=default
 
int getLogicalWidth () const
 
int getLogicalHeight () const
 
gl::ivec2 getLogicalSize () const
 
gl::ivec2 getPhysicalSize () const
 
gl::ivec2 getViewOffset () const
 
gl::ivec2 getViewSize () const
 
gl::vec2 getViewScale () const
 
bool isViewScaled () const
 
const PixelFormatgetPixelFormat () const
 
uint32_t mapRGB (gl::vec3 rgb) const
 Returns the pixel value for the given RGB color. More...
 
uint32_t mapRGB255 (gl::ivec3 rgb) const
 Same as mapRGB, but RGB components are in range [0..255]. More...
 
template<std::unsigned_integral Pixel>
Pixel getKeyColor () const
 Returns the color key for this output surface. More...
 
template<std::unsigned_integral Pixel>
Pixel getKeyColorClash () const
 Returns a color that is visually very close to the key color. More...
 
template<std::unsigned_integral Pixel>
Pixel mapKeyedRGB255 (gl::ivec3 rgb)
 Returns the pixel value for the given RGB color. More...
 
template<std::unsigned_integral Pixel>
Pixel mapKeyedRGB (gl::vec3 rgb)
 Returns the pixel value for the given RGB color. More...
 
virtual void saveScreenshot (const std::string &filename)=0
 Save the content of this OutputSurface to a PNG file. More...
 

Protected Member Functions

 SDLOutputSurface ()=default
 
void setSDLPixelFormat (const SDL_PixelFormat &format)
 
void setSDLSurface (SDL_Surface *surface_)
 
void setSDLRenderer (SDL_Renderer *r)
 
- Protected Member Functions inherited from openmsx::OutputSurface
 OutputSurface ()=default
 
void calculateViewPort (gl::ivec2 logSize, gl::ivec2 physSize)
 
void setPixelFormat (const PixelFormat &format)
 
void setOpenGlPixelFormat ()
 

Detailed Description

A frame buffer where pixels can be written to.

It could be an in-memory buffer or a video buffer visible to the user (see VisibleSurface subclass).

Definition at line 32 of file SDLOutputSurface.hh.

Constructor & Destructor Documentation

◆ SDLOutputSurface() [1/2]

openmsx::SDLOutputSurface::SDLOutputSurface ( const SDLOutputSurface )
delete

◆ SDLOutputSurface() [2/2]

openmsx::SDLOutputSurface::SDLOutputSurface ( )
protecteddefault

Member Function Documentation

◆ clearScreen()

virtual void openmsx::SDLOutputSurface::clearScreen ( )
inlinevirtual

Clear frame buffer (paint it black).

The default implementation does nothing.

Reimplemented in openmsx::SDLVisibleSurface.

Definition at line 65 of file SDLOutputSurface.hh.

◆ flushFrameBuffer()

virtual void openmsx::SDLOutputSurface::flushFrameBuffer ( )
inlinevirtual

Copy frame buffer to display buffer.

The default implementation does nothing.

Reimplemented in openmsx::SDLVisibleSurface.

Definition at line 60 of file SDLOutputSurface.hh.

◆ getDirectPixelAccess()

SDLDirectPixelAccess openmsx::SDLOutputSurface::getDirectPixelAccess ( )
inline

Return a SDLDirectPixelAccess object.

Via this object pointers to individual Pixel lines can be obtained. Those pointer only remain valid for as long as the SDLDirectPixelAccess object is kept alive. And that object should be kept for at most the duration of one frame. (This allows the implementation to lock/unlock the underlying SDL surface).

Note that direct pixel access is not always supported (e.g. not for openGL based surfaces). TODO can we move this method down the class hierarchy so that it's only available on classes that do support it?

Definition at line 52 of file SDLOutputSurface.hh.

References getSDLSurface().

Referenced by openmsx::DirectScalerOutput< Pixel >::frameStart().

◆ getSDLRenderer()

SDL_Renderer * openmsx::SDLOutputSurface::getSDLRenderer ( ) const
inline

◆ getSDLSurface()

SDL_Surface * openmsx::SDLOutputSurface::getSDLSurface ( ) const
inline

Definition at line 38 of file SDLOutputSurface.hh.

Referenced by getDirectPixelAccess().

◆ operator=()

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

◆ setSDLPixelFormat()

void openmsx::SDLOutputSurface::setSDLPixelFormat ( const SDL_PixelFormat &  format)
protected

◆ setSDLRenderer()

void openmsx::SDLOutputSurface::setSDLRenderer ( SDL_Renderer *  r)
inlineprotected

◆ setSDLSurface()

void openmsx::SDLOutputSurface::setSDLSurface ( SDL_Surface *  surface_)
inlineprotected

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