rmagick 4.3.0 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rmagick might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +0 -1
- data/CHANGELOG.md +20 -0
- data/README.md +5 -14
- data/before_install_osx.sh +2 -1
- data/ext/RMagick/extconf.rb +72 -36
- data/ext/RMagick/rmagick.h +24 -18
- data/ext/RMagick/rmagick_gvl.h +224 -0
- data/ext/RMagick/rmdraw.c +107 -128
- data/ext/RMagick/rmenum.c +34 -15
- data/ext/RMagick/rmfill.c +77 -16
- data/ext/RMagick/rmilist.c +158 -70
- data/ext/RMagick/rmimage.c +1073 -596
- data/ext/RMagick/rminfo.c +108 -124
- data/ext/RMagick/rmkinfo.c +43 -13
- data/ext/RMagick/rmmain.c +7 -9
- data/ext/RMagick/rmmontage.c +41 -20
- data/ext/RMagick/rmpixel.c +64 -40
- data/ext/RMagick/rmutil.c +10 -89
- data/lib/rmagick/version.rb +3 -1
- data/lib/rmagick.rb +2 -0
- data/lib/rmagick_internal.rb +8 -48
- data/rmagick.gemspec +3 -1
- metadata +17 -4
- data/deprecated/RMagick.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b776ce3e793e02f14844cce0300aaef504783bdb1c190247cdc00b20e1fbc041
|
4
|
+
data.tar.gz: 312ff6d1311a59ac2f90b3cf44742698fcacadc39c2d39ec4c5bfedc7ece3103
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f826ecaf2f6cc471285dab84981d8513c79a18381d08c5e8e0f09a023da3eedce5cf223f495c3aa73efbc82828fd2b915c5b401548e041d8440b204288045d1
|
7
|
+
data.tar.gz: 5758a2256f5cad91968046be67d220dce46de3d9644f925275e2b33fcb37b486a44d5ec06bef0e2644d0108798398798b05cb605b7514af004536cd02edba635
|
data/.rubocop_todo.yml
CHANGED
@@ -182,7 +182,6 @@ Naming/ConstantName:
|
|
182
182
|
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
183
183
|
Naming/FileName:
|
184
184
|
Exclude:
|
185
|
-
- 'deprecated/RMagick.rb'
|
186
185
|
- 'doc/ex/InitialCoords.rb'
|
187
186
|
- 'doc/ex/NewCoordSys.rb'
|
188
187
|
- 'doc/ex/OrigCoordSys.rb'
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,26 @@
|
|
3
3
|
All notable changes to this project are documented in this file.
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## RMagick 5.1.0
|
7
|
+
|
8
|
+
Improvements
|
9
|
+
- Improve multi-thread performance by releasing GVL (#1352)
|
10
|
+
- Add Ractor support (#1349)
|
11
|
+
- Avoid overriding compilation variables (#1365)
|
12
|
+
- Remove pkg-config command dependency (#1366)
|
13
|
+
|
14
|
+
## RMagick 5.0.0
|
15
|
+
|
16
|
+
Improvements
|
17
|
+
|
18
|
+
- Improve installer in order to avoid SEGV within pkg-config command (#1359)
|
19
|
+
- Clean up the documents and comment in source code referring to something that no longer exist (#1363)
|
20
|
+
- Remove deprecated 'tile' attribute in Draw#marshal_dump (#1364)
|
21
|
+
- Remove deprecated #instance_eval calling when block was given with Magick::ImageList#montage, Magick::Image::Info.new and more (#1362)
|
22
|
+
- Remove deprecated RMagick.rb file (#1361)
|
23
|
+
- Remove deprecated Magick.trace_proc= (#1351)
|
24
|
+
- Remove deprecated Magick::{Image, Image::Info}#monitor= (#1356)
|
25
|
+
|
6
26
|
## RMagick 4.3.0
|
7
27
|
|
8
28
|
Deprecates
|
data/README.md
CHANGED
@@ -71,33 +71,33 @@ sudo yum install gcc ImageMagick-devel make which
|
|
71
71
|
On Arch Linux, you can run:
|
72
72
|
|
73
73
|
```sh
|
74
|
-
pacman -Syy
|
74
|
+
pacman -Syy imagemagick
|
75
75
|
```
|
76
76
|
|
77
77
|
#### Alpine Linux
|
78
78
|
On Alpine Linux, you can run:
|
79
79
|
|
80
80
|
```
|
81
|
-
apk add
|
81
|
+
apk add imagemagick imagemagick-dev imagemagick-libs
|
82
82
|
```
|
83
83
|
|
84
84
|
or you can run if you would like to use ImageMagick 6:
|
85
85
|
|
86
86
|
```
|
87
|
-
apk add
|
87
|
+
apk add imagemagick6 imagemagick6-dev imagemagick6-libs
|
88
88
|
```
|
89
89
|
|
90
90
|
### macOS
|
91
91
|
On macOS, you can run:
|
92
92
|
|
93
93
|
```sh
|
94
|
-
brew install
|
94
|
+
brew install imagemagick
|
95
95
|
```
|
96
96
|
|
97
97
|
or you can run if you would like to use ImageMagick 6:
|
98
98
|
|
99
99
|
```sh
|
100
|
-
brew install
|
100
|
+
brew install imagemagick@6
|
101
101
|
```
|
102
102
|
|
103
103
|
### Windows
|
@@ -164,15 +164,6 @@ subdirectory of the installation directory for any error messages. These
|
|
164
164
|
messages typically contain enough additional information for you to be able to
|
165
165
|
diagnose the problem. Also see [this FAQ][libmagick-faq].
|
166
166
|
|
167
|
-
On OS X with Homebrew, try (re)installing pkg-config:
|
168
|
-
|
169
|
-
```sh
|
170
|
-
brew uninstall pkg-config
|
171
|
-
brew install pkg-config
|
172
|
-
brew unlink pkg-config
|
173
|
-
brew link pkg-config
|
174
|
-
```
|
175
|
-
|
176
167
|
### Cannot open shared object file
|
177
168
|
|
178
169
|
If you get a message like this:
|
data/before_install_osx.sh
CHANGED
@@ -16,7 +16,8 @@ if [ ! -v IMAGEMAGICK_VERSION ]; then
|
|
16
16
|
fi
|
17
17
|
|
18
18
|
export HOMEBREW_NO_AUTO_UPDATE=true
|
19
|
-
brew
|
19
|
+
brew uninstall --force imagemagick imagemagick@6
|
20
|
+
brew install wget ghostscript freetype jpeg little-cms2 libomp libpng libtiff liblqr libtool zlib webp
|
20
21
|
|
21
22
|
export LDFLAGS="-L/usr/local/opt/libxml2/lib -L/usr/local/opt/zlib/lib"
|
22
23
|
export CPPFLAGS="-I/usr/local/opt/libxml2/include -I/usr/local/opt/zlib/include"
|
data/ext/RMagick/extconf.rb
CHANGED
@@ -2,6 +2,7 @@ lib_dir = File.expand_path('../../lib', File.dirname(__FILE__))
|
|
2
2
|
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
3
3
|
require 'rubygems'
|
4
4
|
require 'mkmf'
|
5
|
+
require 'pkg-config'
|
5
6
|
|
6
7
|
module RMagick
|
7
8
|
class Extconf
|
@@ -9,6 +10,33 @@ module RMagick
|
|
9
10
|
RMAGICK_VERS = ::Magick::VERSION
|
10
11
|
MIN_RUBY_VERS = ::Magick::MIN_RUBY_VERSION
|
11
12
|
|
13
|
+
# ImageMagick 6.7 package
|
14
|
+
IM6_7_PACKAGES = ['ImageMagick'].freeze
|
15
|
+
|
16
|
+
# ImageMagick 6.8+ packages
|
17
|
+
IM6_PACKAGES = %w[
|
18
|
+
ImageMagick-6.Q64HDRI
|
19
|
+
ImageMagick-6.Q32HDRI
|
20
|
+
ImageMagick-6.Q16HDRI
|
21
|
+
ImageMagick-6.Q8HDRI
|
22
|
+
ImageMagick-6.Q64
|
23
|
+
ImageMagick-6.Q32
|
24
|
+
ImageMagick-6.Q16
|
25
|
+
ImageMagick-6.Q8
|
26
|
+
].freeze
|
27
|
+
|
28
|
+
# ImageMagick 7 packages
|
29
|
+
IM7_PACKAGES = %w[
|
30
|
+
ImageMagick-7.Q64HDRI
|
31
|
+
ImageMagick-7.Q32HDRI
|
32
|
+
ImageMagick-7.Q16HDRI
|
33
|
+
ImageMagick-7.Q8HDRI
|
34
|
+
ImageMagick-7.Q64
|
35
|
+
ImageMagick-7.Q32
|
36
|
+
ImageMagick-7.Q16
|
37
|
+
ImageMagick-7.Q8
|
38
|
+
].freeze
|
39
|
+
|
12
40
|
attr_reader :headers
|
13
41
|
|
14
42
|
def initialize
|
@@ -67,18 +95,20 @@ module RMagick
|
|
67
95
|
check_multiple_imagemagick_versions
|
68
96
|
check_partial_imagemagick_versions
|
69
97
|
|
70
|
-
|
71
|
-
|
98
|
+
original_ldflags = $LDFLAGS.dup
|
99
|
+
|
100
|
+
libdir = PKGConfig.libs_only_L($magick_package).chomp.sub('-L', '')
|
101
|
+
ldflags = "#{ENV['LDFLAGS']} " + PKGConfig.libs($magick_package).chomp
|
72
102
|
rpath = libdir.empty? ? '' : "-Wl,-rpath,#{libdir}"
|
73
103
|
|
74
104
|
# Save flags
|
75
|
-
$CPPFLAGS
|
76
|
-
$LOCAL_LIBS
|
77
|
-
$LDFLAGS
|
105
|
+
$CPPFLAGS += " #{ENV['CPPFLAGS']} " + PKGConfig.cflags($magick_package).chomp
|
106
|
+
$LOCAL_LIBS += " #{ENV['LIBS']} " + PKGConfig.libs($magick_package).chomp
|
107
|
+
$LDFLAGS += " #{ldflags} #{rpath}"
|
78
108
|
|
79
109
|
unless try_link("int main() { }")
|
80
110
|
# if linker does not recognizes '-Wl,-rpath,somewhere' option, it revert to original option
|
81
|
-
$LDFLAGS = ldflags
|
111
|
+
$LDFLAGS = "#{original_ldflags} #{ldflags}"
|
82
112
|
end
|
83
113
|
|
84
114
|
configure_archflags_for_osx($magick_package) if RUBY_PLATFORM =~ /darwin/ # osx
|
@@ -86,8 +116,8 @@ module RMagick
|
|
86
116
|
elsif RUBY_PLATFORM =~ /mingw/ # mingw
|
87
117
|
|
88
118
|
dir_paths = search_paths_for_library_for_windows
|
89
|
-
$CPPFLAGS
|
90
|
-
$LDFLAGS
|
119
|
+
$CPPFLAGS += %( -I"#{dir_paths[:include]}")
|
120
|
+
$LDFLAGS += %( -L"#{dir_paths[:lib]}")
|
91
121
|
$LDFLAGS << ' -lucrt' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0')
|
92
122
|
|
93
123
|
have_library(im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_' : 'CORE_RL_magick_')
|
@@ -99,11 +129,15 @@ module RMagick
|
|
99
129
|
$LDFLAGS << %( -libpath:"#{dir_paths[:lib]}")
|
100
130
|
$LDFLAGS << ' -libpath:ucrt' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0')
|
101
131
|
|
102
|
-
$LOCAL_LIBS
|
132
|
+
$LOCAL_LIBS += ' ' + (im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_.lib' : 'CORE_RL_magick_.lib')
|
103
133
|
|
104
134
|
end
|
105
135
|
|
106
|
-
$CPPFLAGS <<
|
136
|
+
$CPPFLAGS << if have_macro('__GNUC__')
|
137
|
+
' -std=gnu99 -Wno-void-pointer-to-int-cast -Wno-void-pointer-to-enum-cast -Wno-pointer-to-int-cast'
|
138
|
+
else
|
139
|
+
' -std=c99'
|
140
|
+
end
|
107
141
|
end
|
108
142
|
|
109
143
|
def exit_failure(msg)
|
@@ -123,31 +157,40 @@ module RMagick
|
|
123
157
|
exit(1)
|
124
158
|
end
|
125
159
|
|
160
|
+
def detect_imagemagick_packages(packages)
|
161
|
+
packages.select do |package|
|
162
|
+
PKGConfig.exist?(package)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def installed_im6_packages
|
167
|
+
@installed_im6_packages ||= detect_imagemagick_packages(IM6_PACKAGES)
|
168
|
+
end
|
169
|
+
|
170
|
+
def installed_im7_packages
|
171
|
+
@installed_im7_packages ||= detect_imagemagick_packages(IM7_PACKAGES)
|
172
|
+
end
|
173
|
+
|
126
174
|
def determine_imagemagick_package
|
127
|
-
packages =
|
175
|
+
packages = [installed_im7_packages, installed_im6_packages].flatten
|
128
176
|
|
129
|
-
# For ancient version of ImageMagick 6 we need a different regex
|
130
177
|
if packages.empty?
|
131
|
-
|
178
|
+
# ImageMagick 6.7 does not have package file like ImageMagick-6.Q16.pc
|
179
|
+
packages = detect_imagemagick_packages(IM6_7_PACKAGES)
|
132
180
|
end
|
133
181
|
|
134
182
|
if packages.empty?
|
135
183
|
exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find ImageMagick with pkg-config\n"
|
136
184
|
end
|
137
185
|
|
138
|
-
if
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
true
|
147
|
-
else
|
148
|
-
packages = im7_packages
|
149
|
-
false
|
150
|
-
end
|
186
|
+
if installed_im6_packages.any? && installed_im7_packages.any?
|
187
|
+
checking_for('forced use of ImageMagick 6') do
|
188
|
+
if ENV['USE_IMAGEMAGICK_6']
|
189
|
+
packages = installed_im6_packages
|
190
|
+
true
|
191
|
+
else
|
192
|
+
packages = installed_im7_packages
|
193
|
+
false
|
151
194
|
end
|
152
195
|
end
|
153
196
|
end
|
@@ -219,7 +262,7 @@ module RMagick
|
|
219
262
|
# issue #169
|
220
263
|
# set ARCHFLAGS appropriately for OSX
|
221
264
|
def configure_archflags_for_osx(magick_package)
|
222
|
-
return unless
|
265
|
+
return unless PKGConfig.libs_only_L(magick_package).match(%r{-L(.+)/lib})
|
223
266
|
|
224
267
|
imagemagick_dir = Regexp.last_match(1)
|
225
268
|
command = Dir.glob(File.join(imagemagick_dir, "bin/*")).select { |file| File.executable? file }.first
|
@@ -294,16 +337,12 @@ module RMagick
|
|
294
337
|
END_FAILURE
|
295
338
|
|
296
339
|
if RUBY_PLATFORM !~ /mswin|mingw/
|
297
|
-
unless
|
298
|
-
exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find pkg-config in #{ENV['PATH']}\n"
|
299
|
-
end
|
300
|
-
|
301
|
-
unless `pkg-config --libs MagickCore`[/\bl\s*(MagickCore|Magick)6?\b/]
|
340
|
+
unless PKGConfig.libs('MagickCore')[/\bl\s*(MagickCore|Magick)6?\b/]
|
302
341
|
exit_failure failure_message
|
303
342
|
end
|
304
343
|
|
305
344
|
$magick_package = determine_imagemagick_package
|
306
|
-
$magick_version =
|
345
|
+
$magick_version = PKGConfig.modversion($magick_package)[/^(\d+\.\d+\.\d+)/]
|
307
346
|
else
|
308
347
|
`#{magick_command} -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-+\d+ /
|
309
348
|
$magick_version = Regexp.last_match(1)
|
@@ -360,9 +399,6 @@ module RMagick
|
|
360
399
|
|
361
400
|
def create_makefile_file
|
362
401
|
create_header_file
|
363
|
-
# Prior to 1.8.5 mkmf duplicated the symbols on the command line and in the
|
364
|
-
# extconf.h header. Suppress that behavior by removing the symbol array.
|
365
|
-
$defs = []
|
366
402
|
|
367
403
|
# Force re-compilation if the generated Makefile changed.
|
368
404
|
$config_h = 'Makefile'
|
data/ext/RMagick/rmagick.h
CHANGED
@@ -24,6 +24,7 @@
|
|
24
24
|
#include <sys/types.h>
|
25
25
|
#include "ruby.h"
|
26
26
|
#include "ruby/io.h"
|
27
|
+
#include "rmagick_gvl.h"
|
27
28
|
|
28
29
|
#if defined(__MINGW32__)
|
29
30
|
// Ruby defines wrong format specifiers for MinGW. So this defines original macro in here.
|
@@ -61,6 +62,11 @@
|
|
61
62
|
#undef PACKAGE_TARNAME
|
62
63
|
#undef WORDS_BIGENDIAN
|
63
64
|
|
65
|
+
#ifndef HAVE_RB_EXT_RACTOR_SAFE
|
66
|
+
#undef RUBY_TYPED_FROZEN_SHAREABLE
|
67
|
+
#define RUBY_TYPED_FROZEN_SHAREABLE 0
|
68
|
+
#endif
|
69
|
+
|
64
70
|
#include "extconf.h"
|
65
71
|
|
66
72
|
#if defined(IMAGEMAGICK_7)
|
@@ -90,8 +96,8 @@
|
|
90
96
|
|
91
97
|
//! Trace new image creation in bang methods
|
92
98
|
#define UPDATE_DATA_PTR(_obj_, _new_) \
|
93
|
-
do {
|
94
|
-
|
99
|
+
do { \
|
100
|
+
DATA_PTR(_obj_) = (void *)(_new_); \
|
95
101
|
} while(0)
|
96
102
|
|
97
103
|
|
@@ -396,7 +402,6 @@ EXTERN VALUE Class_KernelInfoType;
|
|
396
402
|
/**
|
397
403
|
* Commonly-used IDs
|
398
404
|
*/
|
399
|
-
EXTERN ID rm_ID_trace_proc; /**< "@trace_proc" */
|
400
405
|
EXTERN ID rm_ID_call; /**< "call" */
|
401
406
|
EXTERN ID rm_ID_changed; /**< "changed" */
|
402
407
|
EXTERN ID rm_ID_cur_image; /**< "cur_image" */
|
@@ -411,7 +416,13 @@ EXTERN ID rm_ID_push; /**< "push" */
|
|
411
416
|
EXTERN ID rm_ID_values; /**< "values" */
|
412
417
|
EXTERN ID rm_ID_width; /**< "width" */
|
413
418
|
|
414
|
-
|
419
|
+
extern const rb_data_type_t rm_enum_data_type;
|
420
|
+
extern const rb_data_type_t rm_info_data_type;
|
421
|
+
extern const rb_data_type_t rm_image_data_type;
|
422
|
+
extern const rb_data_type_t rm_draw_data_type;
|
423
|
+
extern const rb_data_type_t rm_pixel_data_type;
|
424
|
+
extern const rb_data_type_t rm_montage_data_type;
|
425
|
+
extern const rb_data_type_t rm_kernel_info_data_type;
|
415
426
|
|
416
427
|
#if !defined(min)
|
417
428
|
#define min(a, b) ((a)<(b)?(a):(b)) /**< min of two values */
|
@@ -443,47 +454,47 @@ EXTERN unsigned long long rm_main_thread_id;
|
|
443
454
|
#define R_dbl_to_C_dbl(attr) NUM2DBL(attr) /**< C double <- Ruby double */
|
444
455
|
|
445
456
|
//! define attribute reader
|
446
|
-
#define
|
457
|
+
#define IMPLEMENT_TYPED_ATTR_READER(class, attr, type, data_type) \
|
447
458
|
{\
|
448
459
|
class *ptr;\
|
449
460
|
if (rb_obj_is_kind_of(self, Class_Image) == Qtrue) {\
|
450
461
|
rm_check_destroyed(self); \
|
451
462
|
}\
|
452
|
-
|
463
|
+
TypedData_Get_Struct(self, class, data_type, ptr);\
|
453
464
|
return C_##type##_to_R_##type(ptr->attr);\
|
454
465
|
}
|
455
466
|
|
456
467
|
//! define attribute reader when attribute name is different from the field name
|
457
|
-
#define
|
468
|
+
#define IMPLEMENT_TYPED_ATTR_READERF(class, attr, field, type, data_type) \
|
458
469
|
{\
|
459
470
|
class *ptr;\
|
460
471
|
rm_check_destroyed(self); \
|
461
|
-
|
472
|
+
TypedData_Get_Struct(self, class, data_type, ptr);\
|
462
473
|
return C_##type##_to_R_##type(ptr->field);\
|
463
474
|
}
|
464
475
|
|
465
476
|
//! define attribute writer
|
466
|
-
#define
|
477
|
+
#define IMPLEMENT_TYPED_ATTR_WRITER(class, attr, type, data_type) \
|
467
478
|
{\
|
468
479
|
class *ptr;\
|
469
480
|
if (rb_obj_is_kind_of(self, Class_Image) == Qtrue) {\
|
470
481
|
rm_check_destroyed(self); \
|
471
482
|
}\
|
472
483
|
rb_check_frozen(self);\
|
473
|
-
|
484
|
+
TypedData_Get_Struct(self, class, data_type, ptr);\
|
474
485
|
ptr->attr = R_##type##_to_C_##type(val);\
|
475
486
|
return val;\
|
476
487
|
}
|
477
488
|
|
478
489
|
//! define attribute writer when attribute name is different from the field name
|
479
|
-
#define
|
490
|
+
#define IMPLEMENT_TYPED_ATTR_WRITERF(class, attr, field, type, data_type) \
|
480
491
|
{\
|
481
492
|
class *ptr;\
|
482
493
|
if (rb_obj_is_kind_of(self, Class_Image) == Qtrue) {\
|
483
494
|
rm_check_destroyed(self); \
|
484
495
|
}\
|
485
496
|
rb_check_frozen(self);\
|
486
|
-
|
497
|
+
TypedData_Get_Struct(self, class, data_type, ptr);\
|
487
498
|
ptr->field = R_##type##_to_C_##type(val);\
|
488
499
|
return self;\
|
489
500
|
}
|
@@ -513,7 +524,6 @@ EXTERN unsigned long long rm_main_thread_id;
|
|
513
524
|
#define DEF_CONSTV(constant, val) rb_define_const(Module_Magick, #constant, UINT2NUM(val))
|
514
525
|
#endif
|
515
526
|
|
516
|
-
|
517
527
|
//! Convert a Ruby enum constant back to a C enum member.
|
518
528
|
#define VALUE_TO_ENUM(value, e, type) \
|
519
529
|
do {\
|
@@ -521,7 +531,7 @@ EXTERN unsigned long long rm_main_thread_id;
|
|
521
531
|
if (CLASS_OF(value) != Class_##type)\
|
522
532
|
rb_raise(rb_eTypeError, "wrong enumeration type - expected %s, got %s", \
|
523
533
|
rb_class2name(Class_##type), rb_class2name(CLASS_OF(value)));\
|
524
|
-
|
534
|
+
TypedData_Get_Struct(value, MagickEnum, &rm_enum_data_type, magick_enum);\
|
525
535
|
e = (type)(magick_enum->val);\
|
526
536
|
} while(0)
|
527
537
|
|
@@ -1019,7 +1029,6 @@ extern VALUE Image_write(VALUE, VALUE);
|
|
1019
1029
|
|
1020
1030
|
extern VALUE rm_image_new(Image *);
|
1021
1031
|
extern void rm_image_destroy(void *);
|
1022
|
-
extern void rm_trace_creation(Image *);
|
1023
1032
|
|
1024
1033
|
|
1025
1034
|
// rmfill.c
|
@@ -1043,7 +1052,6 @@ ATTR_ACCESSOR(Pixel, cyan)
|
|
1043
1052
|
ATTR_ACCESSOR(Pixel, magenta)
|
1044
1053
|
ATTR_ACCESSOR(Pixel, yellow)
|
1045
1054
|
ATTR_ACCESSOR(Pixel, black)
|
1046
|
-
extern void destroy_Pixel(Pixel *);
|
1047
1055
|
extern VALUE Pixel_alloc(VALUE);
|
1048
1056
|
extern VALUE Pixel_case_eq(VALUE, VALUE);
|
1049
1057
|
extern VALUE Pixel_clone(VALUE);
|
@@ -1193,7 +1201,6 @@ typedef enum
|
|
1193
1201
|
extern void rm_check_exception(ExceptionInfo *, Image *, ErrorRetention);
|
1194
1202
|
extern void rm_ensure_result(Image *);
|
1195
1203
|
extern Image *rm_clone_image(Image *);
|
1196
|
-
extern MagickBooleanType rm_progress_monitor(const char *, const MagickOffsetType, const MagickSizeType, void *);
|
1197
1204
|
extern VALUE rm_exif_by_entry(Image *);
|
1198
1205
|
extern VALUE rm_exif_by_number(Image *);
|
1199
1206
|
extern void rm_get_optional_arguments(VALUE);
|
@@ -1202,7 +1209,6 @@ extern void rm_error_handler(const ExceptionType, const char *, const char *);
|
|
1202
1209
|
extern void rm_warning_handler(const ExceptionType, const char *, const char *);
|
1203
1210
|
extern MagickBooleanType rm_should_raise_exception(ExceptionInfo *, const ExceptionRetention);
|
1204
1211
|
extern void rm_raise_exception(ExceptionInfo *);
|
1205
|
-
extern unsigned long long rm_current_thread_id();
|
1206
1212
|
#if defined(IMAGEMAGICK_6)
|
1207
1213
|
extern void rm_check_image_exception(Image *, ErrorRetention);
|
1208
1214
|
#endif
|
@@ -0,0 +1,224 @@
|
|
1
|
+
#ifndef _RMAGICK_GVL_H_
|
2
|
+
#define _RMAGICK_GVL_H_
|
3
|
+
|
4
|
+
#include "ruby/thread.h"
|
5
|
+
|
6
|
+
typedef void *(gvl_function_t)(void *);
|
7
|
+
|
8
|
+
#define GVL_FUNC(name) name##_gvl
|
9
|
+
#define GVL_STRUCT_TYPE(name) name##_args_t
|
10
|
+
#define CALL_FUNC_WITHOUT_GVL(fp, args) \
|
11
|
+
rb_thread_call_without_gvl(fp, args, RUBY_UBF_PROCESS, NULL)
|
12
|
+
|
13
|
+
|
14
|
+
#define DEFINE_GVL_STRUCT1(name, type1) \
|
15
|
+
typedef struct { \
|
16
|
+
type1 arg1; \
|
17
|
+
} GVL_STRUCT_TYPE(name)
|
18
|
+
#define DEFINE_GVL_FUNC1(func_name, struct_name) \
|
19
|
+
static void *func_name##_gvl(void *p) \
|
20
|
+
{ \
|
21
|
+
GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
|
22
|
+
return (void *)func_name(args->arg1); \
|
23
|
+
}
|
24
|
+
|
25
|
+
#define DEFINE_GVL_STUB1(name, type1) \
|
26
|
+
DEFINE_GVL_STRUCT1(name, type1); \
|
27
|
+
DEFINE_GVL_FUNC1(name, name)
|
28
|
+
|
29
|
+
|
30
|
+
#define DEFINE_GVL_STRUCT2(name, type1, type2) \
|
31
|
+
typedef struct { \
|
32
|
+
type1 arg1; \
|
33
|
+
type2 arg2; \
|
34
|
+
} GVL_STRUCT_TYPE(name)
|
35
|
+
#define DEFINE_GVL_FUNC2(func_name, struct_name) \
|
36
|
+
static void *func_name##_gvl(void *p) \
|
37
|
+
{ \
|
38
|
+
GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
|
39
|
+
return (void *)func_name(args->arg1, args->arg2); \
|
40
|
+
}
|
41
|
+
|
42
|
+
#define DEFINE_GVL_STUB2(name, type1, type2) \
|
43
|
+
DEFINE_GVL_STRUCT2(name, type1, type2); \
|
44
|
+
DEFINE_GVL_FUNC2(name, name)
|
45
|
+
|
46
|
+
|
47
|
+
#define DEFINE_GVL_STRUCT3(name, type1, type2, type3) \
|
48
|
+
typedef struct { \
|
49
|
+
type1 arg1; \
|
50
|
+
type2 arg2; \
|
51
|
+
type3 arg3; \
|
52
|
+
} GVL_STRUCT_TYPE(name)
|
53
|
+
#define DEFINE_GVL_FUNC3(func_name, struct_name) \
|
54
|
+
static void *func_name##_gvl(void *p) \
|
55
|
+
{ \
|
56
|
+
GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
|
57
|
+
return (void *)func_name(args->arg1, args->arg2, args->arg3); \
|
58
|
+
}
|
59
|
+
|
60
|
+
#define DEFINE_GVL_STUB3(name, type1, type2, type3) \
|
61
|
+
DEFINE_GVL_STRUCT3(name, type1, type2, type3); \
|
62
|
+
DEFINE_GVL_FUNC3(name, name)
|
63
|
+
|
64
|
+
|
65
|
+
#define DEFINE_GVL_STRUCT4(name, type1, type2, type3, type4) \
|
66
|
+
typedef struct { \
|
67
|
+
type1 arg1; \
|
68
|
+
type2 arg2; \
|
69
|
+
type3 arg3; \
|
70
|
+
type4 arg4; \
|
71
|
+
} GVL_STRUCT_TYPE(name)
|
72
|
+
#define DEFINE_GVL_FUNC4(func_name, struct_name) \
|
73
|
+
static void *func_name##_gvl(void *p) \
|
74
|
+
{ \
|
75
|
+
GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
|
76
|
+
return (void *)func_name(args->arg1, args->arg2, args->arg3, args->arg4); \
|
77
|
+
}
|
78
|
+
|
79
|
+
#define DEFINE_GVL_STUB4(name, type1, type2, type3, type4) \
|
80
|
+
DEFINE_GVL_STRUCT4(name, type1, type2, type3, type4); \
|
81
|
+
DEFINE_GVL_FUNC4(name, name)
|
82
|
+
|
83
|
+
|
84
|
+
#define DEFINE_GVL_STRUCT5(name, type1, type2, type3, type4, type5) \
|
85
|
+
typedef struct { \
|
86
|
+
type1 arg1; \
|
87
|
+
type2 arg2; \
|
88
|
+
type3 arg3; \
|
89
|
+
type4 arg4; \
|
90
|
+
type5 arg5; \
|
91
|
+
} GVL_STRUCT_TYPE(name)
|
92
|
+
#define DEFINE_GVL_FUNC5(func_name, struct_name) \
|
93
|
+
static void *func_name##_gvl(void *p) \
|
94
|
+
{ \
|
95
|
+
GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
|
96
|
+
return (void *)func_name(args->arg1, args->arg2, args->arg3, args->arg4, args->arg5); \
|
97
|
+
}
|
98
|
+
#define DEFINE_GVL_STUB5(name, type1, type2, type3, type4, type5) \
|
99
|
+
DEFINE_GVL_STRUCT5(name, type1, type2, type3, type4, type5); \
|
100
|
+
DEFINE_GVL_FUNC5(name, name)
|
101
|
+
|
102
|
+
|
103
|
+
#define DEFINE_GVL_STRUCT6(name, type1, type2, type3, type4, type5, type6) \
|
104
|
+
typedef struct { \
|
105
|
+
type1 arg1; \
|
106
|
+
type2 arg2; \
|
107
|
+
type3 arg3; \
|
108
|
+
type4 arg4; \
|
109
|
+
type5 arg5; \
|
110
|
+
type6 arg6; \
|
111
|
+
} GVL_STRUCT_TYPE(name)
|
112
|
+
#define DEFINE_GVL_FUNC6(func_name, struct_name) \
|
113
|
+
static void *func_name##_gvl(void *p) \
|
114
|
+
{ \
|
115
|
+
GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
|
116
|
+
return (void *)func_name(args->arg1, args->arg2, args->arg3, args->arg4, args->arg5, args->arg6); \
|
117
|
+
}
|
118
|
+
#define DEFINE_GVL_STUB6(name, type1, type2, type3, type4, type5, type6) \
|
119
|
+
DEFINE_GVL_STRUCT6(name, type1, type2, type3, type4, type5, type6); \
|
120
|
+
DEFINE_GVL_FUNC6(name, name)
|
121
|
+
|
122
|
+
|
123
|
+
#define DEFINE_GVL_STRUCT7(name, type1, type2, type3, type4, type5, type6, type7) \
|
124
|
+
typedef struct { \
|
125
|
+
type1 arg1; \
|
126
|
+
type2 arg2; \
|
127
|
+
type3 arg3; \
|
128
|
+
type4 arg4; \
|
129
|
+
type5 arg5; \
|
130
|
+
type6 arg6; \
|
131
|
+
type7 arg7; \
|
132
|
+
} GVL_STRUCT_TYPE(name)
|
133
|
+
#define DEFINE_GVL_FUNC7(func_name, struct_name) \
|
134
|
+
static void *func_name##_gvl(void *p) \
|
135
|
+
{ \
|
136
|
+
GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
|
137
|
+
return (void *)func_name(args->arg1, args->arg2, args->arg3, args->arg4, args->arg5, args->arg6, args->arg7); \
|
138
|
+
}
|
139
|
+
#define DEFINE_GVL_STUB7(name, type1, type2, type3, type4, type5, type6, type7) \
|
140
|
+
DEFINE_GVL_STRUCT7(name, type1, type2, type3, type4, type5, type6, type7); \
|
141
|
+
DEFINE_GVL_FUNC7(name, name)
|
142
|
+
|
143
|
+
|
144
|
+
#define DEFINE_GVL_STRUCT8(name, type1, type2, type3, type4, type5, type6, type7, type8) \
|
145
|
+
typedef struct { \
|
146
|
+
type1 arg1; \
|
147
|
+
type2 arg2; \
|
148
|
+
type3 arg3; \
|
149
|
+
type4 arg4; \
|
150
|
+
type5 arg5; \
|
151
|
+
type6 arg6; \
|
152
|
+
type7 arg7; \
|
153
|
+
type8 arg8; \
|
154
|
+
} GVL_STRUCT_TYPE(name)
|
155
|
+
#define DEFINE_GVL_FUNC8(func_name, struct_name) \
|
156
|
+
static void *func_name##_gvl(void *p) \
|
157
|
+
{ \
|
158
|
+
GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
|
159
|
+
return (void *)func_name(args->arg1, args->arg2, args->arg3, args->arg4, args->arg5, args->arg6, args->arg7, args->arg8); \
|
160
|
+
}
|
161
|
+
#define DEFINE_GVL_STUB8(name, type1, type2, type3, type4, type5, type6, type7, type8) \
|
162
|
+
DEFINE_GVL_STRUCT8(name, type1, type2, type3, type4, type5, type6, type7, type8); \
|
163
|
+
DEFINE_GVL_FUNC8(name, name)
|
164
|
+
|
165
|
+
|
166
|
+
#define DEFINE_GVL_STRUCT9(name, type1, type2, type3, type4, type5, type6, type7, type8, type9) \
|
167
|
+
typedef struct { \
|
168
|
+
type1 arg1; \
|
169
|
+
type2 arg2; \
|
170
|
+
type3 arg3; \
|
171
|
+
type4 arg4; \
|
172
|
+
type5 arg5; \
|
173
|
+
type6 arg6; \
|
174
|
+
type7 arg7; \
|
175
|
+
type8 arg8; \
|
176
|
+
type9 arg9; \
|
177
|
+
} GVL_STRUCT_TYPE(name)
|
178
|
+
#define DEFINE_GVL_FUNC9(func_name, struct_name) \
|
179
|
+
static void *func_name##_gvl(void *p) \
|
180
|
+
{ \
|
181
|
+
GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
|
182
|
+
return (void *)func_name(args->arg1, args->arg2, args->arg3, args->arg4, args->arg5, args->arg6, args->arg7, args->arg8, args->arg9); \
|
183
|
+
}
|
184
|
+
#define DEFINE_GVL_STUB9(name, type1, type2, type3, type4, type5, type6, type7, type8, type9) \
|
185
|
+
DEFINE_GVL_STRUCT9(name, type1, type2, type3, type4, type5, type6, type7, type8, type9); \
|
186
|
+
DEFINE_GVL_FUNC9(name, name)
|
187
|
+
|
188
|
+
|
189
|
+
#define DEFINE_GVL_VOID_FUNC2(func_name, struct_name) \
|
190
|
+
static void *func_name##_gvl(void *p) \
|
191
|
+
{ \
|
192
|
+
GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
|
193
|
+
func_name(args->arg1, args->arg2); \
|
194
|
+
return NULL; \
|
195
|
+
}
|
196
|
+
#define DEFINE_GVL_VOID_STUB2(name, type1, type2) \
|
197
|
+
DEFINE_GVL_STRUCT2(name, type1, type2); \
|
198
|
+
DEFINE_GVL_VOID_FUNC2(name, name)
|
199
|
+
|
200
|
+
|
201
|
+
#define DEFINE_GVL_VOID_FUNC3(func_name, struct_name) \
|
202
|
+
static void *func_name##_gvl(void *p) \
|
203
|
+
{ \
|
204
|
+
GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
|
205
|
+
func_name(args->arg1, args->arg2, args->arg3); \
|
206
|
+
return NULL; \
|
207
|
+
}
|
208
|
+
#define DEFINE_GVL_VOID_STUB3(name, type1, type2, type3) \
|
209
|
+
DEFINE_GVL_STRUCT3(name, type1, type2, type3); \
|
210
|
+
DEFINE_GVL_VOID_FUNC3(name, name)
|
211
|
+
|
212
|
+
|
213
|
+
#define DEFINE_GVL_VOID_FUNC6(func_name, struct_name) \
|
214
|
+
static void *func_name##_gvl(void *p) \
|
215
|
+
{ \
|
216
|
+
GVL_STRUCT_TYPE(struct_name) *args = (GVL_STRUCT_TYPE(struct_name) *)p; \
|
217
|
+
func_name(args->arg1, args->arg2, args->arg3, args->arg4, args->arg5, args->arg6); \
|
218
|
+
return NULL; \
|
219
|
+
}
|
220
|
+
#define DEFINE_GVL_VOID_STUB6(name, type1, type2, type3, type4, type5, type6) \
|
221
|
+
DEFINE_GVL_STRUCT6(name, type1, type2, type3, type4, type5, type6); \
|
222
|
+
DEFINE_GVL_VOID_FUNC6(name, name)
|
223
|
+
|
224
|
+
#endif
|