Commit Graph

8871 Commits

Author SHA1 Message Date
Jehan d3139e0f7c app: support saving/exporting with multi-selection.
This commit just changes our saving API (i.e. the GimpSaveProcedure
class) to take an array of drawables as argument instead of a single
drawable.

It actually doesn't matter much for exporting as the whole API seems
more or less bogus there and all formats plug-ins mostly care only
whether they will merge/flatten all visible layers (the selected ones
don't really matter) or if the format supports layers of some sort. It
may be worth later strengthening a bit this whole logics, and maybe
allow partial exports for instance.

As for saving, it was not even looking at the passed GimpDrawable either
and was simply re-querying the active layer anyway.
Note that I don't implement the multi-selection saving in XCF yet in
this commit. I only updated the API. The reason is that the current
commit won't be backportable to gimp-2-10 because it is an API break. On
the other hand, the code to save multi-selection can still be backported
even though the save() API will only pass a single drawable (as I said
anyway, this argument was mostly bogus until now, hence it doesn't
matter much for 2.10 logics).
2020-05-17 18:32:16 +02:00
Niels De Graef b14b93de14 Split GIR into Gimp-3.0 and GimpUi-3.0
Fixes https://gitlab.gnome.org/GNOME/gimp/-/issues/4065
2020-05-15 07:45:25 +00:00
Simon Budig 4394b92c71 Issue #1439: reverse the construction of the "selection to path" plugin. 2020-05-15 02:46:49 +02:00
Niels De Graef 5992a42231 gimpthrobber: Get rid of g_type_class_add_private()
It's deprecated.
2020-05-12 21:35:54 +02:00
Niels De Graef ae34e778fc meson: Use libgimp(ui)_dep in plug-ins meson files
This gives a big cleanup in the meson.build files of the plug-ins.

It's also quite a bit more maintainable, since anything that changes in
libgimp's dependencies, linkage, ... doesn't have to be copy-pasted into
each plug-in.
2020-05-11 07:01:37 +02:00
T Collins f00df8f773 Update ddswrite.c 2020-05-06 13:58:28 +00:00
Elad Shahar 93602a3973 Issue #4326 - Add visual tab to spyrogimp plugin
Add visual tab to spyrogimp plugin for a more intuitive, visual
way of specifying the spyrograph pattern.
In addition, fix using the selection as the fixed gear, and add
option to save the pattern to a path.
2020-05-05 13:29:09 +03:00
luz.paz 36f620012d Fix typos
Found via codespell v1.17.0.dev0  
```
codespell -q 3 -S ./ChangeLog*,*.po,./.git,./NEWS* -L als,ang,ba,chello,daa,doubleclick,foto,hist,iff,inport,klass,mut,nd,ower,paeth,params,pard,pevent,sinc,thru,tim,uint
```
2020-05-04 08:55:48 -04:00
Niels De Graef cf41d1fdf8 colorselector: Rename signal emitters
The GIR parser is giving warnings because both e.g. a signal, a
corresponding vfunc and a method emitting it are named
"channel_changed", which can and will give issues in some bindings.

The easiest option is to follow the general convention of starting the
signal emitters with `emit_`, which also makes clear the intention of
the method.
2020-05-03 23:23:44 +02:00
Michael Natterer f3f8d3a54e Issue #3405 - Color component decompose crash for CMY
Remove the "CMY" model from compose and decompose, it's gone from
babl. Also fix decomposing to CMYK by using the right component names.
2020-05-02 21:17:20 +02:00
Michael Natterer 9adf2d19f8 Issue #3949 - Image Map plug-in selects wrong areas
Fix one of the issues spotted by Massimo: in right_intersect() it must
be "dy > 0" not "dy > y".
2020-05-02 20:16:04 +02:00
Michael Natterer 452924dbe9 Issue #5009 - Possible array overrun in d_draw_ellipse
Change while() to go from 0..360 instead of 0..361 so the code passes
automated tests. The code never ran into this situation but the change
is a small improvement anyway.
2020-05-02 16:52:18 +02:00
Michael Natterer 97e0322ebb Issue #5010 - Setting twice value pcvals.paper_invert in paper_store
Remove identical duplicated line.
2020-05-01 22:49:47 +02:00
Jehan 2678bafca2 Issue #5002: compare pointer to NULL, not 0.
This is a remnant from the old API where we were using item IDs.
2020-04-28 16:38:24 +02:00
Ell 2d4de85fe3 plug-ins: in file-psd, use normal channel order
For some reason we reverse the channel order when loading/saving a
PSD file.  This doesn't seem to be necessary, and leads to a
reversed channel order across GIMP/Photoshop.  Simply use the
normal channel order instead.
2020-04-26 23:38:25 +03:00
Ell 281188e169 Issue #189 - Store channel colors when saving as PSD
In file-psd, write a DisplayInfo image resource with the color/
opacity of all channels.
2020-04-26 23:19:22 +03:00
Ell ac19f6413b plug-ins: in file-psd, fix indentation in psd-save.c 2020-04-26 23:16:05 +03:00
Ell 953a3ad479 plug-ins: in file-psd, remove unused member of DisplayInfoNew 2020-04-26 23:14:55 +03:00
Ell 251ce5126e plug-ins: in file-psd, fix u8 channel format
In file-psd, use a non-linear channel format when the image
precision is u8 non-linear, as per gimp_image_get_channel_format().
2020-04-26 23:14:52 +03:00
Jehan c280cb9da7 plug-ins: fix various other warnings on the Windows build CI.
1 > warning: "_WIN32_WINNT" redefined
2 > pointer targets in passing argument 2 of 'send' differ in signedness
3 > passing argument 4 of 'setsockopt' from incompatible pointer type

For the signedness/type issues, I just casted to (void *) which was the
expected type for these parameter on the Linux API anyway. As for
Windows API (which was expecting char* for these various API), the
compiler just does the cast itself from void* without complaining
anymore.
2020-04-17 14:42:25 +02:00
Jehan e854de73ee plug-ins: fix signedness warning with different expectation Win/Linux.
On Windows, accept() wants an int for addrlen but on Linux, it wants a
socklen_t which is an unsigned int. So we can't just switch to gint as
proposed in !232 (if we do so, the signedness warning now happens on the
Linux build instead of the Windows one).

Fortunately it looks like socklen_t is actually typedef-ed to int in
Windows headers. So let's just use this type, which is much more proper
anyway as this variable is only used in functions which want this type
on Linux.

Fixes:

> warning: pointer targets in passing argument 3 of 'accept' differ in signedness
2020-04-17 14:18:53 +02:00
Jehan 05556457df plug-ins: remove last usage of GTimeVal and g_get_current_time().
Deprecated as not year-2038-safe, this was the last remnant of code
which was still using it.
2020-04-14 16:08:38 +02:00
Jehan f6dd30f3a8 plug-ins: fix more abs().
I am comparing absolute value of 2 double computation results. Might as
well just use fabs() instead of truncating both values to int.
Fixes the following:
> warning: using integer absolute value function ‘abs’ when argument is
> of floating point type ‘double’ [-Wabsolute-value]
2020-04-14 00:12:45 +02:00
Jehan fddaa77218 plug-ins: fix abs() on long int.
Fixes the following bug:

> warning: absolute value function ‘abs’ given an argument of type
> ‘glong’ {aka ‘long int’} but has parameter of type ‘int’ which may
> cause truncation of value [-Wabsolute-value]
2020-04-13 23:18:19 +02:00
Jehan b71754f2a7 plug-ins: fix some build warning.
Fixes:
> warning: using integer absolute value function ‘abs’ when argument is of floating point type ‘double’ [-Wabsolute-value]
2020-04-13 21:54:09 +02:00
lillolollo 202012ba73 plug-ins: screenshot-win32.c forbids mixed declarations and code
(cherry picked from commit 09fb64c604)
2020-04-12 19:39:30 +00:00
Ell 9099f317bc plug-ins: add support for exporting 16-bit PSDs
In file-psd, add support for exporting high bit-depth images.  This
is currently limited to 16-bit images, since 32-bit images seem to
have a different structure (our loading code can successfully load
32-bit images exported by the plug-in, but not actual 32-bit PSD
files saved in Photoshop.)  Higher bit-depth images are saved as
16-bit for now.

Note also that when saving a linear image with a built-in linear
profile the result is wrong (the image is exported with a linear-
TRC profile, but the data is perceptual), but this is a general
problem we have to fix, not restricted to the PSD plug-in.
2020-04-09 01:17:56 +03:00
Jehan 809e79f37a Issue #4919: PDF: Order of pages reversed when opening and closing.
Let's go with the logics "bottom layer is first", which is also the
logics in animated formats. Hence changing the layer order on loading
multi-page PDF.
2020-04-08 20:08:00 +02:00
Jehan 291af71e95 plug-ins: do not use strcpy() when src and dest overlap.
I don't reproduce these build warnings in my build but frogonia reported
them:

> warning: 'strcpy' accessing 1 byte at offsets 0 and [0, 2147483645] may overlap 1 byte at offset 0 [-Wrestrict]

And indeed the man of strcpy() clearly states that "The strings may not
overlap" (which is clearly not guaranted in current code as we don't
know the size of what's after the substring).
strncpy() might have done the trick as it doesn't say anything about
possible overlap or not, but let's just use memmove() instead where it
is clearly written that memory areas may overlap (note that bcopy() as
proposed by ankh would have also done the trick, but it is marked as
deprecated).
2020-04-04 00:48:36 +02:00
Jehan 105c4efc8b Issue #4487: change "Save color values from transparent pixels"…
… defaults to FALSE for PNG, TIFF.
The logics is that in most case, when alpha is 0, you don't expect color
to be retrieved and some people were bothered by this when erasing data
with eraser tool or selection deletion.

For the WIP image as well as for XCF format, we definitely want to keep
color data as there are workflows where you would want to erase/unerase
pixels subtly (selection also are not binary and should not be expected
to erase color data on layers with alpha channel). So we want to keep
the non-destructive behavior there.
Yet for export formats, going for "deleting what looks deleted" is a
valid approach, especially as it has been argued that experienced users
would know how to read and change the format options (and these
experienced users are likely the ones who may have valid reasons to want
pixels with full transparency to keep color values).
PNG and TIFF were the only 2 formats where I see such options, so
changing the default for these 2 plug-ins.
2020-04-03 20:04:26 +02:00
Niels De Graef 878804fb01 Cleanup GObject signal marshallers
* Don't generate our own marshallers if they are available in GLib
  already
* Don't set the c_marshaller parameter in `g_signal_new()` if it's a
  default marshaller provided by GLib. See commit message of commit
  39e4aa3c57 on why this is the case.
2020-04-01 21:20:01 +00:00
Jehan 3a0af1f50a Issue #4618: support Canon CR3.
And by "supporting CR3", I mean sending the file over to raw developer
software which are supposed to support it! At the very least RawTherapee
support CR3 (since recent version 5.8 apparently), not sure about
darktable (but if not yet, I assume it won't be long either).
2020-03-14 23:56:45 +01:00
Ell 0ce993c4b9 Issue #4663 - "Error loading PSD file: No error" while trying to open a PSD
In file-psd, avoid error on load when encountering an uknown image
resource of size 0.
2020-02-28 00:47:49 +02:00
Ell be7cace74e plug-ins: in file-psd, make offset/size fields unsigned
In file-psd, make the data_start and data_len fields of the
PSDimageres and PSDlayerres structs unsigned, to avoid potential
overflow/sign-extension.
2020-02-28 00:47:48 +02:00
Ell 1b6191d176 plug-ins: in file-psd, use scratch allocator for temporary CMYK buffers; cleanup 2020-02-22 18:20:53 +02:00
Øyvind Kolås 1462a91d86 plug-ins: Convert CMYK u8 .psd to R'G'B' float on load
Patch from Massimo Valentini in issue #354, adapted for the new object
based plug-in APIs.
2020-02-21 12:29:50 +01:00
Ell 52f5a9f654 plug-ins: improve PSD loading speed
In file-psd, improve loading speed, mostly by eliminating excessive
copies.
2020-02-18 19:17:38 +02:00
Ell 15438c58d2 Issue #4627 - memory corruption when open crafted sgi
In the file-sgi plug-in, check for failure when allocating buffers
of user-controlled size.
2020-02-17 17:01:25 +02:00
Ell 2ed889394d plug-ins: in file-sgi, convert tabs to spaces 2020-02-17 17:01:25 +02:00
Ell 4fe8217898 plug-ins: in screenshot, keep image dirty; keep history clean
In the screenshot plug-in, don't clean the image, since it's not
backed by any persistent source, and disable undo while modifying
it, so that the initial edit history is clean.
2020-02-16 23:05:12 +02:00
Nikc M 0a5af889f9 Issue #175 - Allow the erase every other row plugin to skip a different number of rows
Adds generalized erase Nth row function,
and sets original erase row function to
call generalized one with n = 2
to reduce code duplication
2020-02-13 01:18:22 +02:00
Oleksii Samorukov cfcf38e119 plug-ins/screenshot: fix compilation on macOS 2020-01-17 11:40:35 +01:00
Jehan ec9dbd8115 libgimpwidgets, app, plug-ins: fix last GIR warnings.
gimp_int_radio_group_new() was still complaining about the scope of
radio_button_callback(). Make it (scope notified) because it needs to
stay alive after the function returns and may be called multiple times.

Also adding a GDestroyNotify to free the callback data once the widget
is destroyed (additionally it will also serve as a notifier for bindings
to properly free the callback closure itself, not only it's data).

With this last one done, GObject Introspection generation now happens
without any warning output.
2020-01-15 14:00:19 +01:00
Cyril Richard 38cccaac49 Issue #4203 - Wavelet decomposition only on RGB images
Add GRAY* to the list of supported image types.
2020-01-06 19:47:44 +01:00
Massimo Valentini 653484df0b Issue #4467 - (pagecurl) CRITICAL **: g_object_unref: assertion...
...'G_IS_OBJECT (object)' failed

Fix the meson build script to output the right icon path prefix.
2020-01-06 14:49:41 +01:00
Massimo Valentini c33e1263fa Issue #4461 - Spinning Globe fails in gimp-2.99
Fix argument indices.
2020-01-06 14:35:05 +01:00
Jehan 2cd765c000 plug-ins: variable used after being freed.
Once again spotted by Massimo in #4449.
2020-01-03 19:57:59 +01:00
Jehan 189da39805 plug-ins: return value of gimp_procedure_config_begin_export() freed…
… twice.
It should not be freed by the caller since it is annotated as (transfer
none). It gets freed when calling gimp_procedure_config_end_export().
Thanks to Massimo for noticing.
2020-01-03 19:53:54 +01:00
Jehan 24a0b0c53a plug-ins: also omit hidden layer groups in PDF export.
When the "Omit hidden layers and layers with zero opacity" option is
set, this property was only checked on non-group layers. So if we had
non-hidden layers inside hidden layer groups, they ended up exported,
which is not the expected behavior.

See https://gitlab.gnome.org/GNOME/gimp/issues/4425#note_675350
2020-01-01 18:40:52 +01:00
Jehan 34f05750d0 plug-ins: forgot to look missing font duplicates recursively.
Fix for the previous commit, fixes cases with text layers inside groups.
2020-01-01 18:28:04 +01:00
Jehan 1b06067164 Issue #4425: Saving to PDF changes text's font and size.
Adds a new PDF export option "Convert text layers to image", which
defaults to FALSE (because text staying text is obviously usually
prefered).
Also loop through text layers to detect missing fonts. In case any are
found, add a warning in the export dialog, below the new option,
advising to enable this option if design matters (if fonts are missing,
PangoCairo seems to select any other random font and embed it into the
PDF instead of the expected one).
2020-01-01 17:53:02 +01:00
lillolollo 4b07c62cbc Issue #4338 Plug-in file-header exporting to format C header wrong output.
(cherry picked from commit 3f76d7782a)
2019-12-29 23:03:49 +01:00
Jehan 4fa7d078d0 plug-ins: install Python plug-ins in rwxr-xr-x.
Without the write permission for the owner, the `make install-plug-ins`
special target fails on Python plug-ins. And anyway I don't see a reason
why not give write permission to the owner (like all other plug-ins are
installed).
2019-12-25 11:51:56 +01:00
Michael Schumacher 1f149b15ab plug-ins: correctly renaming plug-ins/gfig/gfig-examples/smily to smiley 2019-12-21 00:18:56 +00:00
luz.paz 2a1713c008 plug-ins: rename plug-ins/gfig/gfig-examples/simily to smiley
+ renamed `plug-ins/gfig/gfig-examples/simily` to `plug-ins/gfig/gfig-examples/smiley`  
+ updated make files  
+ corrected typo
2019-12-19 20:28:00 -05:00
Jehan 7c6a147ffb plug-ins: allow "html" extension for colorxhtml.
There is no reason to limit it to "xhtml" only. Even more, in all
browsers I tried, the exported page was failing to load with the '.xtml'
extension, while it loads fine when renamed as '.html'.

Only problem is that now we have 2 plug-ins able to save as html (other
is file-html-table) and the first in the procedure list (with no
explicit logics right now) will just shadow the next one. We will have
to add some generic infrastructure to allow people to choose favorite
load/export plug-ins, probably in Preferences, next to the raw plug-in
selection.
2019-12-14 14:37:14 +01:00
Jehan 2e40b8d674 meson, autototools: install colorxhtml ported in previous commit. 2019-12-14 13:19:44 +01:00
Elad Shahar a3544fec6f Port pygimp colorxhtml plugin to python 3 2019-12-14 12:38:07 +01:00
Jehan e54467a8fa plug-ins: (meson) install Python plug-ins with execution permission.
Otherwise GIMP will skip them!
2019-11-26 20:24:28 +01:00
Elad Shahar b0ae5f1351 plug-ins: minor fixes to spyrogimp plugin.
Use Gtk Grid instead of deprecated table.
Fix use of some Gtk constants.
Fix top limit of scale widgets by setting page size of Adjustment to 0.
2019-11-26 20:08:59 +01:00
Jehan 9a4d1f0277 Issue #4209: Animation optimize for GIF moves layers to top left corner.
Regression from commit 9d33a9a9ca as spotted by Massimo.
2019-11-24 21:56:34 +01:00
Michael Natterer 876199a03f devel-docs, libgimp: update some .gitignore files 2019-11-19 20:40:22 +01:00
Michael Natterer 24cadf8589 plug-ins: port file-mng-save to GimpProcedureConfig and propwidgets
and some cleanup, this is one half-finished mess, but at least
now a ported mess.
2019-11-12 01:36:56 +01:00
Michael Natterer 79df3dd1e3 plug-ins: port file-pnm-save to GimpProcedureConfig
and clean up export type selection by introducing an enum.
2019-11-08 10:15:02 +01:00
Jehan bf599067ce plug-ins: meson change for previous commit.
In a separate commit to make the rest easier to cherry-pick on
gimp-2-10.
2019-11-06 14:26:23 +01:00
Jehan 31cbc7e0e6 plug-ins: clean all warnings on metadata plug-in.
I made the various static arrays in headers declared as extern and
defined in a separate implementation file, with additional size constant
when necessary (since G_N_ELEMENTS() cannot be used on partially
defined arrays).

Note that this is better than the original implementation, yet I am not
saying this is ideal either. I am not fond of such code organization and
think a better one could be done. But it would require to dive deeper
into this plug-in and I don't want to right now, nor have the time.

At least now it stopped shouting all these warnings!
2019-11-06 14:24:42 +01:00
Jehan 024a919c77 plug-ins: clean out some warnings.
This cleans just a third of the warnings in this metadata plug-in. It is
a very bad practice to define static const strings in a header file like
this, especially if this header is included in several files. Let's make
these macros.

Also why are these header tags sometimes used with the const name (now
macros), sometimes directly with the string literals? I fixed some of
these, but more string literals are lying around.

Remaining warnings are similar, about const string arrays. If really we
want this, we should declare these extern and define them in a separate
implementation file. This whole plug-in should be really reorganized and
cleaned in depth.
2019-11-06 13:36:12 +01:00
Pascal Terjan 85c004edcc Add missing -lm to file-psd plug-in
psd-save.c uses RINT which uses floor(). Not sure why this only
caused a failure on our armv7hl build and why it used to work
but we get:

libtool: link: gcc -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -Wall -Wdeclaration-after-statement -Wmissing-prototypes -Werror=missing-prototypes -Wmissing-declarations -Winit-self -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wlogical-op -Wtype-limits -fno-common -fdiagnostics-show-option -Wreturn-type -Wl,--as-needed -Wl,--no-undefined -Wl,-z -Wl,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags -o .libs/file-psd psd.o psd-util.o psd-load.o psd-save.o psd-thumb-load.o psd-image-res-load.o psd-layer-res-load.o -Wl,--export-dynamic -pthread -Wl,--export-dynamic -pthread  ../../libgimp/.libs/libgimpui-2.0.so ../../libgimpwidgets/.libs/libgimpwidgets-2.0.so ../../libgimpconfig/.libs/libgimpconfig-2.0.so ../../libgimp/.libs/libgimp-2.0.so ../../libgimpcolor/.libs/libgimpcolor-2.0.so ../../libgimpmath/.libs/libgimpmath-2.0.so ../../libgimpbase/.libs/libgimpbase-2.0.so -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lpangoft2-1.0 -lpango-1.0 -lharfbuzz -lfontconfig -lfreetype -lgegl-0.4 -lgegl-npd-0.4 -lgmodule-2.0 -ljson-glib-1.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lbabl-0.1 -lz -ljpeg -pthread
/usr/bin/ld: psd-save.o: undefined reference to symbol 'floor@@GLIBC_2.4'
/usr/bin/ld: /lib/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:756: file-psd] Error 1

And adding -lm seems the right thing to do.

(cherry picked from commit 06b61daa80)
2019-10-31 17:00:01 +01:00
Michael Natterer a5cf3e9506 plug-ins: port file-gif-save to begin_export() and end_export()
and build its GUI using propwidgets. Remove a lot of code that
is now handled by GimpProcedureConfig, and remove the ui file.
2019-10-29 22:10:59 +01:00
Sabri Ünal 4d8a61af34 CID 225792 Resource leak in script-fu-server.c
Variable ai and ai_curr going out of scope at line 496.
Variable ai going out of scope at line 545.

Revealed by Coverity Scan.

(cherry picked from commit 1ce1b0eebe)
2019-10-24 18:05:58 +02:00
Michael Natterer dad65000e1 plug-ins: port file-raw-save to GimpProcedureConfig and propwidgets
and remove its builder file.
2019-10-23 19:08:34 +02:00
Michael Natterer ba77ce58c7 plug-ins: use begin_export() and end_export() in file-xbm
so the "gimp-comment" parasite is handled automatically.
2019-10-23 19:08:34 +02:00
Michael Natterer c25778c882 plug-ins: use begin_export()/end_export() in file-csource
and remove all manual "gimp-comment" parasite code.
2019-10-23 19:08:34 +02:00
Michael Natterer e21f78e577 plug-ins: add an aux "comment" argument to file-png-save
which is now automatically synced with the image's "gimp-comment"
parasite.
2019-10-23 19:08:33 +02:00
Michael Natterer 991703a7ee plug-ins: minor cleanups in file-jpeg, no porting to new stuff yet 2019-10-23 19:08:33 +02:00
Sabri Ünal 0b81e4d056 CID: 228176 Fix a Resource leak
This patch fixes a resource leak which was discovered by Coverity Scan.

(cherry picked from commit 3d7d46ea97)
2019-10-23 14:42:07 +02:00
Jehan ca77fb2c95 plug-ins: mktables.c in file-dds is unused.
There were 2 warnings of unused functions on this file, and masking
them, we were ending with a whole file #ifdef-ed 0. So let's just get
rid of the whole useless file.
2019-10-20 17:11:34 +02:00
Sabri Ünal 93a0b640d2 CID 228074: Missing varargs init or cleanup in file-tiff-io.c
missing va_end: va_end was not called for ap_test.

(cherry picked from commit a7a18cc83f)
2019-10-20 14:27:53 +02:00
Sabri Ünal 0f8b9ed4aa CID 228155: Resource leak in file-tga.c
Variable fp going out of scope leaks the storage it points to.

(cherry picked from commit e6b0b992df)
2019-10-20 00:30:00 +02:00
Sabri Ünal da6c2f890c CID 227971: Resource leak
Leaked storage: Variable infile going out of scope leaks the storage it points to

Discovered by Coverity Scan.

(cherry picked from commit 477c9458ab)
2019-10-19 23:56:30 +02:00
Sabri Ünal 6dcdbf652b CID 228166: Resource leak in file-raw-data.c
Overwriting fp in fp = fopen(newfile, "wb") leaks the storage that fp points to.

(cherry picked from commit 31001d9f29)
2019-10-19 23:30:28 +02:00
Jehan 30e7be6db1 plug-ins: fix usage of gimp_file_save() in py-slice.py.
Signature changed (commit f3fb3d1a), but build could not catch the
missing usage in non-compiled scripts. Thanks to Massimo for noticing
it.
2019-10-12 13:55:07 +02:00
Jehan 9e830c0c30 plug-ins: fix goat-invasion plug-ins installation.
My commit c77c903c8d was obviously wrong since I realize that by fixing
the C plug-in installation, I broke non-C goat-exercise plug-ins
installation. This fixes it.
2019-10-11 14:24:49 +02:00
Michael Natterer 9326f4a76c plug-ins: rename all boolean comment arguments to "save-comment"
and let them default to gimp_export_comment(). Set the default value
of all "comment" arguments to gimp_get_default_comment().
2019-10-10 01:32:28 +02:00
Michael Natterer b5f10b6eda plug-ins: port file-heif and file-webp to the new export stuff 2019-10-09 23:50:14 +02:00
Michael Natterer 8a2f4c9157 plug-ins: port file-png-save to begin_export()/end_export()
which removes quite some boilerplate. Also remove the boolean
"profile_saved" return value of save_image() and instead modify the
config. Add a "bits_per_sample" return value and set value on the
metadata instead of always "8".
2019-10-09 22:51:34 +02:00
Michael Natterer 204df59474 Issue #4054 - Missing closing brackets for some BMP saving names
Fix the broken strings.
2019-10-08 22:11:10 +02:00
Michael Natterer 93bfd6f154 plug-ins: port file-aa to GimpProcedureConfig
Now takes an integer index into the aa_formats array instead of the
format's name. "4" is about as magic as "weird aallib format name #4"
so no harm done.
2019-10-08 01:04:59 +02:00
Michael Natterer 4be4d828ad plug-ins: port file-xbm-save to GimpProcedureConfig
and add boolean arguments to control comment and hot-spot
writing. This revives comment writing, which is disabled by default
and comes with a big warning in the dialog.
2019-10-07 20:36:38 +02:00
Michael Natterer 21b5b6b1aa plug-ins: port file-html-table to GimpProcedureConfig 2019-10-06 15:36:48 +02:00
Michael Natterer d84d42c835 plug-ins: rename procedure file-gtm-save to file-html-table-save 2019-10-05 19:32:17 +02:00
Michael Natterer a59c13b724 plug-ins: port file-csource to GimpProcedureConfig 2019-10-05 19:29:20 +02:00
Michael Natterer 6660dc540d plug-ins: port file-tga-save to GimpProcedureConfig 2019-10-05 12:41:53 +02:00
Michael Natterer f9ddf6ea03 Issue #4008 - Ellipsis missing in File -> Page Setup
Add the missing ellipsis.
2019-10-05 12:22:58 +02:00
Michael Natterer 51ecb9929c plug-ins: port file-psp-save to GimpProcedureConfig
...just to realize that the save function is not implemented. At least
we now properly manage a fake argument of a nop procedure, yay.
2019-10-04 21:51:43 +02:00
Michael Natterer efb6ea9ceb plug-ins: port file-fli to GimpProcedureConfig
While testing noticed that the plug-in either loads or saves total
garbage, but also in 2.10, so it's not a recent regression.
2019-10-04 12:26:23 +02:00
Michael Natterer 50b8adc715 plug-ins: port file-fits to GimpProcedureConfig 2019-10-03 16:00:17 +02:00
Michael Natterer 871a31f70c plug-ins: remove ddsplugin.h and add ddsread.h and ddswrite.h 2019-10-02 20:54:16 +02:00
Michael Natterer 42564c076a plug-ins: port file-dds-save to GimpProcedureConfig 2019-10-02 20:47:33 +02:00
Michael Natterer 75396106d1 plug-ins: port file-dds-load to GimpProcedureConfig 2019-10-01 23:31:06 +02:00
Michael Natterer e2ec4e0bd2 plug-ins: more file-dds cleanup 2019-10-01 18:29:42 +02:00
Jehan e65639ecc3 plug-ins: generated rc files depends on git-version.h.
We must make sure that git-version.h has already been generated before
we run windows.compile_resources() for the Windows host.
2019-10-01 00:38:28 +02:00
Michael Natterer d3cfae2795 plug-ins: same cleanup in the DDS load dialog
and some more general cleanups.
2019-09-30 15:28:42 +02:00
Michael Natterer b10bdf88fd plug-ins: prepare file-dds for GimpProcedureConfig porting
by replacing its own combo box code by GimpIntComboBox which is
trivially portable to propwidgets. Also some formatting cleanup in the
save code.
2019-09-30 14:22:25 +02:00
Michael Natterer b6b77feae2 plug-ins: port file-bmp to GimpProcedureConfig and propwidgets 2019-09-28 19:59:03 +02:00
Michael Natterer 68c3574569 plug-ins: clean up file-bmp-save in preparation for GimpProcedureConfig
and get rid of all these expanders and frames in the dialog.
2019-09-28 16:24:25 +02:00
Michael Natterer 1b48c687ca plug-ins: port file-webp to GimpProcedureConfig 2019-09-27 16:24:16 +02:00
Michael Natterer 2e18a91916 plug-ins: saner argument name in blinds 2019-09-27 12:08:10 +02:00
Michael Natterer 5cccad9867 plug-ins: move around and clean up some code in file-webp
as preparation for GimpProcedureConfig porting.
2019-09-27 12:07:20 +02:00
Michael Natterer e4acb969ba plug-ins: port file-xpm to GimpProcedureConfig 2019-09-26 12:09:41 +02:00
Michael Natterer 9cb62f5f9a libgimp: move "image" and "run_mode" from gimp_procedure_config_end_run()
and remember them internally between begin_run() and end_run().
Simplifies plug-in code even more.

Move the begin_run() before gimp_export_image() block in all export
plug-ins.
2019-09-26 00:44:52 +02:00
Michael Natterer e8ed263e63 plug-ins: port file-sunras to GimpProcedureConfig 2019-09-25 23:26:28 +02:00
Michael Natterer 505473ab76 plug-ins: gih_save(): file-gih-save-internal takes a GFile now 2019-09-25 22:41:07 +02:00
Michael Natterer 9593121431 app, libgimpwidgets: return visible widgets from all gimp_prop_foo_new()
and remove a gazillion gtk_widget_show() all over the place, some
places need a gtk_widget_hide() now, and I'm pretty sure I broke at
least one thing in all those files...
2019-09-25 20:24:06 +02:00
Michael Natterer 1099aea726 plug-ins: rename all "save-profile" args to "save-color-profile" 2019-09-25 12:50:29 +02:00
Michael Natterer 58bf1d431d libgimp: add a "status" parameter to gimp_procedure_config_end_run()
and require it to be always called paired with begin_run(), which is
more straightforward and makes the resulting code more future-proof.
2019-09-25 12:09:03 +02:00
Michael Natterer 1793a08548 plug-ins: port file-png to GimpProcedureConfig and use propwidgets
Remove the save dialog's builder file and construct the dialog
manually, which is actually less and more obvious code thanks to
propwidgets, which are not suited for a builder GUI.

I guess file-png-save counts as a real test for the new procedure
config stuff, and it seems to work nicely. The only thing that's a bit
ugly is the GimpMetadata integration which doesn't exist yet.
2019-09-25 01:06:16 +02:00
Michael Natterer d257c7ba91 plug-ins: remove second parameter of gimp_ui_init() in all non-C plug-ins 2019-09-24 19:43:58 +02:00
Michael Natterer 81cbc3edb7 plug-ins: port file-heif to GimpProcedureConfig
and also use an aux argument, seems to work fine.
2019-09-24 19:35:49 +02:00
Michael Natterer f94a241931 plug-ins: minor cleanup in file-pat 2019-09-24 15:58:54 +02:00
Michael Natterer e34ffbff81 plug-ins: port file-sgi to GimpProcedureConfig
and use the changed gimp_int_store_new() in the dialog. It appears
to be a straightforward way to replace gimp_int_radio_group_new()
which should really go away for 3.0.
2019-09-24 01:02:19 +02:00
Michael Natterer f3eef8fe83 plug-ins, app: port file-pat to GimpProcedureConfig
Exactly the same changes as in file-gbr.
2019-09-23 23:28:10 +02:00
Michael Natterer 104ddb1374 plug-ins: minor follow-up cleanup in file-gbr 2019-09-23 23:24:42 +02:00
Michael Natterer b8fb09d330 plug-ins, app: port file-gbr to GimpProcedureConfig
and use the new feature of saving the last config in an image
parasite.

In app/file-data/fie-data-gbr.c, manually construct the same parasite
when loading a brush, so its spacing and description are stored in the
image.

This replaces the "gimp-brush-name" parasite which is now obsolete.
2019-09-23 19:49:36 +02:00
Michael Natterer 243042730e libgimp: add "image" parameters to gimp_procedure_config_begin,end_run()
When non-NULL, the code tries to load/save image-specific last used
values from/to the image using a parasite. This is meant to be used by
file export plug-ins.
2019-09-23 19:28:04 +02:00
Jehan 2c6e21b1e7 plug-ins: fix another cast warning.
Fix again these warnings:
> cast from pointer to integer of different size
2019-09-23 10:50:33 +02:00
Jehan 0567bb2e71 plug-ins: fix some more cast of different size warnings.
Use GINT_TO_POINTER() and GPOINTER_TO_INT() on GList functions.
2019-09-22 14:20:02 +02:00
Jehan a2c92c576d app, plug-ins: (Win32) fix calls to ShellExecute().
This function returns a HINSTANCE (which is technically a pointer if I
understand correctly) for backward compatibility reason. But this is
actually meant to be used as an int only according to the docs.
Yet casting to gint outputs "cast from pointer to integer of different
size" warnings.
We should use intptr_t instead for such cases, since it is a type made
explicitly to hold a pointer as int, hence should always be right on any
platform.

https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutea
2019-09-22 14:09:09 +02:00
Jehan 6bc6a07b7e libgimpbase, plug-ins: fix all warnings to g_stat() calls.
The second parameter should be GStatBuf*, which will be defined to be
the right struct depending on the actual platform. Using `struct stat*`
was good on Linux but was outputting warnings on other platforms (at
least on Win32).
2019-09-22 13:52:37 +02:00
luzpaz 44d10e458c Fix various typos
Found via `codespell` (v1.17.0.dev0)
2019-09-21 17:10:46 +00:00
Jehan 142002446e plug-ins: fix a type warning.
When cross-compiling for Windows, I had this warning:
> plug-ins/file-ico/ico-load.c:221:22: warning: format '%lu' expects
> argument of type 'long unsigned int', but argument 5 has type 'long
> long unsigned int' [-Wformat=]

I guess that on some platform sizeof may be a long long uint. Just cast
the result to long uint instead (I could have done the other way around,
but I doubt the struct type IcoFileEntry would ever get bigger than long
uint max!).
2019-09-21 18:32:09 +02:00
Michael Natterer 1bca89163d libgimpbase: remove gimp_personal_rc_file()
and port its remaining users to gimp_directory_file().
2019-09-21 18:08:13 +02:00
Jehan c77c903c8d plug-ins: fix C goat-exercise build/installation in meson.
It was installing in separate dirs `goat-exercise/goat-exercise` and
`goat-exercise-c/goat-exercise-c.c`. This is obviously wrong as the C
raw file is obviously not a plug-in of its own, it is just a data for
the built plug-in to be displayed as source.
Anyway now fixed to work like the autotools build.
2019-09-21 14:21:00 +02:00
Jehan b834fdb64a plug-ins: remove unused variable.
Fix:
> ifs-compose.c:1501:20: warning: unused variable ‘style’ [-Wunused-variable]

Unused since commit b347cc73a1.
2019-09-21 00:27:15 +02:00
Michael Natterer df8d5b02ae libgimp, plug-ins: remove the "preview" parameter from gimp_ui_init()
It's dead since a looong time.
2019-09-20 19:56:00 +02:00
Michael Natterer f62665ad31 plug-ins: use GimpProcedureDialog in despeckle 2019-09-20 19:26:07 +02:00
Michael Natterer df62d08798 plug-ins: as a proof-of-concept, port despeckle to GimpProcedureConfig
Its entire dialog and execution are now based on object properties and
widgets are views on the properties. Also add a "Reset" button.
2019-09-20 12:54:50 +02:00
Michael Natterer 0029760e2e plug-ins: add some missing types to script_fu_marshal_procedure_call()
Scripts must be able to pass values to procedures even if they have no
idea what the actual parameter type is (item, uchar, layer mask), to
the script it's all just numbers anyway.
2019-09-17 21:42:10 +02:00
Jehan 642e47efaa plug-ins: fix warning.
Fix the following warning for missing case values:
> enumeration value ‘WEBKIT_LOAD_REDIRECTED’ not handled in switch
(same for WEBKIT_LOAD_COMMITTED)
2019-09-17 11:21:19 +02:00
Jehan ccc8224aa9 plug-ins: mask the 3 "Converts *" procedure from file-dds plug-in.
They are semantically wrong anyway because they work on drawable,
assuming that the drawable is encoded in whatever non-RGB pixel (while
getting data in R'G'B'A format). This is just an internal trick of the
file-dds plug-in which converts DDS data internally instead of having
babl doing the job by making appropriate formats.

Anyway we should definitely not expose such procedure publicly. I am not
deleting the code directly, just hiding it away in `#if 0` for now.
2019-09-16 10:41:00 +02:00
Jehan 7777c5fa0c plug-ins: port gradients-save-as-css to Python 3 + new API. 2019-09-15 10:20:11 +02:00
lillolollo b942682280 fix
```
../../gimp/plug-ins/common/file-psp.c: In function 'load_image':
../../gimp/plug-ins/common/file-psp.c:1930:25: warning: passing argument 2 of 'g_stat' from incompatible pointer type [-Wincompatible-pointer-types]
 1930 |   if (g_stat (filename, &st) == -1)
      |                         ^~~
      |                         |
      |                         struct stat *
In file included from ../../gimp/plug-ins/common/file-psp.c:44:
C:/msys64/mingw64/include/glib-2.0/glib/gstdio.h:134:31: note: expected 'GStatBuf *' {aka 'struct _stat64 *'} but argument is of type 'struct stat *'
  134 |                  GStatBuf    *buf);
      |                  ~~~~~~~~~~~~~^~~

```
2019-09-14 22:21:11 +00:00
Jehan 5495689180 plug-ins: fix Python plug-ins installation.
They were installed under $libdir/gimp/2.99/ instead of
$libdir/gimp/2.99/plug-ins/.
2019-09-14 22:39:39 +02:00
Ell 65530b6aa7 Issue #3925 - Gimp from git master segfaults when showing preview of exported JPEG file
In file-jpeg-save, ref the file object when using a preview idle
to keep it alive.
2019-09-12 21:05:34 +03:00
Ell 077e596dfc plug-ins: fix wrong g_free() in jpeg-save
... after GFile port.
2019-09-12 19:40:35 +03:00
Michael Natterer 63e0e7679b plug-ins: fix "film" to not crash on repeat
Can't have objects in the last_vals struct, use image IDs again.
2019-09-12 12:42:09 +02:00
Ell f1a13b4904 plug-ins: fix optional common/ plug-ins in meson build
Align plug-ins/common/meson.build with plugin-defs.pl, avoiding
building optional plug-ins whose dependencies aren't met.

Fix the build condition of the mail plug-in.
2019-09-12 13:04:16 +03:00
Michael Natterer 83a936b8fe pdb: rename all functions in the "plug_in" group
from gimp_plugin_foo() to gimp_plug_in_foo() for consistency.
2019-09-11 23:58:47 +02:00
Michael Natterer 6468fa06c7 pdb, plug-ins: change gimp_temp_name() to gimp_temp_file() 2019-09-11 22:32:44 +02:00
Michael Natterer 6bca8c4f89 pdb, app, libgimp, plug-ins: replace most PDB filenames/URIs by GFile
and in an attack of madness, changes almost all file plug-in
code to use GFile instead of filenames, which means passing
the GFile down to the bottom and get its filename at the very
end where it's actually needed.
2019-09-11 21:48:34 +02:00