ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Wintermute::BaseRenderOSystem Class Reference

A 2D-renderer implementation for WME. More...

#include <base_render_osystem.h>

Inheritance diagram for Wintermute::BaseRenderOSystem:
Collaboration diagram for Wintermute::BaseRenderOSystem:

List of all members.

Public Types

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

Public Member Functions

 BaseRenderOSystem (BaseGame *inGame)
 ~BaseRenderOSystem () override
Common::String getName () const override
 Get the name of the current renderer.
bool initRenderer (int width, int height, bool windowed) override
bool flip () override
 Flip the backbuffer onto the screen-buffer The screen will NOT be updated before calling this function.
bool indicatorFlip () override
 Special flip for the indicator drawn during save/load essentially, just copies the region defined by the _indicator-variables.
bool forcedFlip () override
bool fill (byte r, byte g, byte b, Common::Rect *rect=nullptr) override
 Fill a portion of the screen with a specified color.
Graphics::PixelFormat getPixelFormat () const override
void fade (uint16 alpha) override
 Fade the screen to black.
void fadeToColor (byte r, byte g, byte b, byte a) override
 Fade a portion of the screen to a specific color.
bool drawLine (int x1, int y1, int x2, int y2, uint32 color) override
BaseImagetakeScreenshot () override
 Take a screenshot of the current screenstate.
void onWindowChange () override
void setWindowed (bool windowed) override
void invalidateTicket (RenderTicket *renderTicket)
void invalidateTicketsFromSurface (BaseSurfaceOSystem *surf)
void drawFromTicket (RenderTicket *renderTicket)
 Insert a new ticket into the queue, adding a dirty rect.
void 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.
bool setViewport (int left, int top, int right, int bottom) override
bool setViewport (Rect32 *rect) override
Rect32 getViewPort () override
void modTargetRect (Common::Rect *rect)
void pointFromScreen (Point32 *point)
void pointToScreen (Point32 *point)
void dumpData (const char *filename) override
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)
BaseSurfacecreateSurface () override
 Create a Surface fit for use with the renderer.

Private Member Functions

void addDirtyRect (const Common::Rect &rect)
 Mark a specified rect of the screen as dirty.
void drawTickets ()
 Traverse the tickets that are dirty, and draw them.
void drawFromSurface (RenderTicket *ticket)
void drawFromSurface (RenderTicket *ticket, Common::Rect *dstRect, Common::Rect *clipRect)

Private Attributes

Common::Rect_dirtyRect
Common::List< RenderTicket * > _renderQueue
bool _needsFlip
RenderQueueIterator _lastFrameIter
Common::Rect _renderRect
Graphics::Surface_renderSurface
Graphics::Surface_blankSurface
int _borderLeft
int _borderTop
int _borderRight
int _borderBottom
bool _disableDirtyRects
float _ratioX
float _ratioY
uint32 _clearColor
bool _skipThisFrame
int _lastScreenChangeID

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 accomodate situations with large enough amounts of draw calls, that there will be too much overhead involved with comparing the generated tickets.

Definition at line 60 of file base_render_osystem.h.


Member Typedef Documentation


Constructor & Destructor Documentation

Wintermute::BaseRenderOSystem::BaseRenderOSystem ( BaseGame inGame  ) 

Definition at line 51 of file base_render_osystem.cpp.

Wintermute::BaseRenderOSystem::~BaseRenderOSystem (  )  [override]

Definition at line 70 of file base_render_osystem.cpp.


Member Function Documentation

void Wintermute::BaseRenderOSystem::addDirtyRect ( const Common::Rect rect  )  [private]

Mark a specified rect of the screen as dirty.

Parameters:
rect the region to be marked as dirty

Definition at line 388 of file base_render_osystem.cpp.

BaseSurface * Wintermute::BaseRenderOSystem::createSurface (  )  [override, virtual]

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 usefull 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.

Definition at line 581 of file base_render_osystem.cpp.

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:
ticket iterator pointing to the ticket to be added.

Definition at line 371 of file base_render_osystem.cpp.

void Wintermute::BaseRenderOSystem::drawFromSurface ( RenderTicket ticket  )  [private]

Definition at line 477 of file base_render_osystem.cpp.

void Wintermute::BaseRenderOSystem::drawFromSurface ( RenderTicket ticket,
Common::Rect dstRect,
Common::Rect clipRect 
) [private]

Definition at line 481 of file base_render_osystem.cpp.

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

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

Parameters:
renderTicket the ticket to be added.

Definition at line 352 of file base_render_osystem.cpp.

bool Wintermute::BaseRenderOSystem::drawLine ( int  x1,
int  y1,
int  x2,
int  y2,
uint32  color 
) [override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 486 of file base_render_osystem.cpp.

void Wintermute::BaseRenderOSystem::drawSurface ( BaseSurfaceOSystem owner,
const Graphics::Surface surf,
Common::Rect srcRect,
Common::Rect dstRect,
Graphics::TransformStruct transform 
)

Definition at line 292 of file base_render_osystem.cpp.

void Wintermute::BaseRenderOSystem::drawTickets (  )  [private]

Traverse the tickets that are dirty, and draw them.

Definition at line 397 of file base_render_osystem.cpp.

void Wintermute::BaseRenderOSystem::dumpData ( const char *  filename  )  [override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 577 of file base_render_osystem.cpp.

void Wintermute::BaseRenderOSystem::endSaveLoad (  )  [override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 585 of file base_render_osystem.cpp.

bool Wintermute::BaseRenderOSystem::endSpriteBatch (  )  [override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 609 of file base_render_osystem.cpp.

void Wintermute::BaseRenderOSystem::fade ( uint16  alpha  )  [override, virtual]

Fade the screen to black.

Parameters:
alpha amount to fade by (alpha value of black)

Implements Wintermute::BaseRenderer.

Definition at line 252 of file base_render_osystem.cpp.

void Wintermute::BaseRenderOSystem::fadeToColor ( byte  r,
byte  g,
byte  b,
byte  a 
) [override, virtual]

Fade a portion of the screen to a specific color.

Parameters:
r the red component to fade too.
g the green component to fade too.
b the blue component to fade too.
a the alpha component to fade too.
rect the portion of the screen to fade (if nullptr, the entire screen will be faded).

Implements Wintermute::BaseRenderer.

Definition at line 258 of file base_render_osystem.cpp.

bool Wintermute::BaseRenderOSystem::fill ( byte  r,
byte  g,
byte  b,
Common::Rect rect = nullptr 
) [override, virtual]

Fill a portion of the screen with a specified color.

Parameters:
r the red component to fill with.
g the green component to fill with.
b the blue component to fill with.

Implements Wintermute::BaseRenderer.

Definition at line 231 of file base_render_osystem.cpp.

bool Wintermute::BaseRenderOSystem::flip (  )  [override, virtual]

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

Returns:
true if successfull, false on error.

Implements Wintermute::BaseRenderer.

Definition at line 162 of file base_render_osystem.cpp.

bool Wintermute::BaseRenderOSystem::forcedFlip (  )  [override, virtual]

Implements Wintermute::BaseRenderer.

Definition at line 156 of file base_render_osystem.cpp.

Common::String Wintermute::BaseRenderOSystem::getName (  )  const [override, virtual]

Get the name of the current renderer.

Returns:
the name of the renderer.

Implements Wintermute::BaseRenderer.

Definition at line 526 of file base_render_osystem.cpp.

Graphics::PixelFormat Wintermute::BaseRenderOSystem::getPixelFormat (  )  const [override, virtual]

Implements Wintermute::BaseRenderer.

Definition at line 288 of file base_render_osystem.cpp.

float Wintermute::BaseRenderOSystem::getScaleRatioX (  )  const [inline, override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 107 of file base_render_osystem.h.

float Wintermute::BaseRenderOSystem::getScaleRatioY (  )  const [inline, override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 110 of file base_render_osystem.h.

Rect32 Wintermute::BaseRenderOSystem::getViewPort (  )  [override, virtual]

Implements Wintermute::BaseRenderer.

Definition at line 543 of file base_render_osystem.cpp.

bool Wintermute::BaseRenderOSystem::indicatorFlip (  )  [override, virtual]

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

Implements Wintermute::BaseRenderer.

Definition at line 148 of file base_render_osystem.cpp.

bool Wintermute::BaseRenderOSystem::initRenderer ( int  width,
int  height,
bool  windowed 
) [override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 87 of file base_render_osystem.cpp.

void Wintermute::BaseRenderOSystem::invalidateTicket ( RenderTicket renderTicket  ) 

Definition at line 337 of file base_render_osystem.cpp.

void Wintermute::BaseRenderOSystem::invalidateTicketsFromSurface ( BaseSurfaceOSystem surf  ) 

Definition at line 343 of file base_render_osystem.cpp.

void Wintermute::BaseRenderOSystem::modTargetRect ( Common::Rect rect  ) 

Definition at line 553 of file base_render_osystem.cpp.

void Wintermute::BaseRenderOSystem::onWindowChange (  )  [override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 218 of file base_render_osystem.cpp.

void Wintermute::BaseRenderOSystem::pointFromScreen ( Point32 point  ) 

Definition at line 564 of file base_render_osystem.cpp.

void Wintermute::BaseRenderOSystem::pointToScreen ( Point32 point  ) 

Definition at line 571 of file base_render_osystem.cpp.

bool Wintermute::BaseRenderOSystem::setViewport ( int  left,
int  top,
int  right,
int  bottom 
) [override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 531 of file base_render_osystem.cpp.

bool Wintermute::BaseRenderOSystem::setViewport ( Rect32 rect  )  [inline, override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 99 of file base_render_osystem.h.

void Wintermute::BaseRenderOSystem::setWindowed ( bool  windowed  )  [override, virtual]

Implements Wintermute::BaseRenderer.

Definition at line 223 of file base_render_osystem.cpp.

bool Wintermute::BaseRenderOSystem::startSpriteBatch (  )  [override, virtual]

Reimplemented from Wintermute::BaseRenderer.

Definition at line 605 of file base_render_osystem.cpp.

BaseImage * Wintermute::BaseRenderOSystem::takeScreenshot (  )  [override, virtual]

Take a screenshot of the current screenstate.

Returns:
a BaseImage containing the current screen-buffer.

Implements Wintermute::BaseRenderer.

Definition at line 518 of file base_render_osystem.cpp.


Member Data Documentation

Definition at line 144 of file base_render_osystem.h.

Definition at line 141 of file base_render_osystem.h.

Definition at line 143 of file base_render_osystem.h.

Definition at line 142 of file base_render_osystem.h.

Definition at line 135 of file base_render_osystem.h.

Definition at line 147 of file base_render_osystem.h.

Definition at line 148 of file base_render_osystem.h.

Definition at line 151 of file base_render_osystem.h.


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


Generated on Sat Sep 26 2020 05:04:13 for ResidualVM by doxygen 1.7.1
curved edge   curved edge