114 Description->dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
118 Description->ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
120 if (system_memory ==
true)
121 Description->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
155 for (index = 0; index < 16; index++) {
156 if (
shift & 0x01)
break;
160 for (index = 0; index < 8; index++) {
161 if (
shift & 0x80)
break;
169 for (index = 0; index < 16; index++) {
170 if (
shift & 0x01)
break;
174 for (index = 0; index < 8; index++) {
175 if (
shift & 0x80)
break;
183 for (index = 0; index < 16; index++) {
184 if (
shift & 0x01)
break;
188 for (index = 0; index < 8; index++) {
189 if (
shift & 0x80)
break;
376 int backcount = (backsurface1 !=
NULL) ? 1 : 0;
384 surface->
Description->ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
386 surface->
Description->ddsCaps.dwCaps |= DDSCAPS_FLIP | DDSCAPS_COMPLEX;
387 surface->
Description->dwFlags |= DDSD_BACKBUFFERCOUNT;
388 surface->
Description->dwBackBufferCount = backcount;
396 if (result == DD_OK) {
398 LPDIRECTDRAWSURFACE back;
400 caps.dwCaps = DDSCAPS_BACKBUFFER;
401 result = surface->
SurfacePtr->GetAttachedSurface(&caps, &back);
402 if (result == DD_OK) {
410 memset(surface->
Description,
'\0',
sizeof(DDSURFACEDESC));
411 surface->
Description->dwSize =
sizeof(DDSURFACEDESC);
429 if (
Clipper->SetHWnd(0, GetActiveWindow()) == DD_OK) {
448 for (index = 0; index < 16; index++) {
449 if (
shift & 0x01)
break;
453 for (index = 0; index < 8; index++) {
454 if (
shift & 0x80)
break;
462 for (index = 0; index < 16; index++) {
463 if (
shift & 0x01)
break;
467 for (index = 0; index < 8; index++) {
468 if (
shift & 0x80)
break;
476 for (index = 0; index < 16; index++) {
477 if (
shift & 0x01)
break;
481 for (index = 0; index < 8; index++) {
482 if (
shift & 0x80)
break;
531 if (result == DD_OK) {
610 memset(&desc,
'\0',
sizeof(desc));
611 desc.dwSize =
sizeof(desc);
612 HRESULT result =
SurfacePtr->Lock(
NULL, &desc, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT,
NULL);
613 if (result != DD_OK)
return(
NULL);
671 if (
SurfacePtr->IsLost() == DDERR_SURFACELOST) {
760 Rect drect = destrect;
761 Rect srect = sourcerect;
764 if (
Blit_Clip(drect, dwindow, srect, swindow)) {
766 xdestrect.left = drect.
X+dwindow.
X;
767 xdestrect.top = drect.
Y+dwindow.
Y;
768 xdestrect.right = drect.
X+dwindow.
X+drect.
Width;
769 xdestrect.bottom = drect.
Y+dwindow.
Y+drect.
Height;
772 xsrcrect.left = srect.
X+swindow.
X;
773 xsrcrect.top = srect.
Y+swindow.
Y;
774 xsrcrect.right = srect.
X+swindow.
X+srect.
Width;
775 xsrcrect.bottom = srect.
Y+swindow.
Y+srect.
Height;
778 return(result == DD_OK);
830 if (!fillrect.
Is_Valid())
return(
false);
858 if (!frect.
Is_Valid())
return(
false);
863 rect.right = rect.left + frect.
Width;
864 rect.bottom = rect.top + frect.
Height;
867 memset(&fx,
'\0',
sizeof(fx));
868 fx.dwSize =
sizeof(fx);
869 fx.dwFillColor = color;
871 return(result == DD_OK);
921 assert(table !=
NULL);
926 for (
int index = 0; index < 256; index++) {
927 table[index] = (
unsigned short)
Build_Hicolor_Pixel(palette[index].Get_Red(), palette[index].Get_Green(), palette[index].Get_Blue());
static LPDIRECTDRAWCLIPPER Clipper
static unsigned short QuarterbrightMask
LPDIRECTDRAWSURFACE SurfacePtr
virtual int Stride(void) const
static int Build_Hicolor_Pixel(int red, int green, int blue)
virtual bool Fill_Rect(Rect const &rect, int color)
void Restore_Check(void) const
static unsigned short EighthbrightMask
virtual bool Blit_From(Rect const &dcliprect, Rect const &destrect, Surface const &source, Rect const &scliprect, Rect const &sourcerect, bool trans=false)
static unsigned short HalfbrightMask
static void Build_Remap_Table(unsigned short *table, PaletteClass const &palette)
static DSurface * Create_Primary(DSurface **backsurface1=NULL)
virtual void * Lock(Point2D point=Point2D(0, 0)) const
static DDPIXELFORMAT PixelFormat
virtual int Bytes_Per_Pixel(void) const
virtual bool Unlock(void) const
DDSURFACEDESC * Description
virtual Rect Get_Rect(void) const
virtual int Bytes_Per_Pixel(void) const =0
Surface(int width, int height)
virtual bool Is_Direct_Draw(void) const
TRect< T > const Bias_To(TRect< T > const &rect) const
bool Is_Valid(void) const
TRect< T > const Intersect(TRect< T > const &rectangle, T *x=NULL, T *y=NULL) const
XSurface(int width=0, int height=0)
virtual bool Is_Locked(void) const
virtual bool Unlock(void) const
virtual bool Blit_From(Rect const &dcliprect, Rect const &destrect, Surface const &source, Rect const &scliprect, Rect const &sourcerect, bool trans=false)
virtual void * Lock(Point2D=Point2D(0, 0)) const
virtual bool Fill_Rect(Rect const &rect, int color)
LPDIRECTDRAW DirectDrawObject
LPDIRECTDRAWSURFACE PaletteSurface
bool Blit_Clip(Rect &drect, Rect const &dwindow, Rect &srect, Rect const &swindow)