You can use the IDirectDrawSurface3::Blt method to perform a color fill of the most common color you want to be displayed. For example, if the most common color your application displays is blue, you can use IDirectDrawSurface3::Blt with the DDBLT_COLORFILL flag to first fill the surface with the color blue. Then you can write everything else on top of it. This allows you to fill in the most common color very quickly, and you then only have to write a minimum number of colors to the surface.
The following example demonstrates one way to perform a color fill:
DDBLTFX ddbltfx;
ddbltfx.dwSize = sizeof(ddbltfx);
ddbltfx.dwFillColor = 0;
ddrval = lpDDSPrimary->Blt(
NULL, // Destination
NULL, NULL, // Source rectangle
DDBLT_COLORFILL, &ddbltfx);
switch(ddrval)
{
case DDERR_WASSTILLDRAWING:
.
.
.
case DDERR_SURFACELOST:
.
.
.
case DD_OK:
.
.
.
default:
}