device: Define the CAIRO_DEVICE_TYPE_INVALID device type

Define a new device type to indicate that the device is not valid.
The -1 value is along the same line as CAIRO_FORMAT_INVALID (and is
likely to have the same issues).
This commit is contained in:
Andrea Canciani 2011-07-06 22:49:29 +02:00
parent 35d8d20635
commit 02a331de13
2 changed files with 4 additions and 2 deletions

View file

@ -365,7 +365,7 @@ cairo_device_get_type (cairo_device_t *device)
if (device == NULL ||
CAIRO_REFERENCE_COUNT_IS_INVALID (&device->ref_count))
{
return (cairo_device_type_t) -1;
return CAIRO_DEVICE_TYPE_INVALID;
}
return device->backend->type;

View file

@ -1984,7 +1984,9 @@ typedef enum _cairo_device_type {
CAIRO_DEVICE_TYPE_SCRIPT,
CAIRO_DEVICE_TYPE_XCB,
CAIRO_DEVICE_TYPE_XLIB,
CAIRO_DEVICE_TYPE_XML
CAIRO_DEVICE_TYPE_XML,
CAIRO_DEVICE_TYPE_INVALID = -1
} cairo_device_type_t;
cairo_public cairo_device_type_t