MvcBufferedViewport Class

class MvcBufferedViewport: public MvcViewport

A viewport that supports offscreen buffering of window output to improve performance and reduce screen flicker.

Defined in: MvcBufferedVp.h

MvcBufferedViewport()

Constructor.

virtual ~MvcBufferedViewport()

Destructor.

void EnableBuffering(const BOOL bEnableBuffering)

Enable or disable use of the offscreen buffer.

CDC* GetBufferDC()

Get pointer to offscreen buffer device context.

void SetPalette(CPalette *pPal)

Set the palette to use for drawing.

virtual void Draw(CDC* pDC)

Draws the entire diagram to a device context.

virtual void DrawRect(CDC* pDC, const CRect &rcUpdate)

Draw a rectangular area of the viewport to a device context.

void DrawOffscreen()

Draw the entire diagram to the offscreen buffer.

void DrawOffscreen(const CRect &rcUpdate)

Draw a rectangular area of the viewport to the offscreen buffer.

void Refresh(CDC* pDC)

Transfers the entire offscreen buffer to a screen DC.

void Refresh(CDC* pDC, const CRect &rcUpdate)

Transfers a rectangular area of the offscreen buffer to a screen DC.

void SetBufferPadding(const int nBufPadding)

Set padding added to offscreen buffer to reduce reallocation when

virtual void OnInitialUpdate()

Initializes the viewport.

virtual CSize SetSize(int cx, int cy)

Set the width and height of the viewport in device units. Reallocates

virtual CPoint SetLogOrigin(int x, int y)

Set the origin in logical units (i.e. scroll position)

virtual CSize SetLogExtents(int cx, int cy)

Set the size of the visual part in logical units

CSize SetLogExtents(const CSize& sizeLog)

Set the size of the visual part in logical units

virtual CRect Pan(int xOff,int yOff)

Moves the logical rectangle by the specified deltas

BOOL CreateOffscreenBuffer()

Creates memory DC and bitmap for offscreen buffer.

BOOL NeedToResizeBuffer()

Compares the current buffer size to the viewport extent.

void DestroyOffscreenBuffer()

Deletes the bitmap and memory DC.

virtual BOOL CreateOffscreenDC()

Creates the DC to be used for the offscreen buffer.

Class Members

Protected members

BOOL m_bEnableBuffering

Turn screen buffering on or off

CDC* m_pBufferDC

Memory DC for offscreen buffer

CBitmap* m_pBufferBmp

Bitmap that is selected into offscreen DC

CPalette* m_pBufferPal

Palette used for offscreen buffer

HBITMAP m_hPrevBufferBmp

For restoring buffer DC

HPALETTE m_hPrevBufferPal

For restoring buffer DC

BOOL m_bForceDraw

Flag to force a redraw when the next Refresh occurs

int m_nBufPadding

Extra width and height added to buffer to reduce reallocation.