libgimp: cleanup in GimpTileBackendPlugin

This commit is contained in:
Michael Natterer 2019-07-20 02:43:58 +02:00
parent ee79eb999f
commit 05d552e634
2 changed files with 25 additions and 15 deletions

View file

@ -1,5 +1,9 @@
/* gimptilebackendtilemanager.c /* GIMP - The GNU Image Manipulation Program
* Copyright (C) 2012 Øyvind Kolås <pippin@gimp.org> * Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimptilebackendplugin.c
* Copyright (C) 2011-2019 Øyvind Kolås <pippin@gimp.org>
* Michael Natterer <mitch@gimp.org>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -227,7 +231,7 @@ gimp_tile_read (GimpTileBackendPlugin *backend_plugin,
if (gimp_tile.ewidth * gimp_tile.eheight * priv->bpp == tile_size) if (gimp_tile.ewidth * gimp_tile.eheight * priv->bpp == tile_size)
{ {
memcpy (tile_data, (gchar *) gimp_tile.data, tile_size); memcpy (tile_data, gimp_tile.data, tile_size);
} }
else else
{ {
@ -237,8 +241,8 @@ gimp_tile_read (GimpTileBackendPlugin *backend_plugin,
for (row = 0; row < gimp_tile.eheight; row++) for (row = 0; row < gimp_tile.eheight; row++)
{ {
memcpy (tile_data + row * tile_stride, memcpy (tile_data + row * tile_stride,
(gchar *) gimp_tile.data + row * gimp_tile_stride, gimp_tile.data + row * gimp_tile_stride,
gimp_tile_stride); gimp_tile_stride);
} }
} }
@ -270,7 +274,7 @@ gimp_tile_write (GimpTileBackendPlugin *backend_plugin,
if (gimp_tile.ewidth * gimp_tile.eheight * priv->bpp == tile_size) if (gimp_tile.ewidth * gimp_tile.eheight * priv->bpp == tile_size)
{ {
memcpy ((gchar *) gimp_tile.data, tile_data, tile_size); memcpy (gimp_tile.data, tile_data, tile_size);
} }
else else
{ {
@ -280,8 +284,8 @@ gimp_tile_write (GimpTileBackendPlugin *backend_plugin,
for (row = 0; row < gimp_tile.eheight; row++) for (row = 0; row < gimp_tile.eheight; row++)
{ {
memcpy ((gchar *) gimp_tile.data + row * gimp_tile_stride, memcpy (gimp_tile.data + row * gimp_tile_stride,
tile_data + row * tile_stride, tile_data + row * tile_stride,
gimp_tile_stride); gimp_tile_stride);
} }
} }
@ -421,11 +425,15 @@ gimp_tile_put (GimpTileBackendPlugin *backend_plugin,
tile_data.data = NULL; tile_data.data = NULL;
if (tile_info->use_shm) if (tile_info->use_shm)
memcpy (gimp_shm_addr (), {
tile->data, memcpy (gimp_shm_addr (),
tile->ewidth * tile->eheight * priv->bpp); tile->data,
tile->ewidth * tile->eheight * priv->bpp);
}
else else
tile_data.data = tile->data; {
tile_data.data = tile->data;
}
if (! gp_tile_data_write (_writechannel, &tile_data, NULL)) if (! gp_tile_data_write (_writechannel, &tile_data, NULL))
gimp_quit (); gimp_quit ();
@ -437,5 +445,6 @@ gimp_tile_put (GimpTileBackendPlugin *backend_plugin,
gimp_read_expect_msg (&msg, GP_TILE_ACK); gimp_read_expect_msg (&msg, GP_TILE_ACK);
gp_unlock (); gp_unlock ();
gimp_wire_destroy (&msg); gimp_wire_destroy (&msg);
} }

View file

@ -1,8 +1,9 @@
/* GIMP - The GNU Image Manipulation Program /* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis * Copyright (C) 1995 Spencer Kimball and Peter Mattis
* *
* gimptilebackendtilemanager.h * gimptilebackendplugin.h
* Copyright (C) 2011 Øyvind Kolås <pippin@gimp.org> * Copyright (C) 2011-2019 Øyvind Kolås <pippin@gimp.org>
* Michael Natterer <mitch@gimp.org>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -56,4 +57,4 @@ GeglTileBackend * _gimp_tile_backend_plugin_new (gint32 drawable_id,
G_END_DECLS G_END_DECLS
#endif /* __GIMP_TILE_BACKEND_plugin_H__ */ #endif /* __GIMP_TILE_BACKEND_PLUGIN_H__ */