replaced a for-loop with a call to memcpy().

2003-02-21  Sven Neumann  <sven@gimp.org>

	* app/display/gimpdisplayshell-render.c (render_image_rgb):
	replaced a for-loop with a call to memcpy().

	* app/display/gimpdisplay.c: use g_memdup() instead of g_new()
	followed by memcpy().
This commit is contained in:
Sven Neumann 2003-02-21 12:48:13 +00:00 committed by Sven Neumann
parent 361c288c93
commit 1b0339ad34
4 changed files with 13 additions and 27 deletions

View File

@ -1,3 +1,11 @@
2003-02-21 Sven Neumann <sven@gimp.org>
* app/display/gimpdisplayshell-render.c (render_image_rgb):
replaced a for-loop with a call to memcpy().
* app/display/gimpdisplay.c: use g_memdup() instead of g_new()
followed by memcpy().
2003-02-21 Michael Natterer <mitch@gimp.org> 2003-02-21 Michael Natterer <mitch@gimp.org>
* app/tools/gimptransformoptions.c * app/tools/gimptransformoptions.c

View File

@ -18,8 +18,6 @@
#include "config.h" #include "config.h"
#include <string.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "display-types.h" #include "display-types.h"
@ -506,9 +504,7 @@ gimp_display_idlerender_init (GimpDisplay *gdisp)
{ {
area = (GimpArea *) list->data; area = (GimpArea *) list->data;
new_area = g_new (GimpArea, 1); new_area = g_memdup (area, sizeof (GimpArea));
memcpy (new_area, area, sizeof (GimpArea));
gdisp->idle_render.update_areas = gdisp->idle_render.update_areas =
gimp_display_area_list_process (gdisp->idle_render.update_areas, gimp_display_area_list_process (gdisp->idle_render.update_areas,

View File

@ -18,8 +18,6 @@
#include "config.h" #include "config.h"
#include <string.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "display-types.h" #include "display-types.h"
@ -506,9 +504,7 @@ gimp_display_idlerender_init (GimpDisplay *gdisp)
{ {
area = (GimpArea *) list->data; area = (GimpArea *) list->data;
new_area = g_new (GimpArea, 1); new_area = g_memdup (area, sizeof (GimpArea));
memcpy (new_area, area, sizeof (GimpArea));
gdisp->idle_render.update_areas = gdisp->idle_render.update_areas =
gimp_display_area_list_process (gdisp->idle_render.update_areas, gimp_display_area_list_process (gdisp->idle_render.update_areas,

View File

@ -676,11 +676,9 @@ render_image_gray_a (RenderInfo *info)
static void static void
render_image_rgb (RenderInfo *info) render_image_rgb (RenderInfo *info)
{ {
guchar *src;
guchar *dest;
gint byte_order; gint byte_order;
gint y, ye; gint y, ye;
gint x, xe; gint xe;
gint initial; gint initial;
gfloat error; gfloat error;
gfloat step; gfloat step;
@ -706,21 +704,9 @@ render_image_rgb (RenderInfo *info)
} }
else else
{ {
src = info->src; g_return_if_fail (info->src != NULL);
dest = info->dest;
g_return_if_fail (src != NULL); memcpy (info->dest, info->src, 3 * info->w);
/* replace this with memcpy, or better yet, avoid it altogether? */
for (x = info->x; x < xe; x++)
{
dest[0] = src[0];
dest[1] = src[1];
dest[2] = src[2];
src += 3;
dest += 3;
}
} }
info->dest += info->dest_bpl; info->dest += info->dest_bpl;