rmagick 4.2.5 → 5.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer/Dockerfile +14 -0
  3. data/.devcontainer/ImageMagick6/devcontainer.json +11 -0
  4. data/.devcontainer/devcontainer.json +11 -0
  5. data/.devcontainer/setup-repo.sh +10 -0
  6. data/.devcontainer/setup-user.sh +45 -0
  7. data/.editorconfig +1 -1
  8. data/.github/workflows/ci.yml +90 -9
  9. data/.gitignore +4 -0
  10. data/.rubocop_todo.yml +16 -9
  11. data/.yardopts +1 -1
  12. data/CHANGELOG.md +141 -0
  13. data/Gemfile +20 -0
  14. data/README.md +12 -17
  15. data/Rakefile +63 -80
  16. data/before_install_linux.sh +4 -4
  17. data/before_install_osx.sh +7 -6
  18. data/ext/RMagick/extconf.rb +113 -52
  19. data/ext/RMagick/{rmagick.c → rmagick.cpp} +19 -22
  20. data/ext/RMagick/rmagick.h +88 -59
  21. data/ext/RMagick/rmagick_gvl.h +224 -0
  22. data/ext/RMagick/{rmdraw.c → rmdraw.cpp} +170 -159
  23. data/ext/RMagick/{rmenum.c → rmenum.cpp} +69 -50
  24. data/ext/RMagick/{rmfill.c → rmfill.cpp} +85 -24
  25. data/ext/RMagick/{rmilist.c → rmilist.cpp} +191 -93
  26. data/ext/RMagick/{rmimage.c → rmimage.cpp} +1544 -989
  27. data/ext/RMagick/{rminfo.c → rminfo.cpp} +140 -152
  28. data/ext/RMagick/{rmkinfo.c → rmkinfo.cpp} +46 -34
  29. data/ext/RMagick/rmmain.cpp +1923 -0
  30. data/ext/RMagick/{rmmontage.c → rmmontage.cpp} +50 -29
  31. data/ext/RMagick/{rmpixel.c → rmpixel.cpp} +108 -83
  32. data/ext/RMagick/{rmstruct.c → rmstruct.cpp} +6 -6
  33. data/ext/RMagick/{rmutil.c → rmutil.cpp} +62 -161
  34. data/lib/rmagick/version.rb +3 -1
  35. data/lib/rmagick.rb +2 -0
  36. data/lib/rmagick_internal.rb +76 -110
  37. data/lib/rvg/embellishable.rb +6 -2
  38. data/lib/rvg/misc.rb +7 -7
  39. data/lib/rvg/rvg.rb +2 -0
  40. data/lib/rvg/stretchable.rb +2 -2
  41. data/lib/rvg/transformable.rb +1 -1
  42. data/rmagick.gemspec +6 -17
  43. data/sig/rmagick/_draw_common_methods.rbs +64 -0
  44. data/sig/rmagick/_image_common_methods.rbs +389 -0
  45. data/sig/rmagick/draw.rbs +38 -0
  46. data/sig/rmagick/draw_attribute.rbs +28 -0
  47. data/sig/rmagick/enum.rbs +814 -0
  48. data/sig/rmagick/error.rbs +11 -0
  49. data/sig/rmagick/fill.rbs +21 -0
  50. data/sig/rmagick/geometry.rbs +14 -0
  51. data/sig/rmagick/image.rbs +194 -0
  52. data/sig/rmagick/image_list.rbs +181 -0
  53. data/sig/rmagick/iptc.rbs +101 -0
  54. data/sig/rmagick/kernel_info.rbs +12 -0
  55. data/sig/rmagick/optional_method_arguments.rbs +10 -0
  56. data/sig/rmagick/pixel.rbs +46 -0
  57. data/sig/rmagick/struct.rbs +90 -0
  58. data/sig/rmagick.rbs +43 -0
  59. data/sig/rvg/clippath.rbs +34 -0
  60. data/sig/rvg/container.rbs +78 -0
  61. data/sig/rvg/deep_equal.rbs +48 -0
  62. data/sig/rvg/describable.rbs +30 -0
  63. data/sig/rvg/embellishable.rbs +226 -0
  64. data/sig/rvg/misc.rbs +145 -0
  65. data/sig/rvg/paint.rbs +55 -0
  66. data/sig/rvg/pathdata.rbs +77 -0
  67. data/sig/rvg/rvg.rbs +125 -0
  68. data/sig/rvg/stretchable.rbs +56 -0
  69. data/sig/rvg/stylable.rbs +66 -0
  70. data/sig/rvg/text.rbs +118 -0
  71. data/sig/rvg/transformable.rbs +59 -0
  72. data/sig/rvg/units.rbs +33 -0
  73. metadata +63 -128
  74. data/.codeclimate.yml +0 -63
  75. data/deprecated/RMagick.rb +0 -6
  76. data/ext/RMagick/rmmain.c +0 -1951
@@ -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