Example #1
0
static GdkVisual *
gdk_gl_pixmap_get_visual (GdkDrawable *drawable)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  return GDK_DRAWABLE_GET_CLASS (real_drawable)->get_visual (real_drawable);
}
Example #2
0
static GdkScreen *
gdk_gl_pixmap_get_screen (GdkDrawable *drawable)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  return GDK_DRAWABLE_GET_CLASS (real_drawable)->get_screen (real_drawable);
}
Example #3
0
static GdkColormap *
gdk_gl_pixmap_get_colormap (GdkDrawable *drawable)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  return GDK_DRAWABLE_GET_CLASS (real_drawable)->get_colormap (real_drawable);
}
Example #4
0
static GdkRegion *
gdk_gl_pixmap_get_visible_region (GdkDrawable *drawable)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  return GDK_DRAWABLE_GET_CLASS (real_drawable)->get_visible_region (real_drawable);
}
Example #5
0
static gint
gdk_gl_pixmap_get_depth (GdkDrawable *drawable)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  return GDK_DRAWABLE_GET_CLASS (real_drawable)->get_depth (real_drawable);
}
Example #6
0
/*< private >*/
void
_gdk_gl_window_get_size (GdkGLDrawable *gldrawable, gint *width, gint *height)
{
  g_return_if_fail (GDK_IS_GL_WINDOW (gldrawable));

  GdkDrawable *real_drawable = ((GdkGLWindow *) gldrawable)->drawable;

  GDK_DRAWABLE_GET_CLASS (real_drawable)->get_size (real_drawable, width, height);
}
Example #7
0
static void
gdk_gl_pixmap_set_colormap (GdkDrawable *drawable,
                            GdkColormap *cmap)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  GDK_DRAWABLE_GET_CLASS (real_drawable)->set_colormap (real_drawable,
                                                        cmap);
}
Example #8
0
static void
gdk_gl_pixmap_draw_pixbuf (GdkDrawable *drawable,
                           GdkGC       *gc,
                           GdkPixbuf   *pixbuf,
                           gint         src_x,
                           gint         src_y,
                           gint         dest_x,
                           gint         dest_y,
                           gint         width,
                           gint         height,
                           GdkRgbDither dither,
                           gint         x_dither,
                           gint         y_dither)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

#if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION == 0
  GDK_DRAWABLE_GET_CLASS (real_drawable)->_draw_pixbuf (real_drawable,
                                                        gc,
                                                        pixbuf,
                                                        src_x,
                                                        src_y,
                                                        dest_x,
                                                        dest_y,
                                                        width,
                                                        height,
                                                        dither,
                                                        x_dither,
                                                        y_dither);
#else
  GDK_DRAWABLE_GET_CLASS (real_drawable)->draw_pixbuf (real_drawable,
                                                       gc,
                                                       pixbuf,
                                                       src_x,
                                                       src_y,
                                                       dest_x,
                                                       dest_y,
                                                       width,
                                                       height,
                                                       dither,
                                                       x_dither,
                                                       y_dither);
#endif
}
Example #9
0
static void
gdk_gl_pixmap_get_size (GdkDrawable *drawable,
                        gint        *width,
                        gint        *height)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  GDK_DRAWABLE_GET_CLASS (real_drawable)->get_size (real_drawable,
                                                    width,
                                                    height);
}
Example #10
0
static GdkGC *
gdk_gl_pixmap_create_gc (GdkDrawable    *drawable,
                         GdkGCValues    *values,
                         GdkGCValuesMask mask)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  return GDK_DRAWABLE_GET_CLASS (real_drawable)->create_gc (real_drawable,
                                                            values,
                                                            mask);
}
Example #11
0
static void
gdk_gl_pixmap_draw_segments (GdkDrawable *drawable,
                             GdkGC	 *gc,
                             GdkSegment  *segs,
                             gint         nsegs)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  GDK_DRAWABLE_GET_CLASS (real_drawable)->draw_segments (real_drawable,
                                                         gc,
                                                         segs,
                                                         nsegs);
}
Example #12
0
static void
gdk_gl_pixmap_draw_lines (GdkDrawable *drawable,
                          GdkGC       *gc,
                          GdkPoint    *points,
                          gint         npoints)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  GDK_DRAWABLE_GET_CLASS (real_drawable)->draw_lines (real_drawable,
                                                      gc,
                                                      points,
                                                      npoints);
}
Example #13
0
static void
gdk_gl_pixmap_draw_polygon (GdkDrawable *drawable,
                            GdkGC	*gc,
                            gint	 filled,
                            GdkPoint    *points,
                            gint	 npoints)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  GDK_DRAWABLE_GET_CLASS (real_drawable)->draw_polygon (real_drawable,
                                                        gc,
                                                        filled,
                                                        points,
                                                        npoints);
}
Example #14
0
/*< private >*/
void
_gdk_gl_pixmap_get_size (GdkGLDrawable *gldrawable,
                         gint          *width,
                         gint          *height)
{
  GdkDrawable *real_drawable;

  g_return_if_fail (GDK_IS_GL_PIXMAP (gldrawable));

  real_drawable = ((GdkGLPixmap *) gldrawable)->drawable;

  GDK_DRAWABLE_GET_CLASS (real_drawable)->get_size (real_drawable,
                                                    width,
                                                    height);
}
Example #15
0
static GdkImage *
gdk_gl_pixmap_get_image (GdkDrawable *drawable,
                         gint         x,
                         gint         y,
                         gint         width,
                         gint         height)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  return GDK_DRAWABLE_GET_CLASS (real_drawable)->get_image (real_drawable,
                                                            x,
                                                            y,
                                                            width,
                                                            height);
}
Example #16
0
static void
gdk_gl_pixmap_draw_glyphs (GdkDrawable      *drawable,
                           GdkGC            *gc,
                           PangoFont        *font,
                           gint              x,
                           gint              y,
                           PangoGlyphString *glyphs)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  GDK_DRAWABLE_GET_CLASS (real_drawable)->draw_glyphs (real_drawable,
                                                       gc,
                                                       font,
                                                       x,
                                                       y,
                                                       glyphs);
}
Example #17
0
static void
gdk_gl_pixmap_draw_text_wc (GdkDrawable	   *drawable,
                            GdkFont	   *font,
                            GdkGC	   *gc,
                            gint	    x,
                            gint            y,
                            const GdkWChar *text,
                            gint	    text_length)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  GDK_DRAWABLE_GET_CLASS (real_drawable)->draw_text_wc (real_drawable,
                                                        font,
                                                        gc,
                                                        x,
                                                        y,
                                                        text,
                                                        text_length);
}
Example #18
0
static GdkDrawable *
gdk_gl_pixmap_get_composite_drawable (GdkDrawable *drawable,
                                      gint         x,
                                      gint         y,
                                      gint         width,
                                      gint         height,
                                      gint        *composite_x_offset,
                                      gint        *composite_y_offset)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  return GDK_DRAWABLE_GET_CLASS (real_drawable)->get_composite_drawable (real_drawable,
                                                                         x,
                                                                         y,
                                                                         width,
                                                                         height,
                                                                         composite_x_offset,
                                                                         composite_y_offset);
}
Example #19
0
static void
gdk_gl_pixmap_draw_rectangle (GdkDrawable *drawable,
                              GdkGC	  *gc,
                              gint	   filled,
                              gint	   x,
                              gint	   y,
                              gint	   width,
                              gint	   height)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  GDK_DRAWABLE_GET_CLASS (real_drawable)->draw_rectangle (real_drawable,
                                                          gc,
                                                          filled,
                                                          x,
                                                          y,
                                                          width,
                                                          height);
}
Example #20
0
static GdkImage *
gdk_gl_pixmap_copy_to_image (GdkDrawable *drawable,
                             GdkImage    *image,
                             gint         src_x,
                             gint         src_y,
                             gint         dest_x,
                             gint         dest_y,
                             gint         width,
                             gint         height)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  return GDK_DRAWABLE_GET_CLASS (real_drawable)->_copy_to_image (real_drawable,
                                                                 image,
                                                                 src_x,
                                                                 src_y,
                                                                 dest_x,
                                                                 dest_y,
                                                                 width,
                                                                 height);
}
Example #21
0
static void
gdk_gl_pixmap_draw_image (GdkDrawable *drawable,
                          GdkGC	      *gc,
                          GdkImage    *image,
                          gint	       xsrc,
                          gint	       ysrc,
                          gint	       xdest,
                          gint	       ydest,
                          gint	       width,
                          gint	       height)
{
  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;

  GDK_DRAWABLE_GET_CLASS (real_drawable)->draw_image (real_drawable,
                                                      gc,
                                                      image,
                                                      xsrc,
                                                      ysrc,
                                                      xdest,
                                                      ydest,
                                                      width,
                                                      height);
}
Example #22
0
static cairo_surface_t *
cm_gdk_window_create_similar_surface (GdkWindow *     window,
                                      cairo_content_t content,
                                      int             width,
                                      int             height)
{
#if !GTK_CHECK_VERSION(2, 22, 0)
    cairo_surface_t *window_surface, *surface;

    g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);

    window_surface = GDK_DRAWABLE_GET_CLASS(window)->ref_cairo_surface(window);

    surface = cairo_surface_create_similar (window_surface,
                                            content,
                                            width, height);

    cairo_surface_destroy (window_surface);

    return surface;
#else
    return gdk_window_create_similar_surface(window, content, width, height);
#endif
}
Example #23
0
static gboolean ddb_equalizer_real_expose_event (GtkWidget* base, GdkEventExpose* event) {
	DdbEqualizer * self;
	gboolean result = FALSE;
	GdkColor _tmp0_ = {0};
	GdkColor fore_bright_color;
	GdkColor c1;
	GdkColor _tmp1_ = {0};
	GdkColor c2;
	GdkColor fore_dark_color;
	gint width;
	gint height;
	GdkDrawable* d;
	GdkGCValues _tmp2_ = {0};
	GdkGCValues _tmp3_;
	GdkGC* gc;
	double step;
	gint i = 0;
	double vstep;
	PangoLayout* l;
	PangoContext* ctx;
	PangoFontDescription* fd;
	gint fontsize;
	gboolean _tmp7_ = FALSE;
	char* tmp;
	double val;
	const char* _tmp9_;
	char* _tmp10_;
	const char* _tmp11_;
	char* _tmp12_;
	GdkRectangle _tmp13_ = {0};
	GdkRectangle _tmp14_;
	gint count;
	GdkRectangle _tmp16_ = {0};
	GdkRectangle _tmp17_;
	gint bar_w;
	GdkRectangle _tmp22_ = {0};
	GdkRectangle _tmp23_;
	self = (DdbEqualizer*) base;
	fore_bright_color = (gtkui_get_bar_foreground_color (&_tmp0_), _tmp0_);
	c1 = fore_bright_color;
	c2 = (gtkui_get_bar_background_color (&_tmp1_), _tmp1_);
	fore_dark_color = c2;
	fore_dark_color.red = fore_dark_color.red + ((guint16) ((gint16) ((c1.red - c2.red) * 0.5)));
	fore_dark_color.green = fore_dark_color.green + ((guint16) ((gint16) ((c1.green - c2.green) * 0.5)));
	fore_dark_color.blue = fore_dark_color.blue + ((guint16) ((gint16) ((c1.blue - c2.blue) * 0.5)));
	width = ((GtkWidget*) self)->allocation.width;
	height = ((GtkWidget*) self)->allocation.height;
	d = _g_object_ref0 ((GdkDrawable*) gtk_widget_get_window ((GtkWidget*) self));
	gc = _g_object_ref0 (GDK_DRAWABLE_GET_CLASS (d)->create_gc (d, (_tmp3_ = (memset (&_tmp2_, 0, sizeof (GdkGCValues)), _tmp2_), &_tmp3_), 0));
	gdk_gc_set_rgb_fg_color (gc, &c2);
	gdk_draw_rectangle (d, gc, TRUE, 0, 0, width, height);
	gdk_gc_set_rgb_fg_color (gc, &fore_dark_color);
	step = ((double) (width - self->priv->margin_left)) / ((double) (DDB_EQUALIZER_bands + 1));
	{
		gboolean _tmp4_;
		i = 0;
		_tmp4_ = TRUE;
		while (TRUE) {
			if (!_tmp4_) {
				i++;
			}
			_tmp4_ = FALSE;
			if (!(i < DDB_EQUALIZER_bands)) {
				break;
			}
			gdk_draw_line (d, gc, ((gint) ((i + 1) * step)) + self->priv->margin_left, 0, ((gint) ((i + 1) * step)) + self->priv->margin_left, height - self->priv->margin_bottom);
		}
	}
	vstep = (double) (height - self->priv->margin_bottom);
	{
		double di;
		di = (double) 0;
		{
			gboolean _tmp5_;
			_tmp5_ = TRUE;
			while (TRUE) {
				if (!_tmp5_) {
					di = di + 0.25;
				}
				_tmp5_ = FALSE;
				if (!(di < 2)) {
					break;
				}
				gdk_draw_line (d, gc, self->priv->margin_left, (gint) ((di - self->priv->preamp) * vstep), width, (gint) ((di - self->priv->preamp) * vstep));
			}
		}
	}
	gdk_gc_set_rgb_fg_color (gc, &fore_bright_color);
	l = gtk_widget_create_pango_layout ((GtkWidget*) self, NULL);
	ctx = _g_object_ref0 (pango_layout_get_context (l));
	fd = pango_font_description_copy (gtk_widget_get_style ((GtkWidget*) self)->font_desc);
	pango_font_description_set_size (fd, (gint) (pango_font_description_get_size (gtk_widget_get_style ((GtkWidget*) self)->font_desc) * 0.7));
	pango_context_set_font_description (ctx, fd);
	{
		gboolean _tmp6_;
		i = 0;
		_tmp6_ = TRUE;
		while (TRUE) {
			PangoRectangle ink = {0};
			PangoRectangle log = {0};
			gint offs;
			if (!_tmp6_) {
				i++;
			}
			_tmp6_ = FALSE;
			if (!(i < DDB_EQUALIZER_bands)) {
				break;
			}
			pango_layout_set_text (l, freqs[i], (gint) g_utf8_strlen (freqs[i], -1));
			pango_layout_get_pixel_extents (l, &ink, &log);
			offs = 2;
			if ((i % 2) != 0) {
				offs = offs + 2;
			}
			gdk_draw_layout (d, gc, (((gint) ((i + 1) * step)) + self->priv->margin_left) - (ink.width / 2), (height - self->priv->margin_bottom) + offs, l);
		}
	}
	pango_font_description_set_size (fd, (gint) pango_font_description_get_size (gtk_widget_get_style ((GtkWidget*) self)->font_desc));
	pango_context_set_font_description (ctx, fd);
	pango_layout_set_width (l, self->priv->margin_left - 1);
	pango_layout_set_alignment (l, PANGO_ALIGN_RIGHT);
	fontsize = (gint) ((pango_units_to_double (pango_font_description_get_size (fd)) * gdk_screen_get_resolution (gdk_screen_get_default ())) / 72);
	if (self->priv->mouse_y >= 0) {
		_tmp7_ = self->priv->mouse_y < (height - self->priv->margin_bottom);
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		double db;
		const char* _tmp8_;
		char* tmp;
		db = ddb_equalizer_scale (self, ((double) (self->priv->mouse_y - 1)) / ((double) ((height - self->priv->margin_bottom) - 2)));
		_tmp8_ = NULL;
		if (db > 0) {
			_tmp8_ = "+";
		} else {
			_tmp8_ = "";
		}
		tmp = g_strdup_printf ("%s%.1fdB", _tmp8_, db);
		pango_layout_set_text (l, tmp, (gint) g_utf8_strlen (tmp, -1));
		gdk_draw_layout (d, gc, self->priv->margin_left - 1, self->priv->mouse_y - 3, l);
		_g_free0 (tmp);
	}
	tmp = NULL;
	val = ddb_equalizer_scale (self, (double) 1);
	_tmp9_ = NULL;
	if (val > 0) {
		_tmp9_ = "+";
	} else {
		_tmp9_ = "";
	}
	tmp = (_tmp10_ = g_strdup_printf ("%s%.1fdB", _tmp9_, val), _g_free0 (tmp), _tmp10_);
	pango_layout_set_text (l, tmp, (gint) g_utf8_strlen (tmp, -1));
	gdk_draw_layout (d, gc, self->priv->margin_left - 1, (height - self->priv->margin_bottom) - fontsize, l);
	val = ddb_equalizer_scale (self, (double) 0);
	_tmp11_ = NULL;
	if (val > 0) {
		_tmp11_ = "+";
	} else {
		_tmp11_ = "";
	}
	tmp = (_tmp12_ = g_strdup_printf ("%s%.1fdB", _tmp11_, val), _g_free0 (tmp), _tmp12_);
	pango_layout_set_text (l, tmp, (gint) g_utf8_strlen (tmp, -1));
	gdk_draw_layout (d, gc, self->priv->margin_left - 1, 1, l);
	pango_layout_set_text (l, "+0dB", 4);
	gdk_draw_layout (d, gc, self->priv->margin_left - 1, ((gint) ((1 - self->priv->preamp) * (height - self->priv->margin_bottom))) - (fontsize / 2), l);
	pango_layout_set_text (l, "preamp", 6);
	pango_layout_set_alignment (l, PANGO_ALIGN_LEFT);
	gdk_draw_layout (d, gc, 1, (height - self->priv->margin_bottom) + 2, l);
	gdk_draw_rectangle (d, gc, FALSE, self->priv->margin_left, 0, (width - self->priv->margin_left) - 1, (height - self->priv->margin_bottom) - 1);
	gdk_gc_set_line_attributes (gc, 2, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
	gdk_gc_set_clip_rectangle (gc, (_tmp14_ = (_tmp13_.x = 0, _tmp13_.y = (gint) (self->priv->preamp * (height - self->priv->margin_bottom)), _tmp13_.width = 11, _tmp13_.height = height, _tmp13_), &_tmp14_));
	gdk_gc_set_rgb_fg_color (gc, &fore_bright_color);
	count = ((gint) ((height - self->priv->margin_bottom) / 6)) + 1;
	{
		gint j;
		j = 0;
		{
			gboolean _tmp15_;
			_tmp15_ = TRUE;
			while (TRUE) {
				if (!_tmp15_) {
					j++;
				}
				_tmp15_ = FALSE;
				if (!(j < count)) {
					break;
				}
				gdk_draw_rectangle (d, gc, TRUE, 1, ((height - self->priv->margin_bottom) - (j * 6)) - 6, 11, 4);
			}
		}
	}
	gdk_gc_set_clip_rectangle (gc, (_tmp17_ = (_tmp16_.x = self->priv->margin_left + 1, _tmp16_.y = 1, _tmp16_.width = (width - self->priv->margin_left) - 2, _tmp16_.height = (height - self->priv->margin_bottom) - 2, _tmp16_), &_tmp17_));
	gdk_gc_set_rgb_fg_color (gc, &fore_bright_color);
	bar_w = 11;
	if (step < bar_w) {
		bar_w = ((gint) step) - 1;
	}
	{
		gboolean _tmp18_;
		i = 0;
		_tmp18_ = TRUE;
		while (TRUE) {
			GdkRectangle _tmp19_ = {0};
			GdkRectangle _tmp20_;
			if (!_tmp18_) {
				i++;
			}
			_tmp18_ = FALSE;
			if (!(i < DDB_EQUALIZER_bands)) {
				break;
			}
			gdk_gc_set_clip_rectangle (gc, (_tmp20_ = (_tmp19_.x = (((gint) ((i + 1) * step)) + self->priv->margin_left) - (bar_w / 2), _tmp19_.y = (gint) (self->priv->values[i] * (height - self->priv->margin_bottom)), _tmp19_.width = 11, _tmp19_.height = height, _tmp19_), &_tmp20_));
			count = ((gint) (((height - self->priv->margin_bottom) * (1 - self->priv->values[i])) / 6)) + 1;
			{
				gint j;
				j = 0;
				{
					gboolean _tmp21_;
					_tmp21_ = TRUE;
					while (TRUE) {
						if (!_tmp21_) {
							j++;
						}
						_tmp21_ = FALSE;
						if (!(j < count)) {
							break;
						}
						gdk_draw_rectangle (d, gc, TRUE, (((gint) ((i + 1) * step)) + self->priv->margin_left) - (bar_w / 2), ((height - self->priv->margin_bottom) - (j * 6)) - 6, bar_w, 4);
					}
				}
			}
		}
	}
	gdk_gc_set_clip_rectangle (gc, (_tmp23_ = (_tmp22_.x = 0, _tmp22_.y = 0, _tmp22_.width = width, _tmp22_.height = height, _tmp22_), &_tmp23_));
	gdk_gc_set_line_attributes (gc, 1, GDK_LINE_ON_OFF_DASH, GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
	gdk_draw_line (d, gc, self->priv->margin_left + 1, self->priv->mouse_y, width, self->priv->mouse_y);
	result = FALSE;
	_g_free0 (tmp);
	_pango_font_description_free0 (fd);
	_g_object_unref0 (ctx);
	_g_object_unref0 (l);
	_g_object_unref0 (gc);
	_g_object_unref0 (d);
	return result;
}