Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CEGUI::RenderCache Class Reference

Class that acts as a cache for images that need to be rendered. More...

#include <CEGUIRenderCache.h>

List of all members.

Public Member Functions

 RenderCache ()
 Constructor.
 ~RenderCache ()
 Destructor.
bool hasCachedImagery () const
 Return whether the cache contains anything to draw.
void render (const Point &basePos, float baseZ, const Rect &clipper) const
 Send the contents of the cache to the Renderer.
void clearCachedImagery ()
 Erase any stored image information.
void cacheImage (const Image &image, const Rect &destArea, float zOffset, const ColourRect &cols, const Rect *clipper=0, bool clipToDisplay=false)
 Add an image to the cache.
void cacheText (const String &text, const Font *font, TextFormatting format, const Rect &destArea, float zOffset, const ColourRect &cols, const Rect *clipper=0, bool clipToDisplay=false)
 Add a text to the cache.

Classes

struct  ImageInfo
 internal struct that holds info about a single image to be drawn.
struct  TextInfo
 internal struct that holds info about text to be drawn.


Detailed Description

Class that acts as a cache for images that need to be rendered.

This is in many ways an optimisation cache, it allows a full image redraw to occur while limiting the amount of information that needs to be re-calculated.

Basically, unless the actual images (or their size) change, or the colours (or alpha) change then imagery cached in here will suffice for a full redraw. The reasoning behind this is that when some window underneath window 'X' changes, a full image redraw is required by the renderer, however, since window 'X' is unchanged, performing a total recalculation of all imagery is very wasteful, and so we use this cache to limit such waste.
As another example, when a window is simply moved, there is no need to perform a total imagery recalculation; we can still use the imagery cached here since it is position independant.

Definition at line 59 of file CEGUIRenderCache.h.


Constructor & Destructor Documentation

CEGUI::RenderCache::RenderCache  ) 
 

Constructor.

Definition at line 31 of file CEGUIRenderCache.cpp.

CEGUI::RenderCache::~RenderCache  ) 
 

Destructor.

Definition at line 34 of file CEGUIRenderCache.cpp.


Member Function Documentation

void CEGUI::RenderCache::cacheImage const Image image,
const Rect destArea,
float  zOffset,
const ColourRect cols,
const Rect clipper = 0,
bool  clipToDisplay = false
 

Add an image to the cache.

Parameters:
image Image object to be cached.
destArea Destination area over which the Image object will be rendered. This area should be position independant; so position (0,0) will be to top-left corner of whatever it is you're rendering (like a Window for example).
zOffset Zero based z offset for this image. Allows imagery to be layered.
cols ColourRect object describing the colours to be applied when rendering this image.
Returns:
Nothing

Definition at line 97 of file CEGUIRenderCache.cpp.

Referenced by CEGUI::MultiLineEditbox::cacheTextLines(), CEGUI::FrameComponent::doBackgroundRender(), CEGUI::ListboxTextItem::draw(), CEGUI::RenderableImage::draw_impl(), CEGUI::RenderableFrame::draw_impl(), CEGUI::Static::populateRenderCache(), CEGUI::ImageryComponent::render_impl(), and CEGUI::FrameComponent::render_impl().

void CEGUI::RenderCache::cacheText const String text,
const Font font,
TextFormatting  format,
const Rect destArea,
float  zOffset,
const ColourRect cols,
const Rect clipper = 0,
bool  clipToDisplay = false
 

Add a text to the cache.

Parameters:
text String object to be cached.
font Font to be used when rendering.
format TextFormatting value specifying the formatting to use when rendering.
destArea Destination area over which the Image object will be rendered. This area should be position independant; so position (0,0) will be to top-left corner of whatever it is you're rendering (like a Window for example).
zOffset Zero based z offset for this image. Allows imagery to be layered.
cols ColourRect object describing the colours to be applied when rendering this image.
Returns:
Nothing

Definition at line 119 of file CEGUIRenderCache.cpp.

Referenced by CEGUI::MultiLineEditbox::cacheTextLines(), CEGUI::ListboxTextItem::draw(), CEGUI::TextItem::populateRenderCache(), CEGUI::StaticText::populateRenderCache(), and CEGUI::TextComponent::render_impl().

void CEGUI::RenderCache::clearCachedImagery  ) 
 

Erase any stored image information.

Definition at line 91 of file CEGUIRenderCache.cpp.

Referenced by CEGUI::Window::drawSelf().

bool CEGUI::RenderCache::hasCachedImagery  )  const
 

Return whether the cache contains anything to draw.

Returns:
  • true if the cache contains information about images to be drawn.
  • false if the cache is empty.

Definition at line 37 of file CEGUIRenderCache.cpp.

Referenced by CEGUI::Window::drawSelf().

void CEGUI::RenderCache::render const Point basePos,
float  baseZ,
const Rect clipper
const
 

Send the contents of the cache to the Renderer.

Parameters:
basePos Point that describes a screen offset that cached imagery will be rendered relative to.
baseZ Z value that cached imagery will use as a base figure when calculating final z values.
clipper Rect object describing a rect to which imagery will be clipped.
Returns:
Nothing

Definition at line 42 of file CEGUIRenderCache.cpp.

References CEGUI::Rect::getIntersection(), CEGUI::System::getSingleton(), and CEGUI::Rect::offset().

Referenced by CEGUI::Window::drawSelf().


The documentation for this class was generated from the following files:
Generated on Wed Sep 7 10:06:53 2005 for Crazy Eddies GUI System by  doxygen 1.4.3