app: fix alignment of generic pixel buffers

Wherever we store arbitrary-format colors in an opaque buffer, use
double for the buffer, instead of char, so that it has a strict-
enough alignment to handle all our used pixel formats.

(cherry picked from commit a90f59d961)
This commit is contained in:
Ell
2020-05-20 08:49:42 +03:00
parent 81fb595ca0
commit 3e61ef9ae6
6 changed files with 9 additions and 6 deletions

View File

@ -236,7 +236,7 @@ gimp_pickable_get_color_at (GimpPickable *pickable,
gint y,
GimpRGB *color)
{
guchar pixel[32];
gdouble pixel[4];
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), FALSE);
g_return_val_if_fail (color != NULL, FALSE);

View File

@ -727,7 +727,7 @@ gimp_cursor_view_cursor_idle (GimpCursorView *view)
gboolean in_image;
gchar buf[32];
const Babl *sample_format;
guchar pixel[32];
gdouble pixel[4];
GimpRGB color;
gdouble xres;
gdouble yres;

View File

@ -629,7 +629,7 @@ gimp_color_tool_pick (GimpColorTool *tool,
{
GimpColorToolClass *klass;
const Babl *sample_format;
guchar pixel[32];
gdouble pixel[4];
GimpRGB color;
klass = GIMP_COLOR_TOOL_GET_CLASS (tool);

View File

@ -798,7 +798,10 @@ gimp_color_frame_update (GimpColorFrame *frame)
g_free (tmp);
if (! frame->sample_average)
values[4] = g_strdup_printf ("%d", frame->pixel[0]);
{
values[4] = g_strdup_printf (
"%d", ((guint8 *) frame->pixel)[0]);
}
}
}
}

View File

@ -39,7 +39,7 @@ struct _GimpColorFrame
gboolean sample_valid;
gboolean sample_average;
const Babl *sample_format;
guchar pixel[32];
gdouble pixel[4];
GimpRGB color;
gint x;
gint y;

View File

@ -548,7 +548,7 @@ gimp_sample_point_editor_update (GimpSamplePointEditor *editor)
{
GimpSamplePoint *sample_point = list->data;
const Babl *format;
guchar pixel[32];
gdouble pixel[4];
GimpRGB color;
GimpColorPickMode pick_mode;
gint x;