1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-05 03:20:39 -08:00
Commit graph

805 commits

Author SHA1 Message Date
Eli Zaretskii
19dcb237b5 ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
Alan Third
7b6fb486c2 Fix potential buffer overflow (bug#50767)
* src/image.c (svg_load_image): Check how many bytes were actually
written to the buffer.  Don't check xmalloc return value as xmalloc
doesn't return if it fails.
2021-10-17 10:54:18 +01:00
Stefan Kangas
0cabf8bc36 ; Fix typos 2021-09-03 13:05:32 +02:00
Eli Zaretskii
8168a792ca Fix deprecation warnings from libtiff
* src/image.c (UINT32) [TIFFLIB_VERSION >= 20210416]: Define to
use stdint.h type for recent libtiff versions.  Reported by Andy
Moreton <andrewjmoreton@gmail.com>.
2021-07-14 15:27:19 +03:00
Paul Eggert
3b29afa680 Pacify GCC 11.1.1 20210531 (Red Hat 11.1.1-3)
* src/image.c (xpm_load_image):
* src/xfns.c (x_icon):
Rework to pacify gcc -Wmaybe-uninitialized.
2021-07-11 01:30:12 -07:00
Alan Third
fb62846b68 Fix image filename encoding issues (bug#48902)
* src/image.c (image_find_image_fd): Don't return an encoded filename
string.
* src/nsfns.m: ([NSString stringWithLispString:]): Clarify usage
comment.
* src/nsimage.m ([EmacsImage allocInitFromFile:]): No need to encode
the filename when converting to NSString.
2021-06-09 12:54:58 +01:00
Eli Zaretskii
cd0e7d51ab ; * src/image.c (xpm_format, xpm_valid_color_symbols_p): Fix last change. 2021-05-13 12:33:08 +03:00
Eli Zaretskii
3547e01d96 * src/image.c (xpm_image_p): Avoid another compiler warning. 2021-05-13 12:23:19 +03:00
Eli Zaretskii
0b0ab33f2d * src/image.c: Avoid compiler warnings in Cairo builds without XPM. 2021-05-13 12:17:44 +03:00
Andrea Corallo
b5c76530fa Merge remote-tracking branch 'savannah/master' into native-comp 2021-04-19 18:46:50 +02:00
Alan Third
c7555f037a Fix :scale's affect on :width and :height (bug#47819)
* src/image.c (compute_image_size): Multiply width and height values
by scale.
2021-04-17 09:41:37 +01:00
Alan Third
c237209643 Allow use of em in image spec sizes
* src/image.c (image_get_dimension): New function.
(compute_image_size): Use image_get_dimension to set the sizes, and
pass in the image struct instead of just the spec.
(image_set_transform):
(imagemagick_load_image):
(svg_load_image): Use the image instead of the spec in compute_image_size.
(syms_of_image): Add 'em' as a symbol.
2021-04-15 17:56:23 +01:00
Andrea Corallo
74b58f28ec Merge remote-tracking branch 'savannah/master' into native-comp 2021-04-05 21:00:18 +02:00
Eli Zaretskii
c3cd3fb051 Fix MS-Windows build
* src/image.c: (init_svg_functions) [WINDOWSNT]: Define and load
rsvg_handle_set_stylesheet from the DLL for librsvg > 2.48.
(lookup_image): Use xmalloc.
2021-04-04 14:54:19 +03:00
Alan Third
841b11ed0d Fix warnings in image.c
* src/image.c (svg_load_image): Fix types and move declaration of
'css' to the top of the function.
2021-04-04 11:27:29 +01:00
Alan Third
1fdbeffe3a Set CSS for SVG files
* src/dispextern.h (struct image): Add font details required for the CSS.
* src/image.c (free_image): Free the font family string.
(search_image_cache):
(uncache_image): Make image caching understand the font details.
(lookup_image): Handle the font details when generating the image and
looking up the cache.
(svg_css_length_to_pixels): Handle 'em' when we know the font size.
(svg_load_image): Generate the CSS and apply it to the SVG.
(enum svg_keyword_index):
(svg_format):
(syms_of_image): Add ':css' attribute.
* doc/lispref/display.texi (SVG Images): Add details of new svg image
attributes.
2021-04-03 23:07:01 +01:00
Alan Third
4e1f92feb3 Implement frame-scale-factor
* src/frame.c (Fframe_scale_factor): New function.
(syms_of_frame): Add frame-scale-factor.
* src/frame.h: Add FRAME_SCALE_FACTOR.
* src/image.c: Move FRAME_SCALE_FACTOR to frame.h.
2021-04-03 23:06:44 +01:00
Andrea Corallo
6ca6c71cd0 Merge remote-tracking branch 'savannah/master' into native-comp 2021-03-19 15:28:00 +01:00
Andrea Corallo
b3ad62f8a3 Do not load native code when `load' is explicitly called on a .elc file
* src/lread.c (Fload): Do not load native code when `load' is
	explicitly called on a .elc file.
	(Flocate_file_internal): Update 'openp' call sites.
	(maybe_swap_for_eln): Add new 'no_native' parameter.
	(openp): Likewise + update 'maybe_swap_for_eln' and 'openp' call
	sites.
	* src/lisp.h: Update 'openp' signature.
	* src/w32proc.c (sys_spawnve): Update 'openp' call sites.
	* src/w32.c (check_windows_init_file): Likewise.
	* src/sound.c (Fplay_sound_internal): Likewise.
	* src/process.c (Fmake_process): Likewise.
	* src/image.c (image_create_bitmap_from_file)
	(image_find_image_fd): Likewise.
	* src/emacs.c (set_invocation_vars): Likewise.
	* src/charset.c (load_charset_map_from_file): Likewise.
	* src/callproc.c (call_process): Likewise.
2021-03-19 10:23:41 +01:00
Alan Third
ebc3b25409 Fix buffer overflow in xbm_scan (bug#47094)
* src/image.c (xbm_scan): Ensure reading a string doesn't overflow the
buffer.
2021-03-13 22:01:31 +00:00
Philipp Stephani
222d70333f * src/image.c (image_set_transform): Don't use ! for Lisp object. 2021-03-11 11:05:32 +01:00
Philipp Stephani
9ab51428cd * src/image.c (FRAME_SCALE_FACTOR): Define only when needed. 2021-03-11 11:04:57 +01:00
Basil L. Contovounesios
f695fdfef7 ; Fix US spelling in last change. 2021-03-10 23:28:28 +00:00
Alan Third
c93447eac6 Enable selectable image smoothing (bug#38394)
* lisp/doc-view.el (doc-view-insert-image): Always use smoothing in
docview.
* lisp/image-mode.el (image-transform-smoothing): New variable.
(image-mode-map): Add smoothing binding.
(image-transform-properties): Apply smoothing when requested.
(image-transform-set-smoothing): New function.
(image-transform-reset): Reset smoothing.
* src/image.c (image_set_transform): Use new :transform-smoothing
attribute.
(syms_of_image): Add :transform-smoothing attribute.
* doc/lispref/display.texi (Image Descriptors): Document new
:transform-smoothing property.
2021-03-10 21:40:42 +00:00
Alan Third
0474a0d7d4 Remove aliasing on SVG images under scaled NS frames
* src/image.c (FRAME_SCALE_FACTOR): New #define for getting frame
scale factor.
(image_set_transform):
(svg_load_image): Use FRAME_SCALE_FACTOR.
* src/nsterm.m (ns_frame_scale_factor): Get the scale factor for an NS
frame.
2021-02-13 22:40:47 +00:00
Paul Eggert
ba05d005e5 Update copyright year to 2021
Run "TZ=UTC0 admin/update-copyright".
2021-01-01 01:13:56 -08:00
Zajcev Evgeny
b3c9af9061 Improvements for `:base-uri' svg image property
* src/image.c (svg_load): Use ENCODE_FILE for `:base-uri'

* doc/lispref/display.texi (SVG Images): Add more documentation for
  `:base-uri'
2020-12-26 11:18:49 +02:00
Alan Third
537e96f6ac Fix image cache lookup
* src/image.c (lookup_image): ignore_colors should be false as we want
to search for images with matching colors.
2020-12-20 21:29:16 +00:00
Mattias Engdegård
409a9dbe9d image-cache-size improvements
Implement for non-Cairo X11 and NS.  Count masks as well, and
XImage objects on X11.

* src/image.c (image_size_in_bytes): New.
(image_frame_cache_size): Use image_size_in_bytes.
* src/nsterm.h:
* src/nsimage.m (ns_image_size_in_bytes, [EmacsImage sizeInBytes]):
New function and method.
* src/w32gui.h:
* src/w32term.c (w32_image_size): Update signature.
2020-12-20 18:17:17 +01:00
Glenn Morris
6a2c13280c Merge from origin/emacs-27
62a6934af9 Fix crash when using XRender and restoring image from X (b...
de032d41c6 Bind k to image-kill-buffer in doc-view-mode-map.
2020-12-15 09:23:37 -08:00
Alan Third
c6f21e2420 Fix assertion on SVG load failure
* src/image.c (svg_load_image): Move setting DPI to after rsvg_handle
error checking.
2020-12-12 23:53:47 +00:00
Zajcev Evgeny
f45ce78c40 Explicitly specify svg base_uri using `:base-uri' image property
* src/image.c (svg_load): Check `:base-uri' image property to
explicitly set base_uri for images embedded into SVG
(enum svg_keyword_index):
(svg_format): Add :base-uri.
* lisp/svg.el (svg-embed-base-uri-image): New function to embed images
located relative to images `:base-uri'
2020-12-12 12:48:32 +00:00
Alan Third
8ff70045c3 Revert "Explicitly specify svg base_uri using `:base-uri' image property"
This reverts commit a8e2143a5c.

I applied the incorrect version of the patch.
2020-12-12 12:48:32 +00:00
Eli Zaretskii
204d151940 Unbreak the MS-Windows build broken by recent changes
* src/image.c (rsvg_handle_set_dpi_x_y) [WINDOWSNT]: DEF_DLL_FN it.
(init_svg_functions): LOAD_DLL_FN rsvg_handle_set_dpi_x_y.
<rsvg_handle_set_dpi_x_y>: Define as a macro
2020-12-12 13:25:35 +02:00
Eli Zaretskii
61b6cc401a Improve support for 'memory-report' on MS-Windows
* src/w32term.c (w32_image_size): New function.
* src/image.c (image_frame_cache_size) [HAVE_NTGUI]: Support
reporting the size of frame image cache.
(image_frame_cache_size, Fimage_cache_size): The total size is
now of the type 'size_t', not 'int'.
2020-12-12 13:12:57 +02:00
Alan Third
03ac24f239 Use real DPI when rendering SVGs (bug#45124)
* src/image.c (svg_css_length_to_pixels): Pass in a DPI value instead
of using a hard coded value.
(svg_load_image): Set the DPI on the rsvg_handle, and pass it to
svg_css_length_to_pixels.
2020-12-12 10:30:56 +00:00
Zajcev Evgeny
a8e2143a5c Explicitly specify svg base_uri using `:base-uri' image property
* src/image.c (svg_load): Check `:base-uri' image property to
  explicitly set base_uri for images embedded into SVG
2020-12-12 10:30:56 +00:00
Alan Third
62a6934af9 Fix crash when using XRender and restoring image from X (bug#44930)
* src/dispextern.h (struct image): Add original dimension elements.
* src/image.c (image_set_transform): Store the original dimensions.
(image_get_x_image): If we're using transforms use the original
dimensions with XGetImage.
2020-12-12 10:30:39 +00:00
Lars Ingebrigtsen
711e7bf29c Fix image-cache-size crash
* src/image.c (image_frame_cache_size): Ensure that img->pixmap is
in use before trying to access it.
2020-12-11 21:16:08 +01:00
Lars Ingebrigtsen
eebb7c8a69 Fix compilation of image.c on non-Cairo systems
* src/image.c (image_frame_cache_size): pixmap->width etc is only
defined on Cairo.  Return 0 for now on other systems.
2020-12-11 16:02:54 +01:00
Lars Ingebrigtsen
9d598ef93c Add new function 'image-cache-size'
* src/image.c (Fimage_cache_size): New defun.
(image_frame_cache_size): New function.
2020-12-11 14:30:44 +01:00
Lars Ingebrigtsen
85acde2ab5 Make uncache_image slightly more efficient
* src/image.c (uncache_image): Extremely minor speed-up: Only
compute the hash once.
2020-12-09 01:10:04 +01:00
Lars Ingebrigtsen
ac341cd629 Restore Emacs 27 image cache semantics
* src/image.c (equal_lists): Remove.
(search_image_cache): Use Fequal instead of equal_lists.
Benchmarking shows no measurable time difference, and this
restores the cache semantics from Emacs 27 (where file names
didn't have to be EQ for the cache to be used).
2020-12-09 00:42:11 +01:00
Eli Zaretskii
88adf1f0dd Fix compilation on MS-Windows with librsvg > 2.46.0
* src/image.c (rsvg_handle_get_dimensions, init_svg_functions):
Make 'rsvg_handle_get_dimensions' available and defined for all
versions of librsvg.  (Bug#44655)
2020-11-20 17:00:36 +02:00
Alan Third
ca8e37eaf6 Fix SVG display again (bug#44655)
* src/image.c (svg_load_image): Fall back to
rsvg_handle_get_dimensions if we can't calculate the size of the
image.
2020-11-18 23:07:57 +00:00
Eli Zaretskii
f1eca59dfa Fix a recent change in image.c for MS-Windows
* src/image.c: Fix DEF_DLL_FN of
rsvg_handle_get_intrinsic_dimensions.  Reported by Andy Moreton
<andrewjmoreton@gmail.com>.
2020-11-10 17:06:46 +02:00
Alan Third
5293795806 Fix css length calculations
* src/image.c (svg_css_length_to_pixels): Put in missing breaks where
necessary.
2020-11-09 16:23:24 +00:00
Eli Zaretskii
3de31e7b71 Fix compilation of image.c on MS-Windows
This is a followup to last change in image.c.
* src/image.c (rsvg_handle_get_intrinsic_dimensions): Define to
call fn_rsvg_handle_get_intrinsic_dimensions.
(svg_css_length_to_pixels): Compile only for librsvg >= 2.46.0, as
RsvgLength type was not defined before.
2020-11-09 17:35:52 +02:00
Alan Third
4469e0de01 Calculate SVG image sizes more accurately (bug#44206)
* src/image.c (svg_css_length_to_pixels): New function.
(svg_load_image): Try more methods to work out the image size.
2020-11-09 14:49:51 +00:00
Lars Ingebrigtsen
9405cd84a6 Fix a segfault in the new svg code
* src/image.c (svg_load_image): Don't pass in a NULL for the
logical rect, because that will sometimes segfault.
2020-11-01 00:10:30 +01:00