X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fgtk2%2Fproducer_pango.c;h=c26e61a5977be9e9065b1ccb5148467ae5b152f3;hb=d7ae73d25cf5a38a3a8153ae52409fcbef16bb22;hp=c04d9426636442a11ae62858aa302e8a21f93319;hpb=4bc1c05b81568697d4f7cb7b033c85be0ed95034;p=melted diff --git a/src/modules/gtk2/producer_pango.c b/src/modules/gtk2/producer_pango.c index c04d942..c26e61a 100644 --- a/src/modules/gtk2/producer_pango.c +++ b/src/modules/gtk2/producer_pango.c @@ -99,7 +99,6 @@ mlt_producer producer_pango_init( const char *filename ) if ( filename == NULL ) { - mlt_properties_set( properties, "resource", "pango" ); mlt_properties_set( properties, "markup", "" ); } else if ( filename[ 0 ] == '+' || strstr( filename, "/+" ) ) @@ -149,7 +148,6 @@ mlt_producer producer_pango_init( const char *filename ) } else { - mlt_properties_set( properties, "resource", "pango" ); mlt_properties_set( properties, "markup", "" ); } } @@ -271,8 +269,8 @@ static void refresh_image( mlt_frame frame, int width, int height ) rgba_color fgcolor = parse_color( this->fgcolor ); rgba_color bgcolor = parse_color( this->bgcolor ); - free( this->image ); - free( this->alpha ); + mlt_pool_release( this->image ); + mlt_pool_release( this->alpha ); this->image = NULL; this->alpha = NULL; @@ -294,8 +292,8 @@ static void refresh_image( mlt_frame frame, int width, int height ) } else if ( width > 0 && ( this->image == NULL || width != this->width || height != this->height ) ) { - free( this->image ); - free( this->alpha ); + mlt_pool_release( this->image ); + mlt_pool_release( this->alpha ); this->image = NULL; this->alpha = NULL; @@ -325,25 +323,17 @@ static void refresh_image( mlt_frame frame, int width, int height ) this->height = height; // Allocate/define image - // IRRIGATE ME - uint8_t *image = malloc( width * ( height + 1 ) * 2 ); - uint8_t *alpha = NULL; - - // Allocate the alpha mask - alpha = malloc( this->width * this->height ); + this->image = mlt_pool_alloc( width * ( height + 1 ) * 2 ); + this->alpha = mlt_pool_alloc( this->width * this->height ); // Convert the image mlt_convert_rgb24a_to_yuv422( gdk_pixbuf_get_pixels( pixbuf ), this->width, this->height, gdk_pixbuf_get_rowstride( pixbuf ), - image, alpha ); + this->image, this->alpha ); // Finished with pixbuf now g_object_unref( pixbuf ); - - // reference the image in the producer - this->image = image; - this->alpha = alpha; } // Set width/height @@ -386,15 +376,14 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form if ( writable ) { // Clone our image - // IRRIGATE ME - uint8_t *copy = malloc( size ); + uint8_t *copy = mlt_pool_alloc( size ); memcpy( copy, image, size ); // We're going to pass the copy on image = copy; // Now update properties so we free the copy after - mlt_properties_set_data( properties, "image", copy, size, free, NULL ); + mlt_properties_set_data( properties, "image", copy, size, ( mlt_destructor )mlt_pool_release, NULL ); } // Pass on the image @@ -450,8 +439,8 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i static void producer_close( mlt_producer parent ) { producer_pango this = parent->child; - free( this->image ); - free( this->alpha ); + mlt_pool_release( this->image ); + mlt_pool_release( this->alpha ); free( this->fgcolor ); free( this->bgcolor ); free( this->markup ); @@ -515,10 +504,12 @@ static GdkPixbuf *pango_get_pixbuf( const char *markup, const char *text, const bitmap.width = w; bitmap.pitch = 32 * ( ( w + 31 ) / 31 ); bitmap.rows = h; - bitmap.buffer = ( unsigned char * ) calloc( 1, h * bitmap.pitch ); + bitmap.buffer = mlt_pool_alloc( h * bitmap.pitch ); bitmap.num_grays = 256; bitmap.pixel_mode = ft_pixel_mode_grays; + memset( bitmap.buffer, 0, h * bitmap.pitch ); + pango_ft2_render_layout( &bitmap, layout, 0, 0 ); src = bitmap.buffer; @@ -537,8 +528,7 @@ static GdkPixbuf *pango_get_pixbuf( const char *markup, const char *text, const } dest += stride; } - free( bitmap.buffer ); - + mlt_pool_release( bitmap.buffer ); g_object_unref( layout ); g_object_unref( context ); g_object_unref( fontmap );