app/core/gimpbrushclipboard.c (gimp_brush_clipboard_buffer_changed) limit

2006-05-17  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpbrushclipboard.c
	(gimp_brush_clipboard_buffer_changed)
	* app/core/gimppatternclipboard.c
	(gimp_pattern_clipboard_buffer_changed): limit the size of
	clipboard brushes and patterns to 512x512 pixels to prevent OOM
	conditions when copying from huge drawables.
This commit is contained in:
Michael Natterer 2006-05-17 19:00:49 +00:00 committed by Michael Natterer
parent 0f77a49615
commit aebf12dfb9
3 changed files with 19 additions and 7 deletions

View file

@ -1,3 +1,12 @@
2006-05-17 Michael Natterer <mitch@gimp.org>
* app/core/gimpbrushclipboard.c
(gimp_brush_clipboard_buffer_changed)
* app/core/gimppatternclipboard.c
(gimp_pattern_clipboard_buffer_changed): limit the size of
clipboard brushes and patterns to 512x512 pixels to prevent OOM
conditions when copying from huge drawables.
2006-05-17 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* app/tools/gimpaligntool.[ch]: major change in ui, to make

View file

@ -210,8 +210,8 @@ gimp_brush_clipboard_buffer_changed (Gimp *gimp,
TileManager *tiles = gimp->global_buffer->tiles;
GimpImageType type = gimp_buffer_get_image_type (gimp->global_buffer);
width = gimp_buffer_get_width (gimp->global_buffer);
height = gimp_buffer_get_height (gimp->global_buffer);
width = MIN (gimp_buffer_get_width (gimp->global_buffer), 512);
height = MIN (gimp_buffer_get_height (gimp->global_buffer), 512);
brush->mask = temp_buf_new (width, height, 1, 0, 0, NULL);
brush->pixmap = temp_buf_new (width, height, 3, 0, 0, NULL);

View file

@ -198,16 +198,19 @@ gimp_pattern_clipboard_buffer_changed (Gimp *gimp,
if (gimp->global_buffer)
{
TileManager *tiles = gimp->global_buffer->tiles;
gint width = gimp_buffer_get_width (gimp->global_buffer);
gint height = gimp_buffer_get_height (gimp->global_buffer);
gint bytes = gimp_buffer_get_bytes (gimp->global_buffer);
gint width;
gint height;
gint bytes;
PixelRegion bufferPR;
PixelRegion maskPR;
width = MIN (gimp_buffer_get_width (gimp->global_buffer), 512);
height = MIN (gimp_buffer_get_height (gimp->global_buffer), 512);
bytes = gimp_buffer_get_bytes (gimp->global_buffer);
pattern->mask = temp_buf_new (width, height, bytes, 0, 0, NULL);
pixel_region_init (&bufferPR, tiles,
pixel_region_init (&bufferPR, gimp->global_buffer->tiles,
0, 0, width, height, FALSE);
pixel_region_init_temp_buf (&maskPR, pattern->mask,
0, 0, width, height);