1 #include "FirstUiBuilder.h"
2 #include "UIDirectDrawOffscreenCanvas.h"
4 UIDirectDrawOffscreenCanvas::UIDirectDrawOffscreenCanvas( const UISize
&Size
) : UIDirectDrawCanvas( Size
)
8 UIDirectDrawOffscreenCanvas::~UIDirectDrawOffscreenCanvas()
12 bool UIDirectDrawOffscreenCanvas::IsA( const UITypeID Type
) const
14 return (Type
== TUIDirectDrawOffscreenCanvas
) || UIDirectDrawCanvas::IsA( Type
);
17 bool UIDirectDrawOffscreenCanvas::Generate( void ) const
21 LPDIRECTDRAWSURFACE7 CreatedSurface
;
22 DDSURFACEDESC2 ddsd
= { sizeof( ddsd
) };
25 ddsd
.dwFlags
= DDSD_CAPS
| DDSD_WIDTH
| DDSD_HEIGHT
;
26 ddsd
.dwWidth
= mSize
.x
;
27 ddsd
.dwHeight
= mSize
.y
;
29 ddsd
.ddsCaps
.dwCaps
= DDSCAPS_OFFSCREENPLAIN
;
30 ddsd
.ddsCaps
.dwCaps2
= 0;
32 hr
= gDirectDraw
->CreateSurface( &ddsd
, &CreatedSurface
, 0 );
37 const_cast<UIDirectDrawOffscreenCanvas
*>( this )->SetSurface( CreatedSurface
);
39 else if( mSurface
->IsLost() )
41 if( FAILED( mSurface
->Restore() ) )
45 return UICanvas::Generate();