D1120: Invalid Attempt to Draw Bitmap

An operation failed because the bitmap has the D2D1_BITMAP_OPTIONS_CANNOT_DRAW option.

 

Possible Causes

This message occurs when an application attempts to draw a bitmap flagged with D2D1_BITMAP_OPTIONS_CANNOT_DRAW. This includes direct calls to DrawBitmap, as well as the drawing of primitives using a bitmap brush.

Possible Fixes

The CANNOT_DRAW flag is used for correctly annotating resources which are usable as targets only, such as swap chain backbuffers. However, it is also permitted to omit the CANNOT_DRAW flag for some target bitmaps if they may also be used as a source. If this is the case, simply omit the CANNOT_DRAW flag. If the bitmap must be annotated with CANNOT_DRAW because of its exclusive use as a target or to allow CPU-lockability, consider using a staging texture with the same size as the desired source but without the CANNOT_DRAW designation. Copy to the staging texture using ID3D11DeviceContext::CopyResource, and use the staging texture as a source for the drawing operation. The use of a staging texture gives rise to performance implications; they may be acceptable if the source bitmap does not change often.