1. 10 Jul, 2019 1 commit
    • Paul Eggert's avatar
      Avoid functions deprecated in librsvg 2.45.1 · 40cd6278
      Paul Eggert authored
      * 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).
      40cd6278
  2. 09 Jul, 2019 1 commit
    • Paul Eggert's avatar
      Use fewer locks when accessing stdio · f8ab9083
      Paul Eggert authored
      * 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.
      f8ab9083
  3. 07 Jul, 2019 1 commit
    • Paul Eggert's avatar
      Remove printmax_t etc. · 8f522efe
      Paul Eggert authored
      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.
      8f522efe
  4. 03 Jul, 2019 1 commit
    • Eli Zaretskii's avatar
      Fix rotation validity test in image.c · ecd7d40a
      Eli Zaretskii authored
      * 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.
      ecd7d40a
  5. 01 Jul, 2019 1 commit
    • Eli Zaretskii's avatar
      Adjust return value of image-transforms-p · 6b7136a8
      Eli Zaretskii authored
      * 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.
      6b7136a8
  6. 30 Jun, 2019 2 commits
  7. 29 Jun, 2019 2 commits
    • Paul Eggert's avatar
      Pacify gcc and other image rotation tweaks · f5b2fd5e
      Paul Eggert authored
      * 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.
      f5b2fd5e
    • Eli Zaretskii's avatar
      Support native image transforms on MS-Windows · 74a5a332
      Eli Zaretskii authored
      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.
      74a5a332
  8. 27 Jun, 2019 3 commits
    • Paul Eggert's avatar
      Omit a few minor unnecessary range checks · 06d2eb33
      Paul Eggert authored
      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.
      06d2eb33
    • Paul Eggert's avatar
      Clean up use of XFIXNUM etc. · 4893a09c
      Paul Eggert authored
      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.
      4893a09c
    • Paul Eggert's avatar
      Catch duplicate keywords in image specs · 3502d4c1
      Paul Eggert authored
      * 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.
      3502d4c1
  9. 23 Jun, 2019 1 commit
  10. 17 Jun, 2019 2 commits
  11. 16 Jun, 2019 3 commits
    • Alan Third's avatar
      Revert "Simplify image transforms" · beb572a7
      Alan Third authored
      This reverts commit cf3081d2.
      
      ; Pushed in error.
      beb572a7
    • Alan Third's avatar
      Simplify image transforms · cf3081d2
      Alan Third authored
      * 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.
      cf3081d2
    • Alan Third's avatar
      Document image transforms · 11b0e334
      Alan Third authored
      * 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.
      11b0e334
  12. 08 Jun, 2019 1 commit
    • YAMAMOTO Mitsuharu's avatar
      Implement native image rotation and cropping on cairo · 88c49ac3
      YAMAMOTO Mitsuharu authored
      * 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.
      88c49ac3
  13. 07 Jun, 2019 2 commits
    • YAMAMOTO Mitsuharu's avatar
      Fix image_set_crop yet again · 3a1f92d0
      YAMAMOTO Mitsuharu authored
      * 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.
      3a1f92d0
    • Paul Eggert's avatar
      Fix recently-introduced image_set_crop typo · cfb592fd
      Paul Eggert authored
      * 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.
      cfb592fd
  14. 06 Jun, 2019 2 commits
    • Paul Eggert's avatar
      Fix overflow issues in image rotation · 7c26e0b1
      Paul Eggert authored
      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.
      7c26e0b1
    • Mark A. Hershberger's avatar
      Restore height and with from that were accidentally removed · c8123b45
      Mark A. Hershberger authored
      See 610fb73a
      USE_CARIO needs these.
      c8123b45
  15. 05 Jun, 2019 1 commit
    • Alan Third's avatar
      Add native image rotation and cropping · 610fb73a
      Alan Third authored
      * 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.
      610fb73a
  16. 04 Jun, 2019 1 commit
  17. 30 May, 2019 3 commits
    • Paul Eggert's avatar
      Pacify librsvg 2.45.1 and later · 7871c3dc
      Paul Eggert authored
      * src/image.c (svg_load_image): Pacify librsvg 2.45.1 and later,
      and add a FIXME comment about the deprecated librsvg functions.
      Backport from master.
      7871c3dc
    • YAMAMOTO Mitsuharu's avatar
      Add stipple support on cairo · cc71a82f
      YAMAMOTO Mitsuharu authored
      * 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.
      cc71a82f
    • YAMAMOTO Mitsuharu's avatar
      Fix breakage of native image scaling on XRENDER by previous change · 46a17616
      YAMAMOTO Mitsuharu authored
      * src/image.c (image_create_x_image_and_pixmap_1) [HAVE_XRENDER]: Get depth if
      it is unspecified.
      46a17616
  18. 29 May, 2019 1 commit
    • YAMAMOTO Mitsuharu's avatar
      Rework cairo image support to improve consistency (Bug#35871) · c89900eb
      YAMAMOTO Mitsuharu authored
      * 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.
      c89900eb
  19. 24 May, 2019 1 commit
  20. 21 May, 2019 1 commit
  21. 20 May, 2019 3 commits
    • Alexander Gramiak's avatar
      Introduce Emacs_Pix_Container and Emacs_Pix_Context typedefs · b2b1ccb8
      Alexander Gramiak authored
      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.
      b2b1ccb8
    • Alexander Gramiak's avatar
      Introduce Emacs_Pixmap typedef · 44d57792
      Alexander Gramiak authored
      * 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.
      44d57792
    • Alexander Gramiak's avatar
      Introduce Emacs_Color struct and typedef · c0e146e4
      Alexander Gramiak authored
      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.
      c0e146e4
  22. 18 May, 2019 2 commits
    • Eli Zaretskii's avatar
      Fix display of images on MS-Windows broken by a recent commit · 721c520f
      Eli Zaretskii authored
      * 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.
      721c520f
    • Paul Eggert's avatar
      Clean up and simplify image-type setup · 41bf8653
      Paul Eggert authored
      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.
      41bf8653
  23. 10 May, 2019 1 commit
    • Alexander Gramiak's avatar
      Convert Free_Pixmap macro into terminal hook · 616ce44a
      Alexander Gramiak authored
      * src/termhooks.h (terminal) [HAVE_WINDOW_SYSTEM]: New terminal hook
      free_pixmap.
      
      * src/image.c: Replace Free_Pixmap with free_pixmap.
      
      * src/msdos.h (FRAME_X_DISPLAY):
      * src/nsgui.h (Display):
      * src/nsterm.h (FRAME_NS_DISPLAY, FRAME_X_DISPLAY, FRAME_X_SCREEN)
      (FRAME_X_VISUAL):
      * src/w32term.h (FRAME_X_DISPLAY): Remove unused X-compatibility
      macros and typedefs.
      
      * src/nsterm.m:
      * src/w32term.c:
      * src/xterm.c: Implement and set free_pixmap hook.
      616ce44a
  24. 08 May, 2019 2 commits
  25. 03 May, 2019 1 commit
    • Paul Eggert's avatar
      Pacify librsvg 2.45.1 and later · da3897ab
      Paul Eggert authored
      * src/image.c (svg_load_image): Pacify librsvg 2.45.1 and later,
      and add a FIXME comment about the deprecated librsvg functions.
      da3897ab