ScummVM API documentation
Wintermute::BaseRenderOSystem Class Reference

#include <base_render_osystem.h>

Inheritance diagram for Wintermute::BaseRenderOSystem:
Wintermute::BaseRenderer Wintermute::BaseClass

Public Types

typedef Common::List< RenderTicket * >::iterator RenderQueueIterator
 

Public Member Functions

 BaseRenderOSystem (BaseGame *inGame)
 
Common::String getName () const override
 
bool initRenderer (int width, int height, bool windowed) override
 
bool flip () override
 
bool indicatorFlip (int32 x, int32 y, int32 width, int32 height) override
 
bool forcedFlip () override
 
bool clear () override
 
Graphics::PixelFormat getPixelFormat () const override
 
bool fade (uint16 alpha) override
 
bool fadeToColor (byte r, byte g, byte b, byte a) override
 
bool drawLine (int x1, int y1, int x2, int y2, uint32 color) override
 
bool fillRect (int x, int y, int w, int h, uint32 color) override
 
BaseImage * takeScreenshot (int newWidth=0, int newHeight=0) override
 
void onWindowChange () override
 
void setWindowed (bool windowed) override
 
void invalidateTicket (RenderTicket *renderTicket)
 
void invalidateTicketsFromSurface (BaseSurfaceOSystem *surf)
 
void drawFromTicket (RenderTicket *renderTicket)
 
void drawFromQueuedTicket (const RenderQueueIterator &ticket)
 
bool setViewport (int left, int top, int right, int bottom) override
 
bool setViewport (Common::Rect32 *rect) override
 
void modTargetRect (Common::Rect *rect)
 
void pointFromScreen (Common::Point32 *point)
 
void pointToScreen (Common::Point32 *point)
 
float getScaleRatioX () const override
 
float getScaleRatioY () const override
 
bool startSpriteBatch () override
 
bool endSpriteBatch () override
 
void endSaveLoad () override
 
void drawSurface (BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, Graphics::TransformStruct &transform)
 
BaseSurface * createSurface () override
 
- Public Member Functions inherited from Wintermute::BaseRenderer
void dumpData (const char *filename)
 
virtual BaseImage * takeScreenshot (int newWidth=0, int newHeight=0)=0
 
virtual bool setViewport (int left, int top, int right, int bottom)
 
virtual bool setViewport (Common::Rect32 *rect)
 
virtual bool setScreenViewport ()
 
virtual void setWindowed (bool windowed)=0
 
virtual Graphics::PixelFormat getPixelFormat () const =0
 
virtual bool fade (uint16 alpha)=0
 
virtual bool fadeToColor (byte r, byte g, byte b, byte a)=0
 
virtual bool drawLine (int x1, int y1, int x2, int y2, uint32 color)
 
virtual bool drawRect (int x1, int y1, int x2, int y2, uint32 color, int width=1)
 
virtual bool fillRect (int x, int y, int w, int h, uint32 color)
 
 BaseRenderer (BaseGame *inGame=nullptr)
 
virtual bool setProjection ()
 
virtual bool windowedBlt ()
 
virtual bool clear ()=0
 
virtual void onWindowChange ()
 
virtual bool initRenderer (int width, int height, bool windowed)
 
virtual bool flip ()=0
 
virtual bool indicatorFlip (int32 x, int32 y, int32 width, int32 height)=0
 
virtual bool forcedFlip ()=0
 
virtual void initLoop ()
 
virtual bool setup2D (bool force=false)
 
virtual Common::String getName () const =0
 
virtual bool displayDebugInfo ()
 
virtual bool drawShaderQuad ()
 
virtual float getScaleRatioX () const
 
virtual float getScaleRatioY () const
 
virtual BaseSurface * createSurface ()=0
 
bool clipCursor ()
 
bool unclipCursor ()
 
BaseObject * getObjectAt (int x, int y)
 
void deleteRectList ()
 
virtual bool startSpriteBatch ()
 
virtual bool endSpriteBatch ()
 
bool pointInViewport (Common::Point32 *P)
 
bool isReady () const
 
bool isWindowed () const
 
int32 getBPP () const
 
int32 getWidth () const
 
int32 getHeight () const
 
virtual void endSaveLoad ()
 
- Public Member Functions inherited from Wintermute::BaseClass
bool setEditorProp (const Common::String &propName, const Common::String &propValue)
 
Common::String getEditorProp (const Common::String &propName, const Common::String &initVal=Common::String())
 
 BaseClass (TDynamicConstructor, TDynamicConstructor)
 
bool parseEditorProperty (char *buffer, bool complete=true)
 
virtual bool saveAsText (BaseDynamicBuffer *buffer, int indent=0)
 
 BaseClass (BaseGame *gameOwner)
 
virtual const char * getClassName ()
 
virtual bool persist (BasePersistenceManager *persistMgr)
 

Additional Inherited Members

- Public Attributes inherited from Wintermute::BaseRenderer
int _realWidth
 
int _realHeight
 
int _drawOffsetX
 
int _drawOffsetY
 
uint32 _forceAlphaColor
 
uint32 _window
 
uint32 _clipperWindow
 
bool _active
 
bool _ready
 
bool _windowed
 
Common::Rect32 _windowRect
 
Common::Rect32 _viewportRect
 
Common::Rect32 _screenRect
 
Common::Rect32 _monitorRect
 
int32 _bPP
 
int32 _height
 
int32 _width
 
BaseArray< BaseActiveRect * > _rectList
 
- Public Attributes inherited from Wintermute::BaseClass
bool _persistable
 
BaseGame * _game
 
Common::HashMap< Common::String, Common::String > _editorProps
 
Common::HashMap< Common::String, Common::String >::iterator _editorPropsIter
 

Detailed Description

A 2D-renderer implementation for WME. This renderer makes use of a "ticket"-system, where all draw-calls are stored as tickets until flip() is called, and compared against the tickets from last frame, to determine which calls were the same as last round (i.e. in the exact same order, with the exact same arguments), and thus figure out which parts of the screen need to be redrawn.

Important concepts to handle here, is the ordered number of any ticket which is called the "drawNum", every frame this starts from scratch, and then the incoming tickets created from the draw-calls are checked to see whether they came before, on, or after the drawNum they had last frame. Everything else being equal, this information is then used to check whether the draw order changed, which will then create a need for redrawing, as we draw with an alpha-channel here.

There is also a draw path that draws without tickets, for debugging purposes, as well as to accommodate situations with large enough amounts of draw calls, that there will be too much overhead involved with comparing the generated tickets.

Member Function Documentation

◆ getName()

Common::String Wintermute::BaseRenderOSystem::getName ( ) const
overridevirtual

Get the name of the current renderer

Returns
the name of the renderer.

Implements Wintermute::BaseRenderer.

◆ initRenderer()

bool Wintermute::BaseRenderOSystem::initRenderer ( int  width,
int  height,
bool  windowed 
)
overridevirtual

Reimplemented from Wintermute::BaseRenderer.

◆ flip()

bool Wintermute::BaseRenderOSystem::flip ( )
overridevirtual

Flip the backbuffer onto the screen-buffer The screen will NOT be updated before calling this function.

Returns
true if successful, false on error.

Implements Wintermute::BaseRenderer.

◆ indicatorFlip()

bool Wintermute::BaseRenderOSystem::indicatorFlip ( int32  x,
int32  y,
int32  width,
int32  height 
)
overridevirtual

Special flip for the indicator drawn during save/load essentially, just copies the region defined by the indicator rectangle.

Implements Wintermute::BaseRenderer.

◆ forcedFlip()

bool Wintermute::BaseRenderOSystem::forcedFlip ( )
overridevirtual

◆ clear()

bool Wintermute::BaseRenderOSystem::clear ( )
overridevirtual

Clear the screen

Implements Wintermute::BaseRenderer.

◆ getPixelFormat()

Graphics::PixelFormat Wintermute::BaseRenderOSystem::getPixelFormat ( ) const
overridevirtual

◆ fade()

bool Wintermute::BaseRenderOSystem::fade ( uint16  alpha)
overridevirtual

Fade the screen to black

Parameters
alphaamount to fade by (alpha value of black)

Implements Wintermute::BaseRenderer.

◆ fadeToColor()

bool Wintermute::BaseRenderOSystem::fadeToColor ( byte  r,
byte  g,
byte  b,
byte  a 
)
overridevirtual

Fade a portion of the screen to a specific color

Parameters
rthe red component to fade too.
gthe green component to fade too.
bthe blue component to fade too.
athe alpha component to fade too.
rectthe portion of the screen to fade (if nullptr, the entire screen will be faded).

Implements Wintermute::BaseRenderer.

◆ drawLine()

bool Wintermute::BaseRenderOSystem::drawLine ( int  x1,
int  y1,
int  x2,
int  y2,
uint32  color 
)
overridevirtual

Reimplemented from Wintermute::BaseRenderer.

◆ fillRect()

bool Wintermute::BaseRenderOSystem::fillRect ( int  x,
int  y,
int  w,
int  h,
uint32  color 
)
overridevirtual

Reimplemented from Wintermute::BaseRenderer.

◆ takeScreenshot()

BaseImage * Wintermute::BaseRenderOSystem::takeScreenshot ( int  newWidth = 0,
int  newHeight = 0 
)
overridevirtual

Take a screenshot of the current screenstate

Returns
a BaseImage containing the current screen-buffer.

Implements Wintermute::BaseRenderer.

◆ onWindowChange()

void Wintermute::BaseRenderOSystem::onWindowChange ( )
overridevirtual

Reimplemented from Wintermute::BaseRenderer.

◆ setWindowed()

void Wintermute::BaseRenderOSystem::setWindowed ( bool  windowed)
overridevirtual

◆ drawFromTicket()

void Wintermute::BaseRenderOSystem::drawFromTicket ( RenderTicket *  renderTicket)

Insert a new ticket into the queue, adding a dirty rect

Parameters
renderTicketthe ticket to be added.

◆ drawFromQueuedTicket()

void Wintermute::BaseRenderOSystem::drawFromQueuedTicket ( const RenderQueueIterator &  ticket)

Re-insert an existing ticket into the queue, adding a dirty rect out-of-order from last draw from the ticket.

Parameters
ticketiterator pointing to the ticket to be added.

◆ setViewport() [1/2]

bool Wintermute::BaseRenderOSystem::setViewport ( int  left,
int  top,
int  right,
int  bottom 
)
overridevirtual

Reimplemented from Wintermute::BaseRenderer.

◆ setViewport() [2/2]

bool Wintermute::BaseRenderOSystem::setViewport ( Common::Rect32 *  rect)
inlineoverridevirtual

Reimplemented from Wintermute::BaseRenderer.

◆ getScaleRatioX()

float Wintermute::BaseRenderOSystem::getScaleRatioX ( ) const
inlineoverridevirtual

Reimplemented from Wintermute::BaseRenderer.

◆ getScaleRatioY()

float Wintermute::BaseRenderOSystem::getScaleRatioY ( ) const
inlineoverridevirtual

Reimplemented from Wintermute::BaseRenderer.

◆ startSpriteBatch()

bool Wintermute::BaseRenderOSystem::startSpriteBatch ( )
overridevirtual

Reimplemented from Wintermute::BaseRenderer.

◆ endSpriteBatch()

bool Wintermute::BaseRenderOSystem::endSpriteBatch ( )
overridevirtual

Reimplemented from Wintermute::BaseRenderer.

◆ endSaveLoad()

void Wintermute::BaseRenderOSystem::endSaveLoad ( )
overridevirtual

Reimplemented from Wintermute::BaseRenderer.

◆ createSurface()

BaseSurface * Wintermute::BaseRenderOSystem::createSurface ( )
overridevirtual

Create a Surface fit for use with the renderer. As diverse implementations of BaseRenderer might have different solutions for storing surfaces this allows for a common interface for creating surface-handles. (Mostly useful to ease future implementation of hw-accelerated rendering, or readding 3D-support at some point).

Returns
a surface that can be used with this renderer

Implements Wintermute::BaseRenderer.


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