A device bitmap is any bitmap with bits that are stored in device memory (such as RAM on a display adapter) instead of main memory. Device bitmaps can significantly increase the performance of a graphics driver as well as free main memory for other uses. To realize these benefits, the corresponding graphics device must have ample video memory in addition to the video memory used to generate the current display. The device should also have efficient routines for copying bits to video memory.
Graphics drivers that set the RC_DEVBITS bit in the dpRaster member of
the GDIINFO structure support device bitmaps. GDI checks this bit to deter-mine how to carry out requests to create and select bitmaps. If a driver sets the RC_DEVBITS bit, it must export the following functions:
BitmapBits
RealizeObject
SelectBitmap
The BitmapBits function copies bitmap data to and from device bitmaps. GDI calls this function when initializing the bits after creating the bitmap. It also calls the function when an application calls the functions such as GetBitmapBits and SetBitmapBits.
The RealizeObject function creates or deletes a device bitmap. GDI calls this function when creating the bitmap by specifying the OBJ_BITMAP style. RealizeObject is responsible for allocating memory for the device as well as filling a physical PBITMAP structure that GDI uses to identify the device bitmap. If the bitmap is to be deleted, RealizeObject must free the device memory.
The SelectBitmap function associates a device bitmap with the given PDEVICE structure. GDI passes the physical PBITMAP structures of both the currently selected bitmap and the new bitmap so that SelectBitmap can carry out any special processing to enable or disable access to the device bitmaps.
Device bitmaps can not be monochrome bitmaps. GDI intercepts all requests to create monochrome bitmaps, and creates main memory bitmaps instead. This means a graphics driver that supports device bitmaps must also support main memory bitmaps.