[gimp/gimp-2-10] app: fix alignment of generic pixel buffers
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: fix alignment of generic pixel buffers
- Date: Wed, 20 May 2020 05:54:50 +0000 (UTC)
commit 3e61ef9ae6aa7576072f87b2a244ebb2ddfb9e29
Author: Ell <ell_se yahoo com>
Date: Wed May 20 08:49:42 2020 +0300
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 a90f59d9612a6ab6f945a761a858bec76d33cded)
app/core/gimppickable.c | 2 +-
app/display/gimpcursorview.c | 2 +-
app/tools/gimpcolortool.c | 2 +-
app/widgets/gimpcolorframe.c | 5 ++++-
app/widgets/gimpcolorframe.h | 2 +-
app/widgets/gimpsamplepointeditor.c | 2 +-
6 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/app/core/gimppickable.c b/app/core/gimppickable.c
index b4b8987c0c..2949def523 100644
--- a/app/core/gimppickable.c
+++ b/app/core/gimppickable.c
@@ -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);
diff --git a/app/display/gimpcursorview.c b/app/display/gimpcursorview.c
index 06d4ca688c..846df91eb9 100644
--- a/app/display/gimpcursorview.c
+++ b/app/display/gimpcursorview.c
@@ -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;
diff --git a/app/tools/gimpcolortool.c b/app/tools/gimpcolortool.c
index 3f7fa4b315..683a7136da 100644
--- a/app/tools/gimpcolortool.c
+++ b/app/tools/gimpcolortool.c
@@ -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);
diff --git a/app/widgets/gimpcolorframe.c b/app/widgets/gimpcolorframe.c
index 5b96c1dfc6..8a51bf215c 100644
--- a/app/widgets/gimpcolorframe.c
+++ b/app/widgets/gimpcolorframe.c
@@ -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]);
+ }
}
}
}
diff --git a/app/widgets/gimpcolorframe.h b/app/widgets/gimpcolorframe.h
index cf2812a4c3..90cb05b030 100644
--- a/app/widgets/gimpcolorframe.h
+++ b/app/widgets/gimpcolorframe.h
@@ -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;
diff --git a/app/widgets/gimpsamplepointeditor.c b/app/widgets/gimpsamplepointeditor.c
index cffc803da9..48d7f334a9 100644
--- a/app/widgets/gimpsamplepointeditor.c
+++ b/app/widgets/gimpsamplepointeditor.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]