Ejemplo n.º 1
0
static cairo_surface_t* fading_label_make_surface (FadingLabel* self, cairo_t* orig_c) {
	cairo_surface_t* result = NULL;
	gint w = 0;
	gint h = 0;
	PangoLayout* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	gint bw;
	gint _tmp4_ = 0;
	gint bh;
	cairo_t* _tmp5_;
	cairo_surface_t* _tmp6_ = NULL;
	gint _tmp7_;
	gint _tmp8_;
	cairo_surface_t* _tmp9_;
	cairo_surface_t* surface;
	cairo_surface_t* _tmp10_;
	cairo_t* _tmp11_;
	cairo_t* c;
	gint _tmp12_;
	gint _tmp13_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (orig_c != NULL, NULL);
	_tmp0_ = gtk_label_get_layout ((GtkLabel*) self);
	pango_layout_get_pixel_size (_tmp0_, &_tmp1_, &_tmp2_);
	w = _tmp1_;
	h = _tmp2_;
	_tmp3_ = gtk_widget_get_allocated_width ((GtkWidget*) self);
	bw = _tmp3_;
	_tmp4_ = gtk_widget_get_allocated_height ((GtkWidget*) self);
	bh = _tmp4_;
	_tmp5_ = orig_c;
	_tmp6_ = cairo_get_target (_tmp5_);
	_tmp7_ = bw;
	_tmp8_ = bh;
	_tmp9_ = cairo_surface_create_similar (_tmp6_, CAIRO_CONTENT_COLOR_ALPHA, _tmp7_, _tmp8_);
	surface = _tmp9_;
	_tmp10_ = surface;
	_tmp11_ = cairo_create (_tmp10_);
	c = _tmp11_;
	_tmp12_ = w;
	_tmp13_ = bw;
	if (_tmp12_ > _tmp13_) {
		cairo_t* _tmp14_;
		cairo_t* _tmp15_;
		cairo_t* _tmp16_;
		gint _tmp17_;
		cairo_pattern_t* _tmp18_;
		cairo_pattern_t* mask;
		cairo_pattern_t* _tmp19_;
		gint _tmp20_;
		cairo_pattern_t* _tmp21_;
		gint _tmp22_;
		cairo_pattern_t* _tmp23_;
		cairo_t* _tmp24_;
		cairo_pattern_t* _tmp25_;
		_tmp14_ = c;
		cairo_push_group (_tmp14_);
		_tmp15_ = c;
		GTK_WIDGET_CLASS (fading_label_parent_class)->draw ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_LABEL, GtkLabel), _tmp15_);
		_tmp16_ = c;
		cairo_pop_group_to_source (_tmp16_);
		_tmp17_ = bw;
		_tmp18_ = cairo_pattern_create_linear ((gdouble) 0, (gdouble) 0, (gdouble) _tmp17_, (gdouble) 0);
		mask = _tmp18_;
		_tmp19_ = mask;
		_tmp20_ = bw;
		cairo_pattern_add_color_stop_rgba (_tmp19_, 1.0 - (27.0 / _tmp20_), 1.0, 1.0, 1.0, 1.0);
		_tmp21_ = mask;
		_tmp22_ = bw;
		cairo_pattern_add_color_stop_rgba (_tmp21_, 1.0 - (21.6 / _tmp22_), 1.0, 1.0, 1.0, 0.5);
		_tmp23_ = mask;
		cairo_pattern_add_color_stop_rgba (_tmp23_, 1.0, 1.0, 1.0, 1.0, 0.0);
		_tmp24_ = c;
		_tmp25_ = mask;
		cairo_mask (_tmp24_, _tmp25_);
		_cairo_pattern_destroy0 (mask);
	} else {
		cairo_t* _tmp26_;
		_tmp26_ = c;
		GTK_WIDGET_CLASS (fading_label_parent_class)->draw ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_LABEL, GtkLabel), _tmp26_);
	}
	result = surface;
	_cairo_destroy0 (c);
	return result;
}
Ejemplo n.º 2
0
static gboolean slingshot_frontend_app_item_draw_background (SlingshotFrontendAppItem* self, GtkWidget* widget, GdkEventExpose* event) {
	gboolean result = FALSE;
	GtkAllocation size = {0};
	GtkWidget* _tmp0_ = NULL;
	GtkAllocation _tmp1_ = {0};
	cairo_t* context = NULL;
	GtkWidget* _tmp2_ = NULL;
	GdkWindow* _tmp3_ = NULL;
	cairo_t* _tmp4_ = NULL;
	gdouble progress = 0.0;
	gint _tmp5_ = 0;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (widget != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = widget;
	gtk_widget_get_allocation (_tmp0_, &_tmp1_);
	size = _tmp1_;
	_tmp2_ = widget;
	_tmp3_ = _tmp2_->window;
	_tmp4_ = gdk_cairo_create ((GdkDrawable*) _tmp3_);
	context = _tmp4_;
	_tmp5_ = self->priv->current_frame;
	if (_tmp5_ > 1) {
		gint _tmp6_ = 0;
		_tmp6_ = self->priv->current_frame;
		progress = ((gdouble) SLINGSHOT_FRONTEND_APP_ITEM_RUN_LENGTH) / ((gdouble) _tmp6_);
	} else {
		progress = (gdouble) 1;
	}
	g_object_get ((GtkWidget*) self, "has-focus", &_tmp7_, NULL);
	_tmp8_ = _tmp7_;
	if (_tmp8_) {
		cairo_pattern_t* linear_gradient = NULL;
		GtkAllocation _tmp9_ = {0};
		gint _tmp10_ = 0;
		GtkAllocation _tmp11_ = {0};
		gint _tmp12_ = 0;
		GtkAllocation _tmp13_ = {0};
		gint _tmp14_ = 0;
		GtkAllocation _tmp15_ = {0};
		gint _tmp16_ = 0;
		GtkAllocation _tmp17_ = {0};
		gint _tmp18_ = 0;
		cairo_pattern_t* _tmp19_ = NULL;
		cairo_pattern_t* _tmp20_ = NULL;
		SlingshotFrontendColor _tmp21_ = {0};
		gdouble _tmp22_ = 0.0;
		SlingshotFrontendColor _tmp23_ = {0};
		gdouble _tmp24_ = 0.0;
		SlingshotFrontendColor _tmp25_ = {0};
		gdouble _tmp26_ = 0.0;
		gdouble _tmp27_ = 0.0;
		cairo_t* _tmp28_ = NULL;
		cairo_pattern_t* _tmp29_ = NULL;
		cairo_t* _tmp30_ = NULL;
		GtkAllocation _tmp31_ = {0};
		cairo_t* _tmp32_ = NULL;
		_tmp9_ = size;
		_tmp10_ = _tmp9_.x;
		_tmp11_ = size;
		_tmp12_ = _tmp11_.y;
		_tmp13_ = size;
		_tmp14_ = _tmp13_.x;
		_tmp15_ = size;
		_tmp16_ = _tmp15_.y;
		_tmp17_ = size;
		_tmp18_ = _tmp17_.height;
		_tmp19_ = cairo_pattern_create_linear ((gdouble) _tmp10_, (gdouble) _tmp12_, (gdouble) _tmp14_, (gdouble) (_tmp16_ + _tmp18_));
		linear_gradient = _tmp19_;
		_tmp20_ = linear_gradient;
		_tmp21_ = self->priv->prominent;
		_tmp22_ = _tmp21_.R;
		_tmp23_ = self->priv->prominent;
		_tmp24_ = _tmp23_.G;
		_tmp25_ = self->priv->prominent;
		_tmp26_ = _tmp25_.B;
		_tmp27_ = progress;
		cairo_pattern_add_color_stop_rgba (_tmp20_, 0.2, _tmp22_, _tmp24_, _tmp26_, 0.25 / _tmp27_);
		_tmp28_ = context;
		_tmp29_ = linear_gradient;
		cairo_set_source (_tmp28_, _tmp29_);
		_tmp30_ = context;
		_tmp31_ = size;
		slingshot_frontend_utilities_draw_rounded_rectangle (_tmp30_, (gdouble) 0, 0.5, &_tmp31_);
		_tmp32_ = context;
		cairo_fill (_tmp32_);
		_cairo_pattern_destroy0 (linear_gradient);
	} else {
		gint _tmp33_ = 0;
		_tmp33_ = self->priv->current_frame;
		if (_tmp33_ > 1) {
			cairo_pattern_t* linear_gradient = NULL;
			GtkAllocation _tmp34_ = {0};
			gint _tmp35_ = 0;
			GtkAllocation _tmp36_ = {0};
			gint _tmp37_ = 0;
			GtkAllocation _tmp38_ = {0};
			gint _tmp39_ = 0;
			GtkAllocation _tmp40_ = {0};
			gint _tmp41_ = 0;
			GtkAllocation _tmp42_ = {0};
			gint _tmp43_ = 0;
			cairo_pattern_t* _tmp44_ = NULL;
			cairo_pattern_t* _tmp45_ = NULL;
			SlingshotFrontendColor _tmp46_ = {0};
			gdouble _tmp47_ = 0.0;
			SlingshotFrontendColor _tmp48_ = {0};
			gdouble _tmp49_ = 0.0;
			SlingshotFrontendColor _tmp50_ = {0};
			gdouble _tmp51_ = 0.0;
			gdouble _tmp52_ = 0.0;
			cairo_t* _tmp53_ = NULL;
			cairo_pattern_t* _tmp54_ = NULL;
			cairo_t* _tmp55_ = NULL;
			GtkAllocation _tmp56_ = {0};
			cairo_t* _tmp57_ = NULL;
			_tmp34_ = size;
			_tmp35_ = _tmp34_.x;
			_tmp36_ = size;
			_tmp37_ = _tmp36_.y;
			_tmp38_ = size;
			_tmp39_ = _tmp38_.x;
			_tmp40_ = size;
			_tmp41_ = _tmp40_.y;
			_tmp42_ = size;
			_tmp43_ = _tmp42_.height;
			_tmp44_ = cairo_pattern_create_linear ((gdouble) _tmp35_, (gdouble) _tmp37_, (gdouble) _tmp39_, (gdouble) (_tmp41_ + _tmp43_));
			linear_gradient = _tmp44_;
			_tmp45_ = linear_gradient;
			_tmp46_ = self->priv->prominent;
			_tmp47_ = _tmp46_.R;
			_tmp48_ = self->priv->prominent;
			_tmp49_ = _tmp48_.G;
			_tmp50_ = self->priv->prominent;
			_tmp51_ = _tmp50_.B;
			_tmp52_ = progress;
			cairo_pattern_add_color_stop_rgba (_tmp45_, 0.2, _tmp47_, _tmp49_, _tmp51_, 0.25 - (0.25 / _tmp52_));
			_tmp53_ = context;
			_tmp54_ = linear_gradient;
			cairo_set_source (_tmp53_, _tmp54_);
			_tmp55_ = context;
			_tmp56_ = size;
			slingshot_frontend_utilities_draw_rounded_rectangle (_tmp55_, (gdouble) 0, 0.5, &_tmp56_);
			_tmp57_ = context;
			cairo_fill (_tmp57_);
			_cairo_pattern_destroy0 (linear_gradient);
		}
	}
	result = FALSE;
	_cairo_destroy0 (context);
	return result;
}