static void _draw( LxLyricLine* self, GtkSnapshot* snapshot, int offset ){
int width = gtk_widget_get_width( ( gpointer )self );
int height = gtk_widget_get_height( ( gpointer )self );
// width = gtk_widget_get_allocated_width( ( gpointer )self );
// height = gtk_widget_get_allocated_height( ( gpointer )self );
GtkSnapshot* child_snapshot = NULL;
GdkRGBA color;
gdk_rgba_parse( &color, "yellow" );
int height_half = height / 2;
// if ( offset < width ) {
gtk_snapshot_push_clip( snapshot, &GRAPHENE_RECT_INIT( offset, -height_half, width, height * 2 ) );
child_snapshot = gtk_snapshot_new();
lx_widget_snapshot_childs( ( gpointer )self, child_snapshot );
gtk_snapshot_append_node( snapshot, gtk_snapshot_free_to_node( child_snapshot ) );
gtk_snapshot_pop( snapshot );
//}
gtk_snapshot_push_mask( snapshot, GSK_MASK_MODE_ALPHA );
child_snapshot = gtk_snapshot_new();
lx_widget_snapshot_childs( ( gpointer )self, child_snapshot );
gtk_snapshot_append_node( snapshot, gtk_snapshot_free_to_node( child_snapshot ) );
gtk_snapshot_pop( snapshot );
gtk_snapshot_append_color( snapshot, &color, &GRAPHENE_RECT_INIT( 0, -height_half, offset, height * 2 ) );
gtk_snapshot_pop( snapshot );
}
/////////////////////////////////////
static void lx_lyric_line_snapshot( GtkWidget* widget, GtkSnapshot* _snapshot )
{
_SELF( widget );
int width = gtk_widget_get_width( widget );
//width = gtk_widget_get_allocated_width( widget );
// int height = gtk_widget_get_height( widget );
_draw( self, _snapshot, width );
return;
}
offset = width, but part of the content on the right is lost
I tried gtk_widget_get_allocated_width, still no effect