John Cupitt
19009b15a9
revise loader demand hints
...
Add a check that header and load methods agree on the demand hint, and
make sure all loaders pass.
If they disagree, you can get bad performance in some cases, since the
pipeline can be built from the header dhint.
2022-09-03 15:31:37 +01:00
John Cupitt
0f56b099d0
remove dbg
2022-08-05 09:14:28 +01:00
John Cupitt
34c17fc3e8
don't minimise after sink_screen expose
...
We were minimising at the end of threadpool_run, but this was being
called for each sinkscreen render pass, so we were throwing away the
display cache.
Instead, minimise after sink, sink_memory and sink_disc.
2022-08-05 09:12:13 +01:00
Kleis Auke Wolthuizen
e1098857b3
svgload: use `rsvg_handle_get_geometry_for_element` instead ( #2919 )
...
See: https://gitlab.gnome.org/GNOME/librsvg/-/issues/853 .
2022-07-12 12:33:54 +01:00
Kleis Auke Wolthuizen
1214f942f9
Prefer to use `flags |=` everywhere ( #2854 )
...
Use the bitwise OR assignment operator to ensure that derived
classes does not overwrite the flags from the base class. Also,
move the flags from `openslideload_source` to its base class.
2022-06-11 15:40:39 +01:00
John Cupitt
2d0c6b364c
improve scaling of SVG images
...
We were not scaling images with fixed absolute dimensions.
2022-06-06 12:08:43 +01:00
John Cupitt
586fb31550
switch svgload to random access
...
and fix up pdfload random access
2022-06-05 15:57:43 +01:00
Kleis Auke Wolthuizen
85c24481be
svgload: recognize dimensions for SVGs without width/height ( #2817 )
...
Rather than defaulting to 1928x1080. Also, prefer to use the
`LIBRSVG_CHECK_VERSION` macro instead of our configure checks.
2022-05-23 10:39:53 +01:00
John Cupitt
c5ea747f71
Merge branch 'master' of github.com:libvips/libvips
2022-05-18 10:57:56 +01:00
John Cupitt
e42d2b46b9
revise SVG scaling, again
...
we were not defaulting width and height correctly
see https://github.com/lovell/sharp/pull/3230
2022-05-18 10:55:41 +01:00
Kleis Auke Wolthuizen
f1b4b0cb1a
Swap size_t with gint64 to catch read errors ( #2811 )
...
This is similar to commit 5221df224f
.
2022-05-17 22:04:20 +01:00
John Cupitt
20fd8ac0fc
support rsvg_handle_get_intrinsic_size_in_pixels
...
librsvg 2.52+ has this new bit of API for finding the SVG dimensions
2022-04-28 13:01:17 +01:00
John Cupitt
eba9ec0dd7
Add a way to disable less well tested operations ( #2636 )
...
* quick proposal
warn on startup if untrusted operations might run
use vips_block_untrusted_set() to block untrusted operations, set an env
var or make a file to stop the warning
* mark fits, nifti and svg as untrusted
* remove the annoying "untrusted" warning message
better to warn on the download page
leave vips_block_untrusted_set() since it's obviously useful
* separate UNTRUSTED and BLOCKED
* typos
* add VIPS_BLOCK_UNTRUSTED env var
* move BLOCK_UNTRUSTED after plugin load
obviously, ooops
* add a test, disable *magick
although *magick is fuzzed, it's probably safer to disable it in
untrusted environments
* mark some more operations as untrusted
2022-04-11 11:32:32 +01:00
Kleis Auke Wolthuizen
0337c09700
Cleanup gettext handling ( #2695 )
...
Use GLib's i18n support instead of copying and pasting that
logic into its own header. This deprecates the vips/intl.h
header in favour of glib/gi18n.h.
2022-02-27 15:27:28 +00:00
John Cupitt
cb58d7d960
_source loaders should all be nocache
...
When we image_new_from_source, the source object has some of the loader
state: it tracks the current read position of the load library. This
means that we mustn't keep source loaders in the operation cache, since
a second call could give a different result because the source object
read position might have changed.
Also: add a rewind to get_flags_source in spngload, and jp2k needs to
tag its load region as having no thread ownership or you'll get assert
fails in the test suite with debug enabled.
2021-11-19 13:55:49 +00:00
John Cupitt
b2527da531
allow utf-8 header for svg detection ( #2481 )
...
* allow utf-8 header for svg detection
We were checking that the first 24 chars of an SVG were plain ASCII,
but that's not always the case, for example:
<svg id="レイヤー_1のコピー"
data-name="レイヤー 1のコピー"
xmlns="http://www.w3.org/2000/svg "
viewBox="0 0 100 100">
</svg>
We now test for the string "<svg" being in the first 1000 bytes, and
everything up to that being valid utf-8.
See https://github.com/libvips/libvips/issues/2438
* raise priority of webpload
it was very low priority before, for some reason
2021-10-15 13:21:50 +01:00
John Cupitt
2b0aae2d72
Merge pull request #2298 from libvips/update-svgload-to-latest
...
update svgload to work with latest librsvg
2021-07-18 18:58:32 +01:00
John Cupitt
757d031005
always check the return of vips_image_pipeline()
...
For consistency. Although I don't think it can meaningfully fail.
2021-06-29 16:12:17 +01:00
John Cupitt
ea5972055f
Merge branch '8.11'
2021-06-28 20:33:51 +01:00
Lovell Fuller
d1c038c22d
svgload: skip images with invalid dimensions
2021-06-28 14:21:40 +01:00
John Cupitt
7512e410ca
add svgload_string
...
simple convenience function for C
2021-06-28 11:45:56 +01:00
John Cupitt
16a6c08af7
update svgload to work with latest librsvg
...
rsvg_handle_render_cairo() is deprecated
2021-06-11 10:35:17 +01:00
John Cupitt
4b0fd255de
Merge pull request #2293 from DarthSim/fix/svg-error-leak
...
Delete Cairo context on rsvg_handle_render_cairo error
2021-06-09 13:22:17 +01:00
DarthSim
b8f7fb6d20
Delete Cairo context on rsvg_handle_render_cairo error
2021-06-09 17:41:37 +06:00
John Cupitt
15f4d935aa
Merge branch '8.10'
2021-02-09 16:23:46 +00:00
Lovell Fuller
a8dd8379ac
svgload: remove deprecated librsvg include
...
librsvg >= 2.40.3 includes it for you
librsvg >= 2.51.0 removes it entirely
2021-02-08 20:22:12 +00:00
John Cupitt
8fafa23442
Merge branch '8.10'
2020-12-18 17:16:24 +00:00
John Cupitt
230f5924cf
duplicate "svgload" operation
2020-12-18 11:30:03 +00:00
John Cupitt
a1ae0d1d68
revise BGRA->RGBA
2020-10-17 13:42:57 +01:00
Lovell Fuller
69ee8a32b6
Ensure SVG loader skips input with chars outside x09-x7F range
...
Add test with example valid WebP image that happens to contain
the string '<svg' within its compressed image data.
2020-08-21 11:38:40 +01:00
Lovell Fuller
489324f392
Ensure SVG loader skips input with chars outside x09-x7F range
...
Add test with example valid WebP image that happens to contain
the string '<svg' within its compressed image data.
2020-08-21 10:17:08 +01:00
Lovell Fuller
3ca21ee2e8
Increase minimum glib-2.0 dependency to v2.15 (released March 2012)
2020-03-26 19:13:21 +00:00
John Cupitt
d4f12a9999
move VipsGInputStream to public API
...
Since we will need it for pdfload as well.
2020-03-11 17:17:45 +00:00
John Cupitt
6605029bc3
revise svg detection
...
We weren't checking svgz files as far in.
2020-01-15 09:01:38 +00:00
John Cupitt
252996e3ff
make check passes after stream -> source rename
2019-12-30 12:48:20 +00:00
John Cupitt
4c5873809f
experiment with renaming stream
...
rename as VipsConnection, VipsSource, VipsTarget etc.
see https://github.com/libvips/libvips/issues/1494#issuecomment-569498619
renamed with this script:
```
set -e
edit() {
sed -i -E "$1" rename
}
for i in $*; do
cp $i rename
edit s/VIPS_STREAMOU/VIPS_TARGET_CUSTOM/g
edit s/VIPS_STREAMO/VIPS_TARGET/g
edit s/VIPS_STREAMIU/VIPS_SOURCE_CUSTOM/g
edit s/VIPS_STREAMI/VIPS_SOURCE/g
edit s/VIPS_STREAM/VIPS_CONNECTION/g
edit s/vips_streamou/vips_target_custom/g
edit s/vips_streamo/vips_target/g
edit s/vips_streamiu/vips_source_custom/g
edit s/vips_streami/vips_source/g
edit s/vips_stream/vips_connection/g
edit s/VipsStreamou/VipsTargetCustom/g
edit s/VipsStreamo/VipsTarget/g
edit s/VipsStreamiu/VipsSourceCustom/g
edit s/VipsStreami/VipsSource/g
edit s/VipsStream/VipsConnection/g
# eg. VIPS_TYPE_STREAM or VIPS_IS_STREAM
edit "s/VIPS_([A-Z]+)_STREAMOU/VIPS_\1_TARGET_CUSTOM/g"
edit "s/VIPS_([A-Z]+)_STREAMO/VIPS_\1_TARGET/g"
edit "s/VIPS_([A-Z]+)_STREAMIU/VIPS_\1_SOURCE_CUSTOM/g"
edit "s/VIPS_([A-Z]+)_STREAMI/VIPS_\1_SOURCE/g"
edit "s/VIPS_([A-Z]+)_STREAM/VIPS_\1_CONNECTION/g"
edit s/streamou/target_custom/g
edit s/streamo/target/g
edit s/streamiu/source_custom/g
edit s/streami/source/g
# various identifiers which also change
edit s/is_a_stream/is_a_source/g
edit s/find_load_stream/find_load_source/g
edit s/find_save_stream/find_save_target/g
edit s/new_from_stream/new_from_source/g
edit s/write_to_stream/write_to_target/g
edit s/vips_thumbnail_stream/vips_thumbnail_source/g
# eg. vips_webpload_stream
edit "s/vips_([a-z]+)load_stream/vips_\1load_source/g"
# eg. vips_webpsave_stream
edit "s/vips_([a-z]+)save_stream/vips_\1save_target/g"
mv rename $i
done
```
2019-12-29 21:40:21 +00:00
John Cupitt
561f410f0a
rework pngload
...
To match the new radload pattern.
2019-12-24 07:55:06 +00:00
John Cupitt
861f6d1ef4
radload was not setting priority correctly
...
We used to have separate subclasses for file, buffer and stream load,
but only set ->priority in one of them.
Rework radload as a base class plus a set of implementations.
2019-12-23 17:22:15 +00:00
John Cupitt
74ac881938
Merge branch 'master' into add-stream-object
2019-11-20 16:56:19 +00:00
John Cupitt
b686110496
tiny formatting fix
2019-11-20 15:53:04 +00:00
John Cupitt
9a193f6f4c
test for gio
...
It seems glib added gio in 2.15, though I don't know if svgload will
actually work with a glib that old.
2019-11-19 17:05:12 +00:00
John Cupitt
a129cef9dd
add streamo_steal
...
and start converting some old dbuf code
2019-11-19 06:47:24 +00:00
John Cupitt
c7f622d646
try simplifying vips_g_input_stream_skip()
...
Just does a `SEEK_CUR` now.
2019-11-18 15:28:14 +00:00
John Cupitt
73dd7eebe5
move streamiw inside svgload
...
since that's the only place it is used
2019-11-18 15:07:37 +00:00
John Cupitt
f5a4f41edf
rename VipsStream* variables
...
The convention is now:
VipStreami *streami;
We had `input` in many places, a left-over from the old VipStreamInput
name.
2019-11-11 09:09:34 +00:00
John Cupitt
998b5eea45
fix svgload sniff
...
by adding vips_streami_sniff_at_most()
2019-11-11 07:53:36 +00:00
John Cupitt
441f61f3ff
svgload from a stream
2019-11-10 17:23:28 +00:00
Kleis Auke Wolthuizen
41c08b0ffb
Add svgload_stream to the descriptors test
...
Seems to work!
2019-11-10 12:32:18 +01:00
Kleis Auke Wolthuizen
609fdb4fb6
WiP: Add svgload_stream
...
TODO: Should we `#ifdef HAVE_RSVG` the VipsStreamiw class?
2019-11-09 18:19:54 +01:00
Lovell Fuller
894ec7db84
Ensure SVG dimensions are rounded correctly
...
when scaling or setting density via cairo
2019-11-01 18:26:53 +00:00