app, pdb: use the real theme background color for brushes with GIMP_VIEW_BG_USE_STYLE.

Previous code was using the correct background color from the theme, but
the foreground color was always either white or black (depending on GUI
config color scheme). Instead, just use the foreground color from theme.

Since core/ doesn't have access to GTK, hence the theme, we had to
update GimpViewable's get_preview() and get_pixbuf() abstract methods to
have a color argument for recoloring previews (when relevant, which for
most types of viewables is not).
This commit is contained in:
Jehan 2025-04-22 20:33:49 +02:00
parent 55658facb4
commit 3038c751bc
33 changed files with 223 additions and 104 deletions

View file

@ -26,8 +26,6 @@
#include "core-types.h"
#include "config/gimpguiconfig.h"
#include "gimp.h"
#include "gimpbezierdesc.h"
#include "gimpbrush.h"
@ -81,7 +79,8 @@ static gboolean gimp_brush_get_size (GimpViewable *vie
static GimpTempBuf * gimp_brush_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
static gchar * gimp_brush_get_description (GimpViewable *viewable,
gchar **tooltip);
@ -274,7 +273,8 @@ static GimpTempBuf *
gimp_brush_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color)
{
GimpBrush *brush = GIMP_BRUSH (viewable);
const GimpTempBuf *mask_buf = brush->priv->mask;
@ -370,13 +370,10 @@ gimp_brush_get_new_preview (GimpViewable *viewable,
}
else
{
GimpGuiConfig *config;
guint8 rgb[3] = {0, 0, 0};
guint8 rgb[3] = {0, 0, 0};
config = GIMP_GUI_CONFIG (context->gimp->config);
if (config->theme_scheme == GIMP_THEME_DARK)
rgb[0] = rgb[1] = rgb[2] = 255;
if (color != NULL)
gegl_color_get_pixel (color, babl_format ("R'G'B' u8"), rgb);
for (y = 0; y < mask_height; y++)
{

View file

@ -61,11 +61,13 @@ static gboolean gimp_buffer_get_popup_size (GimpViewable *viewable,
static GimpTempBuf * gimp_buffer_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
static GdkPixbuf * gimp_buffer_get_new_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
static gchar * gimp_buffer_get_description (GimpViewable *viewable,
gchar **tooltip);
@ -224,7 +226,8 @@ static GimpTempBuf *
gimp_buffer_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color G_GNUC_UNUSED)
{
GimpBuffer *buffer = GIMP_BUFFER (viewable);
const Babl *format = gimp_buffer_get_format (buffer);
@ -258,7 +261,8 @@ static GdkPixbuf *
gimp_buffer_get_new_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color G_GNUC_UNUSED)
{
GimpBuffer *buffer = GIMP_BUFFER (viewable);
GdkPixbuf *pixbuf;

View file

@ -86,7 +86,8 @@ static gboolean gimp_curve_get_popup_size (GimpViewable *viewable,
static GimpTempBuf * gimp_curve_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
static gchar * gimp_curve_get_description (GimpViewable *viewable,
gchar **tooltip);
@ -521,7 +522,8 @@ static GimpTempBuf *
gimp_curve_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color G_GNUC_UNUSED)
{
return NULL;
}

View file

@ -112,7 +112,8 @@ GimpTempBuf *
gimp_drawable_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color G_GNUC_UNUSED)
{
GimpItem *item = GIMP_ITEM (viewable);
GimpImage *image = gimp_item_get_image (item);
@ -132,7 +133,8 @@ GdkPixbuf *
gimp_drawable_get_new_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color G_GNUC_UNUSED)
{
GimpItem *item = GIMP_ITEM (viewable);
GimpImage *image = gimp_item_get_image (item);

View file

@ -25,11 +25,13 @@
GimpTempBuf * gimp_drawable_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
GdkPixbuf * gimp_drawable_get_new_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
/*
* normal functions (no virtuals)

View file

@ -60,7 +60,8 @@ static gboolean gimp_gradient_get_popup_size (GimpViewable *viewa
static GimpTempBuf * gimp_gradient_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
static const gchar * gimp_gradient_get_extension (GimpData *data);
static void gimp_gradient_copy (GimpData *data,
@ -213,7 +214,8 @@ static GimpTempBuf *
gimp_gradient_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color G_GNUC_UNUSED)
{
GimpGradient *gradient = GIMP_GRADIENT (viewable);
GimpGradientSegment *seg = NULL;

View file

@ -121,7 +121,8 @@ GimpTempBuf *
gimp_image_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color G_GNUC_UNUSED)
{
GimpImage *image = GIMP_IMAGE (viewable);
const Babl *format;
@ -150,7 +151,8 @@ GdkPixbuf *
gimp_image_get_new_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color G_GNUC_UNUSED)
{
GimpImage *image = GIMP_IMAGE (viewable);
GdkPixbuf *pixbuf;

View file

@ -41,11 +41,13 @@ gboolean gimp_image_get_popup_size (GimpViewable *viewable,
GimpTempBuf * gimp_image_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
GdkPixbuf * gimp_image_get_new_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
#endif /* __GIMP_IMAGE_PREVIEW_H__ */

View file

@ -84,7 +84,8 @@ static void gimp_imagefile_name_changed (GimpObject *object);
static GdkPixbuf * gimp_imagefile_get_new_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
static gchar * gimp_imagefile_get_description (GimpViewable *viewable,
gchar **tooltip);
@ -224,7 +225,8 @@ static GdkPixbuf *
gimp_imagefile_get_new_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color G_GNUC_UNUSED)
{
GimpImagefile *imagefile = GIMP_IMAGEFILE (viewable);
@ -1061,7 +1063,7 @@ gimp_imagefile_save_thumb (GimpImagefile *imagefile,
pixbuf = gimp_viewable_get_new_pixbuf (GIMP_VIEWABLE (image),
/* random context, unused */
gimp_get_user_context (image->gimp),
width, height);
width, height, NULL);
/* when layer previews are disabled, we won't get a pixbuf */
if (! pixbuf)

View file

@ -93,11 +93,13 @@ static gboolean gimp_image_proxy_get_popup_size (GimpViewabl
static GimpTempBuf * gimp_image_proxy_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
static GdkPixbuf * gimp_image_proxy_get_new_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
static gchar * gimp_image_proxy_get_description (GimpViewable *viewable,
gchar **tooltip);
@ -373,7 +375,8 @@ static GimpTempBuf *
gimp_image_proxy_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color G_GNUC_UNUSED)
{
GimpImageProxy *image_proxy = GIMP_IMAGE_PROXY (viewable);
GimpImage *image = image_proxy->priv->image;
@ -414,7 +417,8 @@ static GdkPixbuf *
gimp_image_proxy_get_new_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color G_GNUC_UNUSED)
{
GimpImageProxy *image_proxy = GIMP_IMAGE_PROXY (viewable);
GimpImage *image = image_proxy->priv->image;

View file

@ -75,7 +75,8 @@ static gboolean gimp_palette_get_popup_size (GimpViewable *vie
static GimpTempBuf * gimp_palette_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
static gchar * gimp_palette_get_description (GimpViewable *viewable,
gchar **tooltip);
static const gchar * gimp_palette_get_extension (GimpData *data);
@ -239,7 +240,8 @@ static GimpTempBuf *
gimp_palette_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color G_GNUC_UNUSED)
{
GimpPalette *palette = GIMP_PALETTE (viewable);
GimpTempBuf *temp_buf;

View file

@ -49,7 +49,8 @@ static gboolean gimp_pattern_get_size (GimpViewable *viewa
static GimpTempBuf * gimp_pattern_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
static gchar * gimp_pattern_get_description (GimpViewable *viewable,
gchar **tooltip);
@ -141,7 +142,8 @@ static GimpTempBuf *
gimp_pattern_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color G_GNUC_UNUSED)
{
GimpPattern *pattern = GIMP_PATTERN (viewable);
GimpTempBuf *temp_buf;

View file

@ -82,7 +82,8 @@ static gboolean gimp_undo_get_popup_size (GimpViewable *viewabl
static GimpTempBuf * gimp_undo_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
static void gimp_undo_real_pop (GimpUndo *undo,
GimpUndoMode undo_mode,
@ -301,7 +302,8 @@ static GimpTempBuf *
gimp_undo_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color)
{
GimpUndo *undo = GIMP_UNDO (viewable);
@ -491,7 +493,7 @@ gimp_undo_create_preview_private (GimpUndo *undo,
}
undo->preview = gimp_viewable_get_new_preview (preview_viewable, context,
width, height);
width, height, NULL);
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (undo));
}

View file

@ -100,7 +100,8 @@ static void gimp_viewable_real_ancestry_changed (GimpViewable *viewable);
static GdkPixbuf * gimp_viewable_real_get_new_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
static void gimp_viewable_real_get_preview_size (GimpViewable *viewable,
gint size,
gboolean popup,
@ -402,13 +403,14 @@ static GdkPixbuf *
gimp_viewable_real_get_new_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color)
{
GimpViewablePrivate *private = GET_PRIVATE (viewable);
GdkPixbuf *pixbuf = NULL;
GimpTempBuf *temp_buf;
temp_buf = gimp_viewable_get_preview (viewable, context, width, height);
temp_buf = gimp_viewable_get_preview (viewable, context, width, height, color);
if (temp_buf)
{
@ -827,6 +829,8 @@ gimp_viewable_get_popup_size (GimpViewable *viewable,
* @context: The context to render the preview for.
* @width: desired width for the preview
* @height: desired height for the preview
* @color: desired foreground color for the preview when the type of
* @viewable support recolorization.
*
* Gets a preview for a viewable object, by running through a variety
* of methods until it finds one that works. First, if an
@ -838,6 +842,12 @@ gimp_viewable_get_popup_size (GimpViewable *viewable,
* method, and executes it, caching the result. If everything fails,
* %NULL is returned.
*
* When a drawable can be recolored (for instance a generated or mask
* brush), then @color will be used. Note that in many cases, viewables
* cannot be recolored (e.g. images, layers or color brushes).
* When setting @color to %NULL on a recolorable viewable, the used
* color may be anything.
*
* Returns: (nullable): A #GimpTempBuf containing the preview image, or %NULL if
* none can be found or created.
**/
@ -845,7 +855,8 @@ GimpTempBuf *
gimp_viewable_get_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color)
{
GimpViewablePrivate *private = GET_PRIVATE (viewable);
GimpViewableClass *viewable_class;
@ -862,7 +873,7 @@ gimp_viewable_get_preview (GimpViewable *viewable,
viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable);
if (viewable_class->get_preview)
temp_buf = viewable_class->get_preview (viewable, context, width, height);
temp_buf = viewable_class->get_preview (viewable, context, width, height, color);
if (temp_buf)
return temp_buf;
@ -880,7 +891,7 @@ gimp_viewable_get_preview (GimpViewable *viewable,
if (viewable_class->get_new_preview)
temp_buf = viewable_class->get_new_preview (viewable, context,
width, height);
width, height, color);
private->preview_temp_buf = temp_buf;
@ -892,6 +903,8 @@ gimp_viewable_get_preview (GimpViewable *viewable,
* @viewable: The viewable object to get a preview for.
* @width: desired width for the preview
* @height: desired height for the preview
* @color: desired foreground color for the preview when the type of
* @viewable support recolorization.
*
* Gets a new preview for a viewable object. Similar to
* gimp_viewable_get_preview(), except that it tries things in a
@ -906,7 +919,8 @@ GimpTempBuf *
gimp_viewable_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color)
{
GimpViewableClass *viewable_class;
GimpTempBuf *temp_buf = NULL;
@ -923,14 +937,14 @@ gimp_viewable_get_new_preview (GimpViewable *viewable,
if (viewable_class->get_new_preview)
temp_buf = viewable_class->get_new_preview (viewable, context,
width, height);
width, height, color);
if (temp_buf)
return temp_buf;
if (viewable_class->get_preview)
temp_buf = viewable_class->get_preview (viewable, context,
width, height);
width, height, color);
if (temp_buf)
return gimp_temp_buf_copy (temp_buf);
@ -982,6 +996,8 @@ gimp_viewable_get_dummy_preview (GimpViewable *viewable,
* @context: The context to render the preview for.
* @width: desired width for the preview
* @height: desired height for the preview
* @color: desired foreground color for the preview when the type of
* @viewable support recolorization.
*
* Gets a preview for a viewable object, by running through a variety
* of methods until it finds one that works. First, if an
@ -1000,7 +1016,8 @@ GdkPixbuf *
gimp_viewable_get_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color)
{
GimpViewablePrivate *private = GET_PRIVATE (viewable);
GimpViewableClass *viewable_class;
@ -1017,7 +1034,7 @@ gimp_viewable_get_pixbuf (GimpViewable *viewable,
viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable);
if (viewable_class->get_pixbuf)
pixbuf = viewable_class->get_pixbuf (viewable, context, width, height);
pixbuf = viewable_class->get_pixbuf (viewable, context, width, height, color);
if (pixbuf)
return pixbuf;
@ -1034,7 +1051,7 @@ gimp_viewable_get_pixbuf (GimpViewable *viewable,
}
if (viewable_class->get_new_pixbuf)
pixbuf = viewable_class->get_new_pixbuf (viewable, context, width, height);
pixbuf = viewable_class->get_new_pixbuf (viewable, context, width, height, color);
private->preview_pixbuf = pixbuf;
@ -1047,6 +1064,8 @@ gimp_viewable_get_pixbuf (GimpViewable *viewable,
* @context: The context to render the preview for.
* @width: desired width for the pixbuf
* @height: desired height for the pixbuf
* @color: desired foreground color for the preview when the type of
* @viewable support recolorization.
*
* Gets a new preview for a viewable object. Similar to
* gimp_viewable_get_pixbuf(), except that it tries things in a
@ -1061,7 +1080,8 @@ GdkPixbuf *
gimp_viewable_get_new_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color)
{
GimpViewableClass *viewable_class;
GdkPixbuf *pixbuf = NULL;
@ -1077,13 +1097,13 @@ gimp_viewable_get_new_pixbuf (GimpViewable *viewable,
viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable);
if (viewable_class->get_new_pixbuf)
pixbuf = viewable_class->get_new_pixbuf (viewable, context, width, height);
pixbuf = viewable_class->get_new_pixbuf (viewable, context, width, height, color);
if (pixbuf)
return pixbuf;
if (viewable_class->get_pixbuf)
pixbuf = viewable_class->get_pixbuf (viewable, context, width, height);
pixbuf = viewable_class->get_pixbuf (viewable, context, width, height, color);
if (pixbuf)
return gdk_pixbuf_copy (pixbuf);

View file

@ -79,19 +79,23 @@ struct _GimpViewableClass
GimpTempBuf * (* get_preview) (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *fg_color);
GimpTempBuf * (* get_new_preview) (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *fg_color);
GdkPixbuf * (* get_pixbuf) (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *fg_color);
GdkPixbuf * (* get_new_pixbuf) (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *fg_color);
gchar * (* get_description) (GimpViewable *viewable,
gchar **tooltip);
@ -144,11 +148,13 @@ gboolean gimp_viewable_get_popup_size (GimpViewable *viewable,
GimpTempBuf * gimp_viewable_get_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *fg_color);
GimpTempBuf * gimp_viewable_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *fg_color);
GimpTempBuf * gimp_viewable_get_dummy_preview (GimpViewable *viewable,
gint width,
@ -158,11 +164,13 @@ GimpTempBuf * gimp_viewable_get_dummy_preview (GimpViewable *viewable,
GdkPixbuf * gimp_viewable_get_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
GdkPixbuf * gimp_viewable_get_new_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
GdkPixbuf * gimp_viewable_get_dummy_pixbuf (GimpViewable *viewable,
gint width,

View file

@ -163,7 +163,7 @@ gimp_image_metadata_rotate_dialog (GimpImage *image,
gimp_pickable_flush (GIMP_PICKABLE (image));
pixbuf = gimp_viewable_get_pixbuf (GIMP_VIEWABLE (image), context,
width, height);
width, height, NULL);
if (pixbuf)
{
GdkPixbuf *rotated;

View file

@ -429,7 +429,7 @@ resize_dialog_new (GimpViewable *viewable,
gimp_viewable_get_preview_size (viewable, 200, TRUE, TRUE, &width, &height);
pixbuf = gimp_viewable_get_pixbuf (viewable, context,
width, height);
width, height, NULL);
if (pixbuf)
gimp_offset_area_set_pixbuf (GIMP_OFFSET_AREA (private->area), pixbuf);

View file

@ -980,7 +980,7 @@ drawable_thumbnail_invoker (GimpProcedure *procedure,
if (image->gimp->config->layer_previews)
buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (drawable), context,
width, height);
width, height, NULL);
else
buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable),
width, height,

View file

@ -1849,7 +1849,7 @@ image_thumbnail_invoker (GimpProcedure *procedure,
gimp_pickable_flush (GIMP_PICKABLE (image));
buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (image), context,
width, height);
width, height, NULL);
if (buf)
{

View file

@ -133,7 +133,8 @@ static gboolean gimp_font_get_popup_size (GimpViewable *viewab
static GimpTempBuf * gimp_font_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
static void gimp_font_config_iface_init (GimpConfigInterface *iface);
static gboolean gimp_font_serialize (GimpConfig *config,
@ -710,7 +711,8 @@ static GimpTempBuf *
gimp_font_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color)
{
GimpFont *font = GIMP_FONT (viewable);
PangoContext *pango_context;

View file

@ -40,7 +40,8 @@ GimpTempBuf *
gimp_path_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
gint height,
GeglColor *color)
{
GimpPath *path;
GimpItem *item;

View file

@ -26,7 +26,8 @@
GimpTempBuf * gimp_path_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
gint height,
GeglColor *color);
#endif /* __GIMP_PATH_PREVIEW_H__ */

View file

@ -1171,7 +1171,8 @@ gimp_clipboard_send_image (GtkClipboard *clipboard,
pixbuf = gimp_viewable_get_pixbuf (GIMP_VIEWABLE (gimp_clip->image),
gimp_get_user_context (gimp),
gimp_image_get_width (gimp_clip->image),
gimp_image_get_height (gimp_clip->image));
gimp_image_get_height (gimp_clip->image),
NULL);
if (pixbuf)
{
@ -1216,7 +1217,8 @@ gimp_clipboard_send_buffer (GtkClipboard *clipboard,
pixbuf = gimp_viewable_get_pixbuf (GIMP_VIEWABLE (gimp_clip->buffer),
gimp_get_user_context (gimp),
gimp_buffer_get_width (gimp_clip->buffer),
gimp_buffer_get_height (gimp_clip->buffer));
gimp_buffer_get_height (gimp_clip->buffer),
NULL);
if (pixbuf)
{

View file

@ -814,7 +814,7 @@ gimp_container_icon_view_drag_pixbuf (GtkWidget *widget,
if (renderer && gimp_viewable_get_size (renderer->viewable, &width, &height))
return gimp_viewable_get_new_pixbuf (renderer->viewable,
renderer->context,
width, height);
width, height, NULL);
return NULL;
}

View file

@ -1827,7 +1827,7 @@ gimp_container_tree_view_drag_pixbuf (GtkWidget *widget,
if (renderer && gimp_viewable_get_size (renderer->viewable, &width, &height))
return gimp_viewable_get_new_pixbuf (renderer->viewable,
renderer->context,
width, height);
width, height, NULL);
return NULL;
}

View file

@ -848,7 +848,7 @@ gimp_view_drag_pixbuf (GtkWidget *widget,
if (viewable && gimp_viewable_get_size (viewable, &width, &height))
return gimp_viewable_get_new_pixbuf (viewable, view->renderer->context,
width, height);
width, height, NULL);
return NULL;
}

View file

@ -234,7 +234,7 @@ gimp_view_renderer_get_frame_pixbuf (GimpViewRenderer *renderer,
{
pixbuf = gimp_viewable_get_pixbuf (renderer->viewable,
renderer->context,
w, h);
w, h, NULL);
if (!pixbuf)
return NULL;
@ -251,7 +251,8 @@ gimp_view_renderer_get_frame_pixbuf (GimpViewRenderer *renderer,
{
pixbuf = gimp_viewable_get_pixbuf (renderer->viewable,
renderer->context,
width - 2, height - 2);
width - 2, height - 2,
NULL);
if (!pixbuf)
return NULL;

View file

@ -801,15 +801,32 @@ static void
gimp_view_renderer_real_render (GimpViewRenderer *renderer,
GtkWidget *widget)
{
GdkPixbuf *pixbuf;
GimpTempBuf *temp_buf;
const gchar *icon_name;
gint scale_factor = gtk_widget_get_scale_factor (widget);
GdkPixbuf *pixbuf;
GimpTempBuf *temp_buf;
const gchar *icon_name;
GeglColor *color = NULL;
GdkRGBA *fg_color = NULL;
GtkStyleContext *style;
gint scale_factor = gtk_widget_get_scale_factor (widget);
style = gtk_widget_get_style_context (widget);
gtk_style_context_get (style, gtk_style_context_get_state (style),
GTK_STYLE_PROPERTY_COLOR, &fg_color,
NULL);
if (fg_color)
{
color = gegl_color_new (NULL);
gegl_color_set_rgba_with_space (color,
fg_color->red, fg_color->green, fg_color->blue, 1.0,
NULL);
}
g_clear_pointer (&fg_color, gdk_rgba_free);
pixbuf = gimp_viewable_get_pixbuf (renderer->viewable,
renderer->context,
renderer->width * scale_factor,
renderer->height * scale_factor);
renderer->height * scale_factor,
color);
if (pixbuf)
{
gimp_view_renderer_render_pixbuf (renderer, widget, pixbuf);
@ -819,7 +836,8 @@ gimp_view_renderer_real_render (GimpViewRenderer *renderer,
temp_buf = gimp_viewable_get_preview (renderer->viewable,
renderer->context,
renderer->width,
renderer->height);
renderer->height,
color);
if (temp_buf)
{
gimp_view_renderer_render_temp_buf_simple (renderer, widget, temp_buf);
@ -828,6 +846,8 @@ gimp_view_renderer_real_render (GimpViewRenderer *renderer,
icon_name = gimp_viewable_get_icon_name (renderer->viewable);
gimp_view_renderer_render_icon (renderer, widget, icon_name);
g_clear_object (&color);
}
static void

View file

@ -87,10 +87,14 @@ static void
gimp_view_renderer_brush_render (GimpViewRenderer *renderer,
GtkWidget *widget)
{
GimpViewRendererBrush *renderbrush = GIMP_VIEW_RENDERER_BRUSH (renderer);
GimpViewRendererBrush *renderbrush = GIMP_VIEW_RENDERER_BRUSH (renderer);
GimpTempBuf *temp_buf;
gint temp_buf_x = 0;
gint temp_buf_y = 0;
GeglColor *color = NULL;
GdkRGBA *fg_color = NULL;
GtkStyleContext *style;
GimpViewBG view_bg_style = GIMP_VIEW_BG_WHITE;
gint temp_buf_x = 0;
gint temp_buf_y = 0;
gint temp_buf_width;
gint temp_buf_height;
@ -100,10 +104,23 @@ gimp_view_renderer_brush_render (GimpViewRenderer *renderer,
renderbrush->pipe_timeout_id = 0;
}
temp_buf = gimp_viewable_get_new_preview (renderer->viewable,
renderer->context,
renderer->width,
renderer->height);
style = gtk_widget_get_style_context (widget);
gtk_style_context_get (style, gtk_style_context_get_state (style),
GTK_STYLE_PROPERTY_COLOR, &fg_color,
NULL);
if (fg_color)
{
color = gegl_color_new (NULL);
gegl_color_set_rgba_with_space (color,
fg_color->red, fg_color->green, fg_color->blue, 1.0,
NULL);
view_bg_style = GIMP_VIEW_BG_USE_STYLE;
}
g_clear_pointer (&fg_color, gdk_rgba_free);
temp_buf = gimp_viewable_get_new_preview (renderer->viewable, renderer->context,
renderer->width, renderer->height, color);
g_clear_object (&color);
temp_buf_width = gimp_temp_buf_get_width (temp_buf);
temp_buf_height = gimp_temp_buf_get_height (temp_buf);
@ -119,8 +136,8 @@ gimp_view_renderer_brush_render (GimpViewRenderer *renderer,
gimp_view_renderer_render_temp_buf (renderer, widget, temp_buf,
temp_buf_x, temp_buf_y,
-1,
GIMP_VIEW_BG_USE_STYLE,
GIMP_VIEW_BG_USE_STYLE);
view_bg_style,
view_bg_style);
gimp_temp_buf_unref (temp_buf);
@ -139,8 +156,8 @@ gimp_view_renderer_brush_render (GimpViewRenderer *renderer,
gimp_view_renderer_render_temp_buf (renderer, widget, temp_buf,
temp_buf_x, temp_buf_y,
-1,
GIMP_VIEW_BG_USE_STYLE,
GIMP_VIEW_BG_USE_STYLE);
view_bg_style,
view_bg_style);
gimp_temp_buf_unref (temp_buf);
}
@ -153,6 +170,10 @@ gimp_view_renderer_brush_render_timeout (gpointer data)
GimpBrushPipe *brush_pipe;
GimpBrush *brush;
GimpTempBuf *temp_buf;
GeglColor *color = NULL;
GdkRGBA *fg_color = NULL;
GtkStyleContext *style;
GimpViewBG view_bg_style = GIMP_VIEW_BG_WHITE;
gint temp_buf_x = 0;
gint temp_buf_y = 0;
gint temp_buf_width;
@ -168,6 +189,20 @@ gimp_view_renderer_brush_render_timeout (gpointer data)
brush_pipe = GIMP_BRUSH_PIPE (renderer->viewable);
style = gtk_widget_get_style_context (renderbrush->widget);
gtk_style_context_get (style, gtk_style_context_get_state (style),
GTK_STYLE_PROPERTY_COLOR, &fg_color,
NULL);
if (fg_color)
{
color = gegl_color_new (NULL);
gegl_color_set_rgba_with_space (color,
fg_color->red, fg_color->green, fg_color->blue, 1.0,
NULL);
view_bg_style = GIMP_VIEW_BG_USE_STYLE;
}
g_clear_pointer (&fg_color, gdk_rgba_free);
renderbrush->pipe_animation_index++;
if (renderbrush->pipe_animation_index >= brush_pipe->n_brushes)
@ -179,7 +214,9 @@ gimp_view_renderer_brush_render_timeout (gpointer data)
temp_buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (brush),
renderer->context,
renderer->width,
renderer->height);
renderer->height,
color);
g_clear_object (&color);
temp_buf_width = gimp_temp_buf_get_width (temp_buf);
temp_buf_height = gimp_temp_buf_get_height (temp_buf);
@ -193,8 +230,8 @@ gimp_view_renderer_brush_render_timeout (gpointer data)
gimp_view_renderer_render_temp_buf (renderer, renderbrush->widget, temp_buf,
temp_buf_x, temp_buf_y,
-1,
GIMP_VIEW_BG_USE_STYLE,
GIMP_VIEW_BG_USE_STYLE);
view_bg_style,
view_bg_style);
gimp_temp_buf_unref (temp_buf);

View file

@ -84,7 +84,8 @@ gimp_view_renderer_buffer_render (GimpViewRenderer *renderer,
temp_buf = gimp_viewable_get_new_preview (renderer->viewable,
renderer->context,
buffer_width, buffer_height);
buffer_width, buffer_height,
NULL);
if (temp_buf)
{
@ -97,7 +98,8 @@ gimp_view_renderer_buffer_render (GimpViewRenderer *renderer,
{
render_buf = gimp_viewable_get_new_preview (renderer->viewable,
renderer->context,
view_width, view_height);
view_width, view_height,
NULL);
}
if (render_buf)

View file

@ -118,7 +118,7 @@ gimp_view_renderer_image_render (GimpViewRenderer *renderer,
temp_buf = gimp_viewable_get_new_preview (renderer->viewable,
renderer->context,
width, height);
width, height, NULL);
if (temp_buf)
{
@ -132,7 +132,7 @@ gimp_view_renderer_image_render (GimpViewRenderer *renderer,
render_buf = gimp_viewable_get_new_preview (renderer->viewable,
renderer->context,
view_width,
view_height);
view_height, NULL);
}
if (render_buf)

View file

@ -983,7 +983,7 @@ HELP
if (image->gimp->config->layer_previews)
buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (drawable), context,
width, height);
width, height, NULL);
else
buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable),
width, height,

View file

@ -3154,7 +3154,7 @@ HELP
gimp_pickable_flush (GIMP_PICKABLE (image));
buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (image), context,
width, height);
width, height, NULL);
if (buf)
{