Commit f374377e authored by Michael Natterer's avatar Michael Natterer 😴
Browse files

app: pass the widget to all gimp_view_renderer_render_foo() functions

We will need the widget for color managing previews; it's also more
consistent to pass the widget to all render_foo() functions, not only
to render_icon().
parent 9775b208
......@@ -71,11 +71,8 @@ static void gimp_view_renderer_real_render (GimpViewRenderer *rende
static void gimp_view_renderer_size_changed (GimpViewRenderer *renderer,
GimpViewable *viewable);
static cairo_pattern_t *
gimp_view_renderer_create_background (GimpViewRenderer *renderer,
GtkWidget *widget);
static void gimp_view_render_temp_buf_to_surface (GimpViewRenderer *renderer,
GtkWidget *widget,
GimpTempBuf *temp_buf,
gint temp_buf_x,
gint temp_buf_y,
......@@ -86,6 +83,10 @@ static void gimp_view_render_temp_buf_to_surface (GimpViewRenderer *rende
gint dest_width,
gint dest_height);
static cairo_pattern_t *
gimp_view_renderer_create_background (GimpViewRenderer *renderer,
GtkWidget *widget);
G_DEFINE_TYPE (GimpViewRenderer, gimp_view_renderer, G_TYPE_OBJECT)
......@@ -761,7 +762,7 @@ gimp_view_renderer_real_render (GimpViewRenderer *renderer,
renderer->height);
if (pixbuf)
{
gimp_view_renderer_render_pixbuf (renderer, pixbuf);
gimp_view_renderer_render_pixbuf (renderer, widget, pixbuf);
return;
}
......@@ -771,7 +772,7 @@ gimp_view_renderer_real_render (GimpViewRenderer *renderer,
renderer->height);
if (temp_buf)
{
gimp_view_renderer_render_temp_buf_simple (renderer, temp_buf);
gimp_view_renderer_render_temp_buf_simple (renderer, widget, temp_buf);
return;
}
......@@ -795,6 +796,7 @@ gimp_view_renderer_size_changed (GimpViewRenderer *renderer,
void
gimp_view_renderer_render_temp_buf_simple (GimpViewRenderer *renderer,
GtkWidget *widget,
GimpTempBuf *temp_buf)
{
gint temp_buf_x = 0;
......@@ -814,7 +816,7 @@ gimp_view_renderer_render_temp_buf_simple (GimpViewRenderer *renderer,
if (temp_buf_height < renderer->height)
temp_buf_y = (renderer->height - temp_buf_height) / 2;
gimp_view_renderer_render_temp_buf (renderer, temp_buf,
gimp_view_renderer_render_temp_buf (renderer, widget, temp_buf,
temp_buf_x, temp_buf_y,
-1,
GIMP_VIEW_BG_CHECKS,
......@@ -823,6 +825,7 @@ gimp_view_renderer_render_temp_buf_simple (GimpViewRenderer *renderer,
void
gimp_view_renderer_render_temp_buf (GimpViewRenderer *renderer,
GtkWidget *widget,
GimpTempBuf *temp_buf,
gint temp_buf_x,
gint temp_buf_y,
......@@ -842,6 +845,7 @@ gimp_view_renderer_render_temp_buf (GimpViewRenderer *renderer,
renderer->height);
gimp_view_render_temp_buf_to_surface (renderer,
widget,
temp_buf,
temp_buf_x,
temp_buf_y,
......@@ -858,6 +862,7 @@ gimp_view_renderer_render_temp_buf (GimpViewRenderer *renderer,
void
gimp_view_renderer_render_pixbuf (GimpViewRenderer *renderer,
GtkWidget *widget,
GdkPixbuf *pixbuf)
{
if (renderer->surface)
......@@ -933,6 +938,7 @@ gimp_view_renderer_render_icon (GimpViewRenderer *renderer,
static void
gimp_view_render_temp_buf_to_surface (GimpViewRenderer *renderer,
GtkWidget *widget,
GimpTempBuf *temp_buf,
gint temp_buf_x,
gint temp_buf_y,
......
......@@ -141,8 +141,10 @@ void gimp_view_renderer_draw (GimpViewRenderer *renderer,
/* protected */
void gimp_view_renderer_render_temp_buf_simple (GimpViewRenderer *renderer,
GtkWidget *widget,
GimpTempBuf *temp_buf);
void gimp_view_renderer_render_temp_buf (GimpViewRenderer *renderer,
GtkWidget *widget,
GimpTempBuf *temp_buf,
gint temp_buf_x,
gint temp_buf_y,
......@@ -150,6 +152,7 @@ void gimp_view_renderer_render_temp_buf (GimpViewRenderer *renderer,
GimpViewBG inside_bg,
GimpViewBG outside_bg);
void gimp_view_renderer_render_pixbuf (GimpViewRenderer *renderer,
GtkWidget *widget,
GdkPixbuf *pixbuf);
void gimp_view_renderer_render_icon (GimpViewRenderer *renderer,
GtkWidget *widget,
......
......@@ -116,7 +116,7 @@ gimp_view_renderer_brush_render (GimpViewRenderer *renderer,
if (renderer->is_popup)
{
gimp_view_renderer_render_temp_buf (renderer, temp_buf,
gimp_view_renderer_render_temp_buf (renderer, widget, temp_buf,
temp_buf_x, temp_buf_y,
-1,
GIMP_VIEW_BG_WHITE,
......@@ -126,6 +126,7 @@ gimp_view_renderer_brush_render (GimpViewRenderer *renderer,
if (GIMP_IS_BRUSH_PIPE (renderer->viewable))
{
renderbrush->widget = widget;
renderbrush->pipe_animation_index = 0;
renderbrush->pipe_timeout_id =
g_timeout_add (300, gimp_view_renderer_brush_render_timeout,
......@@ -135,7 +136,7 @@ gimp_view_renderer_brush_render (GimpViewRenderer *renderer,
return;
}
gimp_view_renderer_render_temp_buf (renderer, temp_buf,
gimp_view_renderer_render_temp_buf (renderer, widget, temp_buf,
temp_buf_x, temp_buf_y,
-1,
GIMP_VIEW_BG_WHITE,
......@@ -189,7 +190,7 @@ gimp_view_renderer_brush_render_timeout (gpointer data)
if (temp_buf_height < renderer->height)
temp_buf_y = (renderer->height - temp_buf_height) / 2;
gimp_view_renderer_render_temp_buf (renderer, temp_buf,
gimp_view_renderer_render_temp_buf (renderer, renderbrush->widget, temp_buf,
temp_buf_x, temp_buf_y,
-1,
GIMP_VIEW_BG_WHITE,
......
......@@ -39,6 +39,9 @@ struct _GimpViewRendererBrush
guint pipe_timeout_id;
gint pipe_animation_index;
/* for the pipe render animation timeout */
GtkWidget *widget;
};
struct _GimpViewRendererBrushClass
......
......@@ -102,7 +102,7 @@ gimp_view_renderer_buffer_render (GimpViewRenderer *renderer,
if (render_buf)
{
gimp_view_renderer_render_temp_buf_simple (renderer, render_buf);
gimp_view_renderer_render_temp_buf_simple (renderer, widget, render_buf);
gimp_temp_buf_unref (render_buf);
}
......
......@@ -228,7 +228,7 @@ gimp_view_renderer_drawable_render (GimpViewRenderer *renderer,
render_buf_y = (height - view_height) / 2;
}
gimp_view_renderer_render_temp_buf (renderer, render_buf,
gimp_view_renderer_render_temp_buf (renderer, widget, render_buf,
render_buf_x, render_buf_y,
-1,
GIMP_VIEW_BG_CHECKS,
......
......@@ -145,7 +145,7 @@ gimp_view_renderer_image_render (GimpViewRenderer *renderer,
component_index =
gimp_image_get_component_index (image, rendererimage->channel);
gimp_view_renderer_render_temp_buf (renderer, render_buf,
gimp_view_renderer_render_temp_buf (renderer, widget, render_buf,
render_buf_x, render_buf_y,
component_index,
GIMP_VIEW_BG_CHECKS,
......
......@@ -84,7 +84,7 @@ gimp_view_renderer_imagefile_render (GimpViewRenderer *renderer,
if (pixbuf)
{
gimp_view_renderer_render_pixbuf (renderer, pixbuf);
gimp_view_renderer_render_pixbuf (renderer, widget, pixbuf);
g_object_unref (pixbuf);
}
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment