Subversion Repositories Kolibri OS

Rev

Rev 1892 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1892 Rev 3959
Line 90... Line 90...
90
 * Please refer to the documentation of each backend for
90
 * Please refer to the documentation of each backend for
91
 * additional usage requirements, guarantees provided, and
91
 * additional usage requirements, guarantees provided, and
92
 * interactions with existing surface API of the device functions for
92
 * interactions with existing surface API of the device functions for
93
 * surfaces of that type.
93
 * surfaces of that type.
94
 * 
94
 * 
95
 */
95
 **/
Line 96... Line 96...
96
 
96
 
97
static const cairo_device_t _nil_device = {
97
static const cairo_device_t _nil_device = {
98
    CAIRO_REFERENCE_COUNT_INVALID,
98
    CAIRO_REFERENCE_COUNT_INVALID,
99
    CAIRO_STATUS_NO_MEMORY,
99
    CAIRO_STATUS_NO_MEMORY,
Line 154... Line 154...
154
    case CAIRO_STATUS_INVALID_CLUSTERS:
154
    case CAIRO_STATUS_INVALID_CLUSTERS:
155
    case CAIRO_STATUS_INVALID_SLANT:
155
    case CAIRO_STATUS_INVALID_SLANT:
156
    case CAIRO_STATUS_INVALID_WEIGHT:
156
    case CAIRO_STATUS_INVALID_WEIGHT:
157
    case CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED:
157
    case CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED:
158
    case CAIRO_STATUS_INVALID_CONTENT:
158
    case CAIRO_STATUS_INVALID_CONTENT:
-
 
159
    case CAIRO_STATUS_INVALID_MESH_CONSTRUCTION:
-
 
160
    case CAIRO_STATUS_DEVICE_FINISHED:
159
    default:
161
    default:
160
	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
162
	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
161
	return (cairo_device_t *) &_nil_device;
163
	return (cairo_device_t *) &_nil_device;
162
    }
164
    }
163
}
165
}
Line 252... Line 254...
252
    cairo_status_t status;
254
    cairo_status_t status;
Line 253... Line 255...
253
 
255
 
254
    if (device == NULL || device->status)
256
    if (device == NULL || device->status)
Line -... Line 257...
-
 
257
	return;
-
 
258
 
-
 
259
    if (device->finished)
255
	return;
260
	return;
256
 
261
 
257
    if (device->backend->flush != NULL) {
262
    if (device->backend->flush != NULL) {
258
	status = device->backend->flush (device);
263
	status = device->backend->flush (device);
259
	if (unlikely (status))
264
	if (unlikely (status))
Line 293... Line 298...
293
    if (device->finished)
298
    if (device->finished)
294
	return;
299
	return;
Line 295... Line 300...
295
 
300
 
Line 296... Line -...
296
    cairo_device_flush (device);
-
 
297
 
-
 
298
    device->finished = TRUE;
301
    cairo_device_flush (device);
299
 
302
 
-
 
303
    if (device->backend->finish != NULL)
-
 
304
	device->backend->finish (device);
-
 
305
 
-
 
306
    /* We only finish the device after the backend's callback returns because
-
 
307
     * the device might still be needed during the callback
-
 
308
     * (e.g. for cairo_device_acquire ()).
300
    if (device->backend->finish != NULL)
309
     */
301
	device->backend->finish (device);
310
    device->finished = TRUE;
Line 302... Line 311...
302
}
311
}
303
slim_hidden_def (cairo_device_finish);
312
slim_hidden_def (cairo_device_finish);
Line 358... Line 367...
358
cairo_device_get_type (cairo_device_t *device)
367
cairo_device_get_type (cairo_device_t *device)
359
{
368
{
360
    if (device == NULL ||
369
    if (device == NULL ||
361
	CAIRO_REFERENCE_COUNT_IS_INVALID (&device->ref_count))
370
	CAIRO_REFERENCE_COUNT_IS_INVALID (&device->ref_count))
362
    {
371
    {
363
	return (cairo_device_type_t) -1;
372
	return CAIRO_DEVICE_TYPE_INVALID;
364
    }
373
    }
Line 365... Line 374...
365
 
374
 
366
    return device->backend->type;
375
    return device->backend->type;
Line 404... Line 413...
404
 
413
 
405
    if (unlikely (device->status))
414
    if (unlikely (device->status))
Line 406... Line 415...
406
	return device->status;
415
	return device->status;
407
 
416
 
Line 408... Line 417...
408
    if (unlikely (device->finished))
417
    if (unlikely (device->finished))
409
	return _cairo_device_set_error (device, CAIRO_STATUS_SURFACE_FINISHED); /* XXX */
418
	return _cairo_device_set_error (device, CAIRO_STATUS_DEVICE_FINISHED);
410
 
419
 
411
    CAIRO_MUTEX_LOCK (device->mutex);
420
    CAIRO_MUTEX_LOCK (device->mutex);
Line 446... Line 455...
446
 
455
 
447
cairo_status_t
456
cairo_status_t
448
_cairo_device_set_error (cairo_device_t *device,
457
_cairo_device_set_error (cairo_device_t *device,
449
			 cairo_status_t  status)
458
			 cairo_status_t  status)
450
{
459
{
451
    if (status == CAIRO_STATUS_SUCCESS || status >= CAIRO_INT_STATUS_UNSUPPORTED)
460
    if (status == CAIRO_STATUS_SUCCESS)
Line 452... Line -...
452
	return status;
-
 
453
 
-
 
454
    /* Don't overwrite an existing error. This preserves the first
461
        return CAIRO_STATUS_SUCCESS;
Line 455... Line 462...
455
     * error, which is the most significant. */
462
 
456
    _cairo_status_set_error (&device->status, status);
463
    _cairo_status_set_error (&device->status, status);