the projection is 2 bytes per pixel for grayscale images.

2007-06-06  Sven Neumann  <sven@gimp.org>

	* app/core/gimpprojection.c (gimp_projection_estimate_memsize):
	the projection is 2 bytes per pixel for grayscale images.

svn path=/trunk/; revision=22723
This commit is contained in:
Sven Neumann 2007-06-06 10:48:00 +00:00 committed by Sven Neumann
parent 798dd95499
commit 097b1768a5
2 changed files with 20 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2007-06-06 Sven Neumann <sven@gimp.org>
* app/core/gimpprojection.c (gimp_projection_estimate_memsize):
the projection is 2 bytes per pixel for grayscale images.
2007-06-06 Sven Neumann <sven@gimp.org>
* app/core/gimpprojection.[ch]: added function that estimates the

View file

@ -219,7 +219,21 @@ gimp_projection_estimate_memsize (GimpImageBaseType type,
gint width,
gint height)
{
return 4 * (gint64) width * (gint64) height;
gint64 bytes = 0;
switch (type)
{
case GIMP_RGB:
case GIMP_INDEXED:
bytes = 4;
break;
case GIMP_GRAY:
bytes = 2;
break;
}
return bytes * (gint64) width * (gint64) height;
}