From 30f4640ccf5bc3e477a7ebfcdfc38ce69a5dc9fb Mon Sep 17 00:00:00 2001 From: glenlow Date: Wed, 21 May 2008 13:31:18 +0000 Subject: [PATCH] gvdevice plugin to output cairo bitmaps; one or two missing refcount releases --- plugin/quartz/gvplugin_quartz.c | 16 ++++++++++++++++ plugin/quartz/gvplugin_quartz.h | 7 ++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/plugin/quartz/gvplugin_quartz.c b/plugin/quartz/gvplugin_quartz.c index 43ba875c6..ed33668e3 100644 --- a/plugin/quartz/gvplugin_quartz.c +++ b/plugin/quartz/gvplugin_quartz.c @@ -21,6 +21,7 @@ extern gvplugin_installed_t gvrender_quartz_types; // extern gvplugin_installed_t gvtextlayout_quartz_types; extern gvplugin_installed_t gvloadimage_quartz_types; extern gvplugin_installed_t gvdevice_quartz_types; +extern gvplugin_installed_t gvdevice_quartz_types_for_cairo; /* Uniform Type Identifiers corresponding to each format_type */ CFStringRef format_uti [] = { @@ -39,11 +40,26 @@ CFStringRef format_uti [] = { CFSTR("com.truevision.tga-image") }; +/* data consumer backed by the gvdevice */ + +extern size_t gvdevice_write(GVJ_t *job, const unsigned char *s, unsigned int len); + +static size_t device_data_consumer_put_bytes (void *info, const void *buffer, size_t count) +{ + return gvdevice_write((GVJ_t *)info, (const unsigned char*)buffer, count); +} + +CGDataConsumerCallbacks device_data_consumer_callbacks = { + device_data_consumer_put_bytes, + NULL +}; + static gvplugin_api_t apis[] = { {API_render, &gvrender_quartz_types}, // {API_textlayout, &gvtextlayout_quartz_types}, {API_loadimage, &gvloadimage_quartz_types}, {API_device, &gvdevice_quartz_types}, + {API_device, &gvdevice_quartz_types_for_cairo}, {(api_t)0, 0}, }; diff --git a/plugin/quartz/gvplugin_quartz.h b/plugin/quartz/gvplugin_quartz.h index 7920486ea..59f518aac 100644 --- a/plugin/quartz/gvplugin_quartz.h +++ b/plugin/quartz/gvplugin_quartz.h @@ -35,6 +35,11 @@ typedef enum { FORMAT_TGA } format_type; +static const int BYTE_ALIGN = 15; /* align to 16 bytes */ +static const int BITS_PER_COMPONENT = 8; /* bits per color component */ +static const int BYTES_PER_PIXEL = 4; /* bytes per pixel */ + extern CFStringRef format_uti []; +extern CGDataConsumerCallbacks device_data_consumer_callbacks; -#endif \ No newline at end of file +#endif -- 2.50.1