foobar2000 SDK  2015-01-14
Public Member Functions | Data Fields
CBackBuffer

#include <GDIUtils.h>

+ Inheritance diagram for CBackBuffer:

Public Member Functions

 CBackBuffer ()
 
 ~CBackBuffer ()
 
BOOL Allocate (CSize size, HDC dcCompatible=NULL)
 
void Attach (HBITMAP bmp, CSize size)
 
void Attach (HBITMAP bmp)
 
void Dispose ()
 
BOOL GetBitmapPtr (t_uint8 *&ptr, t_ssize &lineWidth)
 
CSize GetSize () const
 

Data Fields

PFC_CLASS_NOT_COPYABLE_EX(CBackBuffer) private CBitmap m_bitmap
 
HBITMAP m_bitmapOld
 

Detailed Description

Definition at line 156 of file GDIUtils.h.

Constructor & Destructor Documentation

CBackBuffer::CBackBuffer ( )
inline

Definition at line 158 of file GDIUtils.h.

158  : m_bitmapOld(NULL), m_curSize(0,0) {
159  CreateCompatibleDC(NULL);
160  ATLASSERT(m_hDC != NULL);
161  }
HBITMAP m_bitmapOld
Definition: GDIUtils.h:212
CBackBuffer::~CBackBuffer ( )
inline

Definition at line 162 of file GDIUtils.h.

162  {
163  Dispose();
164  }
void Dispose()
Definition: GDIUtils.h:191

Member Function Documentation

BOOL CBackBuffer::Allocate ( CSize  size,
HDC  dcCompatible = NULL 
)
inline

Definition at line 176 of file GDIUtils.h.

176  {
177  if (m_hDC == NULL) return FALSE;
178  if (m_curSize == size) return TRUE;
179  Dispose();
180  HBITMAP temp;
181  if (dcCompatible == NULL) {
182  temp = CreateDIB24(size);
183  } else {
184  temp = CreateCompatibleBitmap(dcCompatible, size.cx, size.cy);
185  }
186  if (temp == NULL) return FALSE;
187  Attach(temp);
188  return TRUE;
189  }
void Attach(HBITMAP bmp, CSize size)
Definition: GDIUtils.h:165
static HBITMAP CreateDIB24(CSize size)
Definition: GDIUtils.h:1
void Dispose()
Definition: GDIUtils.h:191
void CBackBuffer::Attach ( HBITMAP  bmp,
CSize  size 
)
inline

Definition at line 165 of file GDIUtils.h.

165  {
166  Dispose();
167  m_bitmap.Attach(bmp); m_curSize = size;
168  m_bitmapOld = SelectBitmap(m_bitmap);
169  }
PFC_CLASS_NOT_COPYABLE_EX(CBackBuffer) private CBitmap m_bitmap
Definition: GDIUtils.h:208
HBITMAP m_bitmapOld
Definition: GDIUtils.h:212
void Attach(HBITMAP bmp, CSize size)
Definition: GDIUtils.h:165
void Dispose()
Definition: GDIUtils.h:191
void CBackBuffer::Attach ( HBITMAP  bmp)
inline

Definition at line 170 of file GDIUtils.h.

170  {
171  CSize size;
172  bool state = CBitmapHandle(bmp).GetSize(size);
173  ATLASSERT(state);
174  Attach(bmp, size);
175  }
void Attach(HBITMAP bmp, CSize size)
Definition: GDIUtils.h:165
void CBackBuffer::Dispose ( )
inline

Definition at line 191 of file GDIUtils.h.

191  {
192  if (m_bitmap != NULL) {
193  SelectBitmap(m_bitmapOld); m_bitmapOld = NULL;
194  m_bitmap.DeleteObject();
195  }
196  m_curSize = CSize(0,0);
197  }
PFC_CLASS_NOT_COPYABLE_EX(CBackBuffer) private CBitmap m_bitmap
Definition: GDIUtils.h:208
HBITMAP m_bitmapOld
Definition: GDIUtils.h:212
BOOL CBackBuffer::GetBitmapPtr ( t_uint8 *&  ptr,
t_ssize lineWidth 
)
inline

Definition at line 198 of file GDIUtils.h.

198  {
199  if (m_bitmap == NULL) return FALSE;
200  BITMAP bmp = {};
201  if (!m_bitmap.GetBitmap(bmp)) return FALSE;
202  lineWidth = bmp.bmWidthBytes;
203  ptr = reinterpret_cast<t_uint8*>(bmp.bmBits);
204  return TRUE;
205  }
PFC_CLASS_NOT_COPYABLE_EX(CBackBuffer) private CBitmap m_bitmap
Definition: GDIUtils.h:208
uint8_t t_uint8
Definition: int_types.h:9
CSize CBackBuffer::GetSize ( ) const
inline

Definition at line 206 of file GDIUtils.h.

206 { return m_curSize; }

Field Documentation

PFC_CLASS_NOT_COPYABLE_EX (CBackBuffer) private CBitmap CBackBuffer::m_bitmap

Definition at line 208 of file GDIUtils.h.

HBITMAP CBackBuffer::m_bitmapOld

Definition at line 212 of file GDIUtils.h.


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