aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix English grammar in some doc strings and commentsStephen Gildea2019-11-031-2/+2
| | | | | | (files.el subr.el): Fix some grammar errors in doc strings and comments. (frame.c fringe.c image.c xfns.c xterm.c): Fix some English grammar errors in doc strings.
* lisp/*.el, src/*.c: Doc fixes related to returning t vs non-nilJuanma Barranquero2019-10-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/flymake-proc.el (flymake-proc--find-buffer-for-file): Doc fix; return value is a buffer, not t. * lisp/progmodes/ebrowse.el (ebrowse-member-display-p): Doc fix; return value is the MEMBER argument, not nil. * lisp/files.el (hack-one-local-variable-eval-safep): * lisp/play/doctor.el (doctor-nounp, doctor-pronounp): * lisp/progmodes/flymake-proc.el (flymake-proc--check-include): * lisp/progmodes/js.el (js--broken-arrow-terminates-line-p): Doc fix; a non-nil return value is not always t. * lisp/image.el (image-type-available-p): * lisp/simple.el (region-active-p): * lisp/window.el (frame-root-window-p): * src/buffer.c (Fbuffer_live_p): * src/image.c (Finit_image_library): * src/window.c (Fwindow_minibuffer_p): Doc fix; a non-nil return value is always t. * doc/lispref/minibuf.texi (Minibuffer Windows): Doc fix.
* Make ImageMagick multi-image size calculations work for .ico filesLars Ingebrigtsen2019-09-241-5/+21
| | | | | * src/image.c (imagemagick_load_image): Compute image sizes correctly in multi-image .ico files and the like (bug#18333).
* Allow a :stride argument so XBM boolvecs are in the right format.Pip Cet2019-09-241-6/+15
| | | | | | | | * src/image.c (xbm_image_p): Explicitly specify the right stride if a bool vector is used as argument. * doc/lispref/display.texi (XBM Images): Describe bool vectors accurately. * etc/NEWS: Document the change (bug#36337).
* Update some URLsPaul Eggert2019-09-231-2/+2
| | | | | | | | | | | | | | | | | This mostly changes http: to https: in URLs. It also updates some URLs that have moved, removes some URLs that no longer work, recommends against using procmail (procmail.org no longer works), and removes some mentions of the no-longer-existing Gmane, LPF and VTW. It doesn't update all URLs, just the ones I had time for. * GNUmakefile (help): * admin/admin.el (manual-doctype-string): * admin/charsets/Makefile.in (${charsetdir}/ALTERNATIVNYJ.map): * admin/charsets/mapconv: * lisp/net/soap-client.el (soap-create-envelope): * lisp/org/org.el (org-doi-server-url): * lisp/textmodes/bibtex.el (bibtex-generate-url-list): Prefer https: to http: un URLs.
* Mention image caching in the `image-size' doc stringLars Ingebrigtsen2019-09-211-1/+6
| | | | | * src/image.c (Fimage_size): Mention that this function caches images, and what to do about that (bug#33275).
* Fix bug with non-paletted transparent PNGsPaul Eggert2019-08-251-8/+9
| | | | | | Adapted from a fix by YAMAMOTO Mitsuharu (Bug#37153#77). * src/image.c (png_load_body): Fix bug with non-paletted transparent images.
* Fix misdisplay of PNG paletted imagesPaul Eggert2019-08-251-9/+25
| | | | | | | | | | | Problem reported by Roland Winkler (Bug#37153). Derived from a patch suggested by YAMAMOTO Mitsuharu (Bug#37153#62). * src/image.c (png_get_valid) [WINDOWSNT]: Do not dynamically link this function. (png_get_tRNS) [WINDOWSNT && PNG_tRNS_SUPPORTED]: Dynamically link this function instead. (png_load_body): Do not assume that every paletted image supplies only transparency data. Fix typo in use of transparent_p.
* Remove INT_ADD_WRAPV bug workaroundsPaul Eggert2019-08-141-5/+3
| | | | | | | | | * src/alloc.c (free_cons): * src/casefiddle.c (do_casify_multibyte_string): * src/editfns.c (styled_format): * src/image.c (png_load_body): Remove recent workarounds for INT_ADD_WRAPV bugs since the bugs have been fixed (Bug#37006).
* ; Add commentary to recent changesEli Zaretskii2019-08-121-1/+3
| | | | | | | | * src/image.c (png_load_body): * src/editfns.c (styled_format): * src/casefiddle.c (do_casify_multibyte_string): * src/alloc.c (free_cons): Comment why we use a signed temporary integer variable. (Bug#37006)
* Prefer signed when testing for signed overflowPaul Eggert2019-08-111-2/+2
| | | | | | | | | | * src/alloc.c (free_cons): * src/casefiddle.c (do_casify_multibyte_string): * src/editfns.c (styled_format): * src/image.c (png_load_body): Use signed arguments to INT_MULTIPLY_WRAPV etc. This doesn’t fix any bugs, but GCC emits better code when all args are signed. Also, this removes the need for an if in free_cons (Bug#37006).
* Fix minor compilation problems on MS-WindowsEli Zaretskii2019-08-061-6/+6
| | | | | | | * src/w32fns.c (Fdefault_printer_name): Fix size of local buffer. * src/image.c [WINDOWSNT]: Test __MINGW_MAJOR_VERSION as well to shut up compiler warnings.
* Don't crash when parsing bad SVG dataPaul Eggert2019-07-251-2/+6
| | | | | Derived from a patch by Pip Cet (Bug#36773#47). * src/image.c (svg_load_image): Work around librsvg 2.40.13 bug.
* Simplify hashfn/cmpfn calling conventionPaul Eggert2019-07-201-2/+1
| | | | | | | | | | | | | | | | * src/fns.c (cmpfn_eql, cmpfn_equal, cmpfn_user_defined) (hashfn_eq, hashfn_equal, hashfn_eql, hashfn_user_defined): * src/profiler.c (cmpfn_profiler, hashfn_profiler): Use new calling convention where the return value is a fixnum instead of EMACS_UINT. While we’re at it, put the hash table at the end, since that’s a bit simpler and generates better code (at least on the x86-64). All callers changed. * src/fns.c (hash_lookup): Store fixnum rather than EMACS_UINT. All callers changed. (hash_put): Take a fixnum rather than an EMACS_UINT. All callers changed. Remove unnecessary eassert (XUFIXNUM does it). * src/lisp.h (struct hash_table_test): Adjust signatures of cmpfn and hashfn.
* Resurrect SVG support on MS-WindowsEli Zaretskii2019-07-111-3/+10
| | | | | | | | | | * src/image.c (syms_of_image) <Qgio> [HAVE_NTGUI]: New DEFSYM. (init_svg_functions) [LIBRSVG_CHECK_VERSION >= 2.32.0]: Load g_file_new_for_path and g_memory_input_stream_new_from_data from libgio, not from libglib. (Bug#35548) * lisp/term/w32-win.el (dynamic-library-alist): Add the libgio DLL.
* Avoid functions deprecated in librsvg 2.45.1Paul Eggert2019-07-101-28/+54
| | | | | | | | | | | * src/image.c (init_svg_functions) [WINDOWSNT]: Load the pre-2.32 or 2.32 functions, depending on LIBRSVG_CHECK_VERSION. (svg_load_image): In librsvg 2.32 or later, use g_memory_input_stream_new_from_data, g_file_new_for_path and rsvg_handle_new_from_stream_sync rather than the deprecated-in-2.45 rsvg_handle_write and rsvg_handle_close. From a patch by YAMAMOTO Mitsuharu (Bug#35548#11).
* Use fewer locks when accessing stdioPaul Eggert2019-07-081-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c, src/bidi.c, src/emacs-module.c, src/pdumper.c: * src/regex-emacs.c, src/unexhp9k800.c, src/unexmacosx.c: * src/widget.c, src/xdisp.c, src/xselect.c, src/xterm.c: Include sysstdio.h instead of stdio.h, to avoid locking stdio streams in many cases. * src/alloc.c (test_setjmp): * src/bidi.c (bidi_dump_cached_states): * src/cm.c (calccost): * src/dispnew.c (init_display_interactive): * src/emacs.c (main): * src/image.c (convert_mono_to_color_image): * src/minibuf.c (read_minibuf_noninteractive): * src/nsfont.m (ns_descriptor_to_entity) (ns_dump_glyphstring): * src/nsterm.h (NSTRACE_MSG_NO_DASHES): * src/nsterm.m (ns_mouse_position) (sendEvent:, keyDown:, performDragOperation:): * src/pdumper.c (dump_fingerprint, print_paths_to_root_1): * src/print.c (debug_print): * src/regex-emacs.c (debug_putchar, print_fastmap) (print_partial_compiled_pattern, print_compiled_pattern) (print_double_string, regex_compile): * src/term.c (vfatal): * src/unexhp9k800.c (read_header): * src/unexmacosx.c (unexec_error): * src/widget.c (EmacsFrameInitialize): * src/xdisp.c (message_to_stderr, vmessage, dump_glyph_row) (Fdump_glyph_matrix, Fdump_frame_glyph_matrix, dump_glyph_string): * src/xfaces.c (Fdump_colors, Fdump_face): * src/xselect.c (x_clipboard_manager_error_2): * src/xterm.c (x_initialize): * src/xwidget.c (WEBKIT_FN_INIT): Prefer unlocked calls like fputs to locked calls like fprintf. * src/charset.c (read_hex): * src/cm.c (cmputc, cmcheckmagic): * src/dispnew.c (update_frame, update_frame_with_menu) (update_frame_1, Fsend_string_to_terminal, Fding) (bitch_at_user): * src/emacs.c (main, Fdump_emacs): * src/emacs-module.c (module_abort): * src/fileio.c (Fdo_auto_save): * src/image.c (slurp_file) (png_read_from_file, png_load_body, our_stdio_fill_input_buffer): * src/keyboard.c (record_char, kbd_buffer_get_event) (handle_interrupt): * src/lread.c (readbyte_from_stdio, read1): * src/minibuf.c (read_minibuf_noninteractive): * src/print.c (printchar_to_stream, strout) (Fredirect_debugging_output): * src/sysdep.c (reset_sys_modes, close_output_streams) (procfs_ttyname, procfs_get_total_memory): * src/term.c (tty_ring_bell, tty_send_additional_strings) (tty_set_terminal_modes, tty_reset_terminal_modes) (tty_update_end, tty_clear_end_of_line, tty_write_glyphs) (tty_write_glyphs_with_face, tty_insert_glyphs) (tty_menu_activate): * src/xfaces.c (Fx_load_color_file): Simplify by using ordinary calls like putc to explicitly-unlocked calls like putc_unlocked, since the ordinary calls are now unlocked anyway. * src/emacs.c (main, Fdump_emacs): * src/pdumper.c (Fdump_emacs_portable): Coalesce adjacent printfs. * src/nsterm.h: Include sysstdio.h as this file’s macros rely on it. * src/regex-emacs.c (print_compiled_pattern): Omit redundant fflush. * src/sysstdio.h: Include unlocked-io.h. (clearerr_unlocked, feof_unlocked, ferror_unlocked) (fflush_unlocked, fgets_unlocked, fputc_unlocked) (fputs_unlocked, fread_unlocked, fwrite_unlocked) (getc_unlocked, getchar_unlocked, putc_unlocked) (putchar_unlocked): Remove these macros; now done by unlocked-io.h. * src/xwidget.c: Include sysstdio.h.
* Remove printmax_t etc.Paul Eggert2019-07-071-4/+6
| | | | | | | | | | | | printmax_t etc. were needed only for platforms that lacked support for printing intmax_t. These platforms are now so obsolete that they are no longer practical porting targets. * src/image.c (gs_load): Fix unlikely buffer overrun discovered while making these changes. It was introduced in 2011-07-17T00:34:43!eggert@cs.ucla.edu. * src/lisp.h (printmax_t, uprintmax_t, pMd, pMu, pMx): Remove. All uses replaced by their standard counterparts intmax_t, uintmax_t, PRIdMAX, PRIuMAX, PRIxMAX.
* Fix rotation validity test in image.cEli Zaretskii2019-07-031-1/+4
| | | | | | * src/image.c (compute_image_rotation): Fix the validity test for :rotation values. This avoids logging error messages when no :rotation was provided in the image spec.
* Adjust return value of image-transforms-pEli Zaretskii2019-07-011-10/+6
| | | | | | | * src/image.c (Fimage_transforms_p): * doc/lispref/display.texi (Image Descriptors): image-transforms-p now returns at most (scale rotate90), even if ImageMagick is available.
* Remove divide_doublePaul Eggert2019-06-301-15/+9
| | | | | | * src/image.c (divide_double): Remove. All uses replaced with inline equivalents. Suggested by Eli Zaretskii in: https://lists.gnu.org/r/emacs-devel/2019-06/msg01067.html
* Fix use of undefined macroAndreas Schwab2019-06-301-3/+3
| | | | | | | * src/xdisp.c (append_space_for_newline): Use FRAME_FONT only inside HAVE_WINDOW_SYSTEM. (extend_face_to_end_of_line): Likewise. (syms_of_xdisp): Doc fix.
* Pacify gcc and other image rotation tweaksPaul Eggert2019-06-291-74/+79
| | | | | | | | | | | | * src/image.c: No need to include <float.h> as lisp.h does that. (matrix3x3_copy): Remove; no longer needed. (divide_double): New function, to avoid undefined behavior when dividing by zero on non-IEEE hosts. (image_set_transform): Simplify transformation computation by avoiding the need to copy a matrix. Pacify gcc 9 -Wdouble-promotion and -Wmaybe-uninitialized. Avoid unnecessary assignment of width and height. Improve error reporting for unsupported native image rotation.
* Support native image transforms on MS-WindowsEli Zaretskii2019-06-291-209/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset also rearranges native image transform code for other platforms to make it cleaner, and also removes the support for native cropping. For the discussions, see https://lists.gnu.org/archive/html/emacs-devel/2019-06/msg00242.html * src/w32term.c (w32_image_rotations_p, transform): New functions. (w32_draw_image_foreground): If image rotation is requested and supported, call PlgBlt to transform the image. (w32_initialize): Populate the PlgBlt function pointer if it is supported. * src/w32term.h (w32_image_rotations_p): Add prototype. * src/dispextern.h (struct image) [HAVE_NTGUI]: New member xform. * src/image.c (compute_image_rotation): Renamed from image_set_rotation. Only compute and returns the rotation angle; leave the matrix calculation for later. Log an error message if the :rotation parameter is not a number. (image_set_crop): Function deleted. We no longer support native cropping, as one can display an image slice instead. (image_set_transform): Compute the transform matrix in its entirety here, in two variants: one for XRender and Cairo, the other for NS and MS-Windows. call compute_image_size and compute_image_rotation internally. (lookup_image) [HAVE_NATIVE_TRANSFORMS]: Call only image_set_transform. No need to pass the transform matrix to image_set_transform. (Fimage_transforms_p): Return a list of transform capabilities rather than a simple boolean. Support TTY frames as well. * src/nsimage.m (setTransform:): Don't invert the matrix, as it is already inverted in image.c. * test/manual/image-transforms-tests.el (test-cropping): State in the text that only ImageMagick supports cropping. * doc/lispref/display.texi (Image Descriptors): Update the documentation of native image transforms. (ImageMagick Images): Move the description of ':crop' here. * etc/NEWS: Minor copyedits of the feature announcement.
* Omit a few minor unnecessary range checksPaul Eggert2019-06-271-6/+6
| | | | | | | | | | Based on Pip Cet’s review (Bug#36370#19). * src/fileio.c (Fdo_auto_save): * src/image.c (lookup_image): * src/textprop.c (Fnext_single_char_property_change): Prefer XFIXNUM to XFIXNAT for clarity and consistency with neighboring code, and to avoid unnecessary range checks. * src/image.c (lookup_image): Omit unnecessary range checks.
* Clean up use of XFIXNUM etc.Paul Eggert2019-06-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A few bits of the code were relying on the fact that XFIXNUM, XFIXNAT, and XUFIXNUM do something even with arguments that are not fixnums/fixnats. Separate these rare uses out into XFIXNUM_RAW and XUFIXNUM_RAW. Problem and original patch reported by Pip Cet (Bug#36370). * src/ccl.c (Fccl_execute_on_string): * src/fileio.c (Finsert_file_contents, a_write) (Fdo_auto_save): * src/process.c (conv_lisp_to_sockaddr): * src/textprop.c (Fnext_single_char_property_change) (Fprevious_single_char_property_change) (Fnext_property_change, Fnext_single_property_change) (Fprevious_property_change) (Fprevious_single_property_change): Don’t assume fixnums are nonnegative. * src/ccl.c (Fccl_execute_on_string): Fix range-checking bug if AREF (status, i) is out of int range. * src/data.c (arith_driver): Use XFIXNUM_RAW as we want efficient garbage if the value is not a fixnum. * src/dosfns.c (Fint86, Fdos_memput): Check that args are nonnegative. * src/image.c (lookup_image): Check that args are in range. * src/lisp.h (lisp_h_XHASH): Use XUFIXNUM_RAW, since this is for hashing. (lisp_h_XFIXNAT, XFIXNAT) [USE_LSB_TAG]: Remove macros. (lisp_h_XFIXNUM_RAW, XFIXNUM_RAW) [USE_LSB_TAG]: New macros, with the semantics of the old macros without _RAW. (XFIXNUM_RAW, XUFIXNUM_RAW): New inline functions, with the semantics of the old functions without _RAW. (FIXNUMP): Move definition up to avoid forward use. (XFIXNUM, XFIXNAT, XUFIXNUM): Use eassume to add a runtime check (when debugging) that the argument has the proper form. (XFIXNUM, XFIXNAT): Now inline functions only, since they refer to their arguments more than once now that they use eassume. * src/textprop.c (Fprevious_single_char_property_change): Avoid fixnum overflow with invalid input. (set_text_properties): Fix unlikely failure to validate arguments, by using EQ instead of XFIXNAT. * src/w32term.c (w32_draw_glyph_string): * src/xterm.c (x_draw_glyph_string): Treat negative minimums as 0 rather than as garbage patterns.
* Catch duplicate keywords in image specsPaul Eggert2019-06-271-23/+23
| | | | | | | | | * src/image.c (struct image_keyword.count): Now bool, not int, since it is either 0 or 1. (parse_image_spec, xpm_image_p): Use bool for boolean. (parse_image_spec): Fix a bug introduced in 2011-09-21T17:41:20!eggert@cs.ucla.edu that reported only triplicate (or more) keywords, not duplicates.
* ; * src/image.c: Minor copyedits of native transform commentary.Eli Zaretskii2019-06-231-5/+5
|
* * src/image.c (image_set_rotation): Do negation at compile-time.Paul Eggert2019-06-171-2/+2
|
* Avoid rounding error in image rotationYAMAMOTO Mitsuharu2019-06-171-3/+3
| | | | * src/image.c (image_set_rotation): Halve translations as double values.
* Revert "Simplify image transforms"Alan Third2019-06-161-98/+212
| | | | | | This reverts commit cf3081d208814ea02fce33aac645abfc24f880a6. ; Pushed in error.
* Simplify image transformsAlan Third2019-06-161-212/+98
| | | | | | | | | | | * src/image.c: (image_set_rotation, image_set_size, image_set_transform): Combine into image_set_transform. (image_set_crop): Remove function. (lookup_image): Remove calls to removed functions and remove transform_matrix. * test/manual/image-transforms-tests.el (test-cropping): Remove function. (test-transforms): Remove reference to test-cropping.
* Document image transformsAlan Third2019-06-161-0/+81
| | | | | | | * doc/lispref/display.texi (Image Descriptors): Document :crop and update :rotation. * src/image.c: Describe the image transform matrix layout. * test/manual/image-transforms-tests.el: New file.
* Implement native image rotation and cropping on cairoYAMAMOTO Mitsuharu2019-06-081-21/+53
| | | | | | | | | | | | | | | | | | | | | | | | * src/dispextern.h (struct image) [USE_CAIRO]: * src/image.c (free_image, image_clear_image_1) (image_set_crop, image_set_size, image_set_rotation) (image_create_x_image_and_pixmap) [USE_CAIRO]: #ifdef out HAVE_XRENDER part. * src/image.c (cr_create_surface_from_pix_containers) [USE_CAIRO]: Rename from cr_create_surface_from_pix_containers. Change arguments to pair of Emacs_Pix_Container:s. Move block_input and unblock_input to caller. (cr_put_image_to_cr_data) [USE_CAIRO]: New function. (prepare_image_for_display) [USE_CAIRO]: Use it. (image_set_transform) [USE_CAIRO]: Create dummy solid color pattern equipped with transformation matrix and set it to img->cr_data. * src/xterm.c (fringe_bmp) [USE_CAIRO]: Change type to cairo_pattern_t **. (x_cr_define_fringe_bitmap, x_cr_destroy_fringe_bitmap) [USE_CAIRO]: Create or destroy cairo pattern. (x_cr_draw_image) [USE_CAIRO]: Remove arguments image_width and image_height. Change type of image to cairo pattern. All callers changed. * src/gtkutil.c (xg_get_image_for_pixmap) [USE_CAIRO]: Get cairo surface from img->cr_data, which is of cairo pattern now.
* Fix image_set_crop yet againYAMAMOTO Mitsuharu2019-06-071-15/+3
| | | | | | | | * src/image.c (image_set_crop) [HAVE_NATIVE_TRANSFORMS]: Don't call compute_image_size, as it is already called from image_set_size. (image_set_size, image_set_crop) [HAVE_NATIVE_TRANSFORMS]: Use harmless matrix transformation code also for USE_CAIRO and HAVE_NTGUI cases, though image_set_transform is not yet implemented on them.
* Fix recently-introduced image_set_crop typoPaul Eggert2019-06-071-1/+1
| | | | | | * src/image.c (image_set_crop) [!HAVE_NATIVE_TRANSFORMS]: Don’t call compute_image_size, as it does not exist and its result is not needed.
* Fix overflow issues in image rotationPaul Eggert2019-06-061-74/+75
| | | | | | | | | | | | | Also, do some refactoring to simplify code. * src/dispextern.h (INIT_MATRIX, COPY_MATRIX, MULT_MATRICES): Remove. * src/image.c (matrix3x3): New type, replacing all uses of 3x3 double. (matrix3x3_copy, matrix3x3_mult): New functions, replacing COPY_MATRIX, MULT_MATRICES. Replace INIT_MATRIX by C initializers. (image_set_rotation): Use Fmod to avoid undefined behavior on double-to-int conversion and to reduce bignum rotations correctly. (image_set_crop): Finish up previous correction, by not re-setting width and height if compute_image_size has set them. Prefer shifting right by 1 to dividing by 2 if either will do.
* Restore height and with from that were accidentally removedMark A. Hershberger2019-06-061-1/+3
| | | | | See 610fb73ab6d7a22b722f523d6ebc4aa8fa1db7c9 USE_CARIO needs these.
* Add native image rotation and croppingAlan Third2019-06-051-26/+257
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/image.el (image--get-imagemagick-and-warn): Only fallback to ImageMagick if native transforms aren't available. * src/dispextern.h (INIT_MATRIX, COPY_MATRIX, MULT_MATRICES): New macros for matrix manipulation. (HAVE_NATIVE_SCALING, HAVE_NATIVE_TRANSFORMS): Rename and change all relevant locations. * src/image.c (x_set_image_rotation): (x_set_transform): New functions. (x_set_image_size): Use transform matrix for resizing under X and NS. (x_set_image_crop): New function. (lookup_image): Use the new transform functions. (Fimage_scaling_p, Fimage_transforms_p): Rename and update all callers. * src/nsimage.m (ns_load_image): Remove rotation code. (ns_image_set_transform): New function. ([EmacsImage dealloc]): Release the saved transform. ([EmacsImage rotate:]): Remove unneeded method. ([EmacsImage setTransform:]): New method. * src/nsterm.h (EmacsImage): Add transform property and update method definitions. * src/nsterm.m (ns_dumpglyphs_image): Use the transform to draw the image correctly. * src/xterm.c (x_composite_image): Use PictOpSrc as we don't care about alpha values here. * doc/lispref/display.texi (Image Descriptors): Add :rotation. (ImageMagick Images): Remove :rotation.
* * src/image.c (cr_create_cr_surface_from_image): Add const to variable `key'.YAMAMOTO Mitsuharu2019-06-041-1/+1
|
* Add stipple support on cairoYAMAMOTO Mitsuharu2019-05-301-0/+48
| | | | | | | | | | | | | | | * src/xterm.h (struct x_bitmap_record) [USE_CAIRO]: Remove unused member img. Add member stipple. (x_bitmap_stipple) [USE_CAIRO]: Add extern. * src/image.c (x_bitmap_stipple) [HAVE_X_WINDOWS && USE_CAIRO]: New function. (image_create_bitmap_from_data, image_create_bitmap_from_file) (x_create_bitmap_from_xpm_data) [HAVE_X_WINDOWS && USE_CAIRO]: Initialize stipple member of struct x_bitmap_record. (free_bitmap_record) [HAVE_X_WINDOWS && USE_CAIRO]: Destroy stipple member. * src/xterm.c (x_fill_rectangle) [USE_CAIRO]: Inspect gc and draw stipple if necessary. Use x_bitmap_stipple.
* Fix breakage of native image scaling on XRENDER by previous changeYAMAMOTO Mitsuharu2019-05-301-0/+2
| | | | | * src/image.c (image_create_x_image_and_pixmap_1) [HAVE_XRENDER]: Get depth if it is unspecified.
* Rework cairo image support to improve consistency (Bug#35871)YAMAMOTO Mitsuharu2019-05-291-503/+454
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/dispextern.h (Emacs_Pix_Container) [USE_CAIRO]: New struct. Also used as aliases of Emacs_Pixmap and Emacs_Pix_Context. (x_kill_gs_process) [USE_CAIRO]: #ifdef out extern. (RGB_PIXEL_COLOR) [USE_CAIRO]: Define as unsigned long. * src/image.c: Include stdint.h. On cairo, remove existing image support code, use non-X11-specific code for XBM/XPM, and remove POSTSCRIPT support. (PUT_PIXEL): New macro. Use it instead of XPutPixel when not specific to X11. (GET_PIXEL, NO_PIXMAP, PIX_MASK_RETAIN, PIX_MASK_DRAW) (RGB_TO_ULONG, ARGB_TO_ULONG, RED_FROM_ULONG) (GREEN_FROM_ULONG, BLUE_FROM_ULONG, RED16_FROM_ULONG) (GREEN16_FROM_ULONG, BLUE16_FROM_ULONG) [USE_CAIRO]: New macros. (image_create_pix_container, image_pix_container_put_pixel) (image_pix_context_get_pixel, image_pix_container_create_from_bitmap_data) (cr_create_cr_surface_from_image) [USE_CAIRO]: New functions. (image_create_x_image_and_pixmap_1, image_destroy_x_image) (image_check_image_size): Extract X11-specific code from here ... (x_create_x_image_and_pixmap, x_destroy_x_image) (x_check_image_size) [HAVE_X_WINDOWS]: ... to here. (x_create_bitmap_mask) [HAVE_X_WINDOWS]: Use them. Inline specialized version of four_corners_best. (prepare_image_for_display, image_clear_image_1, image_destroy_x_image) (gui_put_x_image, image_put_x_image, image_get_x_image, image_unget_x_image) (Create_Pixmap_From_Bitmap_Data, lookup_rgb_color) (image_to_emacs_colors) [USE_CAIRO]: Add cairo support. (image_background, png_load_body) [USE_CAIRO]: Use image_alloc_image_color for img->background. (image_sync_to_pixmaps) [USE_CAIRO]: #ifdef out function. (Create_Pixmap_From_Bitmap_Data) [HAVE_X_WINDOWS]: Move image_check_image_size call from here ... (xbm_load_image): ... to here. (xpm_load_image): (image_build_heuristic_mask, pbm_load, gif_load) [USE_CAIRO]: Use lookup_rgb_color for argument of PUT_PIXEL. (image_pixmap_draw_cross) [HAVE_X_WINDOWS || USE_CAIRO]: New function. (image_disable_image) [HAVE_X_WINDOWS || USE_CAIRO]: Use it. (CrossForeground) [!HAVE_NTGUI && !HAVE_NS]: New macro. (image_disable_image) [!HAVE_NTGUI && !HAVE_NS]: Use it. * src/xterm.c (handle_one_xevent) <ClientMessage> [USE_CAIRO]: #ifdef out x_kill_gs_process call. (x_free_pixmap) [USE_CAIRO]: Free Emacs_Pix_Container and data it contains.
* Undo use of Emacs_Pixmap over Pixmap for x_kill_gs_processYAMAMOTO Mitsuharu2019-05-241-1/+1
| | | | | | * src/dispextern.h (x_kill_gs_process): * src/image.c (x_kill_gs_process): Undo use of Emacs_Pixmap over Pixmap. * src/dispextern.h (x_kill_gs_process): Move extern inside HAVE_X_WINDOWS.
* Pacify libpng on interlaced images (Bug#35843)Paul Eggert2019-05-211-1/+5
| | | | | | | * src/image.c (png_set_interlace_handling) [WINDOWSNT]: New function to link. (init_png_functions): Link it. (png_load_body): Call it before calling png_read_update_info.
* Introduce Emacs_Pix_Container and Emacs_Pix_Context typedefsAlexander Gramiak2019-05-191-124/+129
| | | | | | | | | | | | | | | | | | | | Emacs_Pix_Container is a pointer to a struct representing pixmap data on the backend. Emacs_Pix_Context is the context for the bitmap/pixmap on the backend. Only w32 currently makes this distinction; they are otherwise the same type. * src/dispextern.h: Remove XImagePtr in favor of using XImage* directly. Rename XImagePtr_or_DC to Emacs_Pix_Context. [HAVE_X_WINDOWS] Alias Emacs_Pix_Container and Emacs_Pix_Context to XImage*. [HAVE_NS] Alias Emacs_Pix_Container and Emacs_Pix_Context to trivial Emacs_Pixmap definition. [HAVE_NTGUI]: Alias Emacs_Pix_Container to XImage* and Emacs_Pix_Context to HDC. * src/dispextern.h: * src/image.c: Use Emacs_Pix_Container over XImagePtr and Emacs_Pix_Context over XImagePtr_or_DC.
* Introduce Emacs_Pixmap typedefAlexander Gramiak2019-05-191-9/+11
| | | | | | | | | | | | | | | | | * src/dispextern.h [HAVE_X_WINDOWS]: Alias Emacs_Pixmap to Pixmap. (image, x_kill_gs_process): Use Emacs_Pixmap over Pixmap. * src/image.c: * src/nsgui.h: * src/nsterm.m: * src/termhooks.h: * src/w32gui.h: * src/w32term.c: * src/w32term.h: * src/xterm.c (x_free_pixmap): Use Emacs_Pixmap over Pixmap. * src/w32gui.h: Remove unused typedef Bitmap.
* Introduce Emacs_Color struct and typedefAlexander Gramiak2019-05-191-33/+33
| | | | | | | | | | | | | | | | | | | | | | This avoids clashing with the XColor struct from X. * src/dispextern [HAVE_X_WINDOWS]: Define Emacs_Color alias. [!HAVE_X_WINDOWS]: Rename XColor compatibility struct to Emacs_Color. Remove unused fields. * src/gtkutil.c: * src/gtkutil.h: * src/image.c: * src/nsterm.h: * src/nsterm.m: * src/termhooks.h: * src/w32fns.c: * src/w32term.c: * src/w32term.h: * src/xfaces.c: * src/xfns.c: * src/xterm.h: Use Emacs_Color over XColor outside of X-specific sections.
* Fix display of images on MS-Windows broken by a recent commitEli Zaretskii2019-05-181-6/+6
| | | | | | * src/image.c (initialize_image_type): Test if the type is in Vlibrary_cache up front, and return true without calling the 'init' method if the type was already initialized.
* Clean up and simplify image-type setupPaul Eggert2019-05-171-361/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | This also fixes an unlikely hang involving a circular image description. * src/dispextern.h (struct image.type): Now pointer-to-const. * src/image.c (struct image_type.init) [!WINDOWSNT]: Omit. (IMAGE_TYPE_INIT): New macro. (image_types): Now a small array-of-const, not a pointer. (CACHE_IMAGE_TYPE): Remove; the code’s simpler without it. (ADD_IMAGE_TYPE): Remove this macro, replacing with ... (add_image_type): ... this equivalent function. All uses changed. (define_image_type): Remove. All uses removed. (valid_image_p): Use FOR_EACH_TAIL_SAFE to avoid Emacs hanging if the user creates a circular description of an image. (xbm_type, xpm_type, pbm_type, png_type, jpeg_type, tiff_type) (gif_type, imagemagick_type, svg_type, gs_type): Remove; now done by image_types. (init_imagemagick_functions): Remove decl of nonexistent function. (gs_clear_image): Remove; all uses replaced by image_clear_image. (initialize_image_type): New function, which captures a lot of the previously-scattered WINDOWSNT ifdefs. (lookup_image_type): Use it. (reset_image_types): Remove. All uses removed. (syms_of_image): Don’t worry about ignoring image_types for pdumper, since it’s a constant now.