gimp r24798 - in branches/gimp-2-4: . plug-ins/common
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r24798 - in branches/gimp-2-4: . plug-ins/common
- Date: Mon, 4 Feb 2008 23:26:47 +0000 (GMT)
Author: neo
Date: Mon Feb 4 23:26:46 2008
New Revision: 24798
URL: http://svn.gnome.org/viewvc/gimp?rev=24798&view=rev
Log:
2008-02-05 Sven Neumann <sven gimp org>
Merged from trunk:
* plug-ins/common/psd-save.c (write_pixel_data): check if
drawable
is a layer before trying to access the layer mask.
Modified:
branches/gimp-2-4/ChangeLog
branches/gimp-2-4/plug-ins/common/psd-save.c
Modified: branches/gimp-2-4/plug-ins/common/psd-save.c
==============================================================================
--- branches/gimp-2-4/plug-ins/common/psd-save.c (original)
+++ branches/gimp-2-4/plug-ins/common/psd-save.c Mon Feb 4 23:26:46 2008
@@ -1218,7 +1218,6 @@
gint32 tile_height = gimp_tile_height();
GimpDrawable *drawable = gimp_drawable_get (drawableID);
- gint32 maskID = gimp_layer_get_mask(drawableID);
gint32 height = drawable->height;
gint32 width = drawable->width;
@@ -1318,70 +1317,79 @@
}
/* Write layer mask, as last channel, id -2 */
- if (maskID != -1) {
- GimpDrawable *mdrawable = gimp_drawable_get(maskID);
- len = 0;
-
- gimp_pixel_rgn_init (®ion, mdrawable, 0, 0,
- width, height, FALSE, FALSE);
-
- if (ChanLenPosition)
- {
- write_gint16 (fd, 1, "Compression type (RLE)");
- len += 2;
- IF_DEEP_DBG printf ("\t\t\t\t. ChanLenPos, len %d\n", len);
- }
-
- if (ltable_offset > 0)
- {
- length_table_pos = ltable_offset + 2 * (bytes+1) * height;
- IF_DEEP_DBG printf ("\t\t\t\t. ltable, pos %ld\n", length_table_pos);
- }
- else
- {
- length_table_pos = ftell(fd);
-
- xfwrite (fd, LengthsTable, height * sizeof(gint16),
- "Dummy RLE length");
- len += height * sizeof(gint16);
- IF_DEEP_DBG printf ("\t\t\t\t. ltable, pos %ld len %d\n", length_table_pos, len);
- }
-
- for (y = 0; y < height; y += tile_height)
- {
- int tlen;
- gimp_pixel_rgn_get_rect (®ion, data, 0, y,
- width, MIN(height - y, tile_height));
- tlen = get_compress_channel_data (&data[0],
- width,
- MIN(height - y, tile_height),
- 1,
- &LengthsTable[y],
- rledata);
- len += tlen;
- xfwrite (fd, rledata, tlen, "Compressed mask data");
- IF_DEEP_DBG printf ("\t\t\t\t. Writing compressed mask, stream of %d\n", tlen);
- }
-
- /* Write compressed lengths table */
- fseek (fd, length_table_pos, SEEK_SET); /*POS WHERE???*/
- for (j = 0; j < height; j++) /* write real length table */
- {
- write_gint16 (fd, LengthsTable[j], "RLE length");
- IF_DEEP_DBG printf ("\t\t\t\t. Updating RLE len %d\n", LengthsTable[j]);
- }
+ if (gimp_drawable_is_layer (drawableID))
+ {
+ gint32 maskID = gimp_layer_get_mask (drawableID);
+
+ if (maskID != -1)
+ {
+ GimpDrawable *mdrawable = gimp_drawable_get (maskID);
+ len = 0;
- if (ChanLenPosition) /* Update total compressed length */
- {
- fseek (fd, ChanLenPosition[bytes], SEEK_SET); /*+bytes OR SOMETHING*/
- write_gint32 (fd, len, "channel data length");
- IFDBG printf ("\t\tUpdating data len to %d, at %ld\n", len, ftell(fd));
- }
- fseek (fd, 0, SEEK_END);
- IF_DEEP_DBG printf ("\t\t\t\t. Cur pos %ld\n", ftell(fd));
+ gimp_pixel_rgn_init (®ion, mdrawable, 0, 0,
+ width, height, FALSE, FALSE);
+
+ if (ChanLenPosition)
+ {
+ write_gint16 (fd, 1, "Compression type (RLE)");
+ len += 2;
+ IF_DEEP_DBG printf ("\t\t\t\t. ChanLenPos, len %d\n", len);
+ }
- gimp_drawable_detach (mdrawable);
- }
+ if (ltable_offset > 0)
+ {
+ length_table_pos = ltable_offset + 2 * (bytes+1) * height;
+ IF_DEEP_DBG printf ("\t\t\t\t. ltable, pos %ld\n",
+ length_table_pos);
+ }
+ else
+ {
+ length_table_pos = ftell(fd);
+
+ xfwrite (fd, LengthsTable, height * sizeof(gint16),
+ "Dummy RLE length");
+ len += height * sizeof(gint16);
+ IF_DEEP_DBG printf ("\t\t\t\t. ltable, pos %ld len %d\n",
+ length_table_pos, len);
+ }
+
+ for (y = 0; y < height; y += tile_height)
+ {
+ int tlen;
+ gimp_pixel_rgn_get_rect (®ion, data, 0, y,
+ width, MIN(height - y, tile_height));
+ tlen = get_compress_channel_data (&data[0],
+ width,
+ MIN(height - y, tile_height),
+ 1,
+ &LengthsTable[y],
+ rledata);
+ len += tlen;
+ xfwrite (fd, rledata, tlen, "Compressed mask data");
+ IF_DEEP_DBG printf ("\t\t\t\t. Writing compressed mask, stream of %d\n", tlen);
+ }
+
+ /* Write compressed lengths table */
+ fseek (fd, length_table_pos, SEEK_SET); /*POS WHERE???*/
+ for (j = 0; j < height; j++) /* write real length table */
+ {
+ write_gint16 (fd, LengthsTable[j], "RLE length");
+ IF_DEEP_DBG printf ("\t\t\t\t. Updating RLE len %d\n",
+ LengthsTable[j]);
+ }
+
+ if (ChanLenPosition) /* Update total compressed length */
+ {
+ fseek (fd, ChanLenPosition[bytes], SEEK_SET); /*+bytes OR SOMETHING*/
+ write_gint32 (fd, len, "channel data length");
+ IFDBG printf ("\t\tUpdating data len to %d, at %ld\n", len, ftell(fd));
+ }
+ fseek (fd, 0, SEEK_END);
+ IF_DEEP_DBG printf ("\t\t\t\t. Cur pos %ld\n", ftell(fd));
+
+ gimp_drawable_detach (mdrawable);
+ }
+ }
gimp_drawable_detach (drawable);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]