[gimp/goat-invasion: 431/526] app: require a non-NULL format in gimp_tile_manager_create_buffer()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 431/526] app: require a non-NULL format in gimp_tile_manager_create_buffer()
- Date: Sun, 22 Apr 2012 13:35:29 +0000 (UTC)
commit 1ae3b44b3ddb9e05f5a2446d5d083ff91ea692dc
Author: Michael Natterer <mitch gimp org>
Date: Fri Apr 6 23:26:54 2012 +0200
app: require a non-NULL format in gimp_tile_manager_create_buffer()
app/core/gimpprojection-construct.c | 5 +++--
app/core/gimpprojection.c | 5 +++--
app/gegl/gimptilebackendtilemanager.c | 9 ++-------
app/tests/test-gimptilebackendtilemanager.c | 5 +++--
4 files changed, 11 insertions(+), 13 deletions(-)
---
diff --git a/app/core/gimpprojection-construct.c b/app/core/gimpprojection-construct.c
index d669683..e1f0167 100644
--- a/app/core/gimpprojection-construct.c
+++ b/app/core/gimpprojection-construct.c
@@ -261,9 +261,10 @@ gimp_projection_initialize (GimpProjection *proj,
}
else
{
- TileManager *tiles = gimp_pickable_get_tiles (GIMP_PICKABLE (proj));
+ TileManager *tiles = gimp_pickable_get_tiles (GIMP_PICKABLE (proj));
+ const Babl *format = gimp_pickable_get_format (GIMP_PICKABLE (proj));
- buffer = gimp_tile_manager_create_buffer (tiles, NULL);
+ buffer = gimp_tile_manager_create_buffer (tiles, format);
}
gegl_buffer_clear (buffer, GEGL_RECTANGLE (x, y, w, h));
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index 3b718f6..406606c 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -306,9 +306,10 @@ gimp_projection_get_buffer (GimpPickable *pickable)
if (! proj->buffer)
{
- TileManager *tiles = gimp_projection_get_tiles (pickable);
+ TileManager *tiles = gimp_projection_get_tiles (pickable);
+ const Babl *format = gimp_projection_get_format (pickable);
- proj->buffer = gimp_tile_manager_create_buffer (tiles, NULL);
+ proj->buffer = gimp_tile_manager_create_buffer (tiles, format);
if (proj->sink_node)
{
diff --git a/app/gegl/gimptilebackendtilemanager.c b/app/gegl/gimptilebackendtilemanager.c
index a5f0aba..edeb8b5 100644
--- a/app/gegl/gimptilebackendtilemanager.c
+++ b/app/gegl/gimptilebackendtilemanager.c
@@ -376,17 +376,12 @@ gimp_tile_backend_tile_manager_new (TileManager *tm,
gint mul = gimp_gegl_tile_mul ();
GeglRectangle rect = { 0, 0, width, height };
- g_return_val_if_fail (format == NULL ||
- babl_format_get_bytes_per_pixel (format) ==
- babl_format_get_bytes_per_pixel (gimp_bpp_to_babl_format (bpp)),
- NULL);
+ g_return_val_if_fail (format != NULL, NULL);
+ g_return_val_if_fail (babl_format_get_bytes_per_pixel (format) == bpp, NULL);
if (tm->validate_proc)
mul = 1;
- if (! format)
- format = gimp_bpp_to_babl_format (bpp);
-
ret = g_object_new (GIMP_TYPE_TILE_BACKEND_TILE_MANAGER,
"tile-width", TILE_WIDTH * mul,
"tile-height", TILE_HEIGHT * mul,
diff --git a/app/tests/test-gimptilebackendtilemanager.c b/app/tests/test-gimptilebackendtilemanager.c
index 299336e..8e29891 100644
--- a/app/tests/test-gimptilebackendtilemanager.c
+++ b/app/tests/test-gimptilebackendtilemanager.c
@@ -60,12 +60,13 @@ basic_usage (void)
GeglTileBackend *backend;
GeglBuffer *buffer;
guint16 actual_data[4];
+ const Babl *format = babl_format ("R'G'B'A u8");
/* Write some pixels to the tile manager */
tm = tile_manager_new (rect.width, rect.height, 4);
pixel_region_init (&pr, tm, rect.x, rect.y, rect.width, rect.height, TRUE);
- buffer = gimp_tile_manager_create_buffer (tm, NULL, TRUE);
+ buffer = gimp_tile_manager_create_buffer (tm, format, TRUE);
gegl_color_set_rgba (magenta, 1.0, 0.0, 1.0, 1.0);
gegl_buffer_set_color (buffer, NULL, magenta);
g_object_unref (magenta);
@@ -74,7 +75,7 @@ basic_usage (void)
* TileManager backend. Use u16 to complicate code paths, decreasing
* risk of the test accidentally passing
*/
- backend = gimp_tile_backend_tile_manager_new (tm, NULL, FALSE);
+ backend = gimp_tile_backend_tile_manager_new (tm, format, FALSE);
buffer = gegl_buffer_new_for_backend (NULL, backend);
gegl_buffer_get (buffer,
&pixel_rect, 1.0 /*scale*/,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]