1 #include "FirstUiBuilder.h"
2 #include "UIDirectDrawPrimaryCanvas.h"
4 UIDirectDrawPrimaryCanvas::UIDirectDrawPrimaryCanvas( const UISize
&Size
, HWND NewWindow
) : UIDirectDrawCanvas( Size
)
9 UIDirectDrawPrimaryCanvas::~UIDirectDrawPrimaryCanvas()
13 bool UIDirectDrawPrimaryCanvas::IsA( const UITypeID Type
) const
15 return (Type
== TUIDirectDrawPrimaryCanvas
) || UIDirectDrawCanvas::IsA( Type
);
18 bool UIDirectDrawPrimaryCanvas::Generate( void ) const
22 LPDIRECTDRAWSURFACE7 CreatedSurface
;
23 LPDIRECTDRAWCLIPPER SurfaceClipper
;
24 DDSURFACEDESC2 ddsd
= { sizeof( ddsd
) };
27 ddsd
.dwFlags
= DDSD_CAPS
;
28 ddsd
.ddsCaps
.dwCaps
= DDSCAPS_PRIMARYSURFACE
;
30 hr
= gDirectDraw
->CreateSurface( &ddsd
, &CreatedSurface
, 0 );
35 hr
= gDirectDraw
->CreateClipper( 0, &SurfaceClipper
, 0 );
41 CreatedSurface
->Release();
45 hr
= SurfaceClipper
->SetHWnd( 0, mWindow
);
51 SurfaceClipper
->Release();
52 CreatedSurface
->Release();
56 hr
= CreatedSurface
->SetClipper( SurfaceClipper
);
62 SurfaceClipper
->Release();
63 CreatedSurface
->Release();
67 SurfaceClipper
->Release();
69 const_cast<UIDirectDrawPrimaryCanvas
*>( this )->SetSurface( CreatedSurface
);
71 else if( mSurface
->IsLost() )
73 if( FAILED( mSurface
->Restore() ) )