app: require a non-NULL format in gimp_tile_manager_create_buffer()
This commit is contained in:
@ -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));
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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,
|
||||
|
@ -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*/,
|
||||
|
Reference in New Issue
Block a user