rmagick 7.1.1 → 7.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Rakefile +3 -1
- data/ext/RMagick/rmdraw.cpp +124 -52
- data/lib/rmagick/version.rb +1 -1
- data/lib/rvg/deep_equal.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a64e970fa95ffd136462c610a760685197a4ed3ceb2c9e6dad90be7a0c8f3211
|
|
4
|
+
data.tar.gz: dc300b78b89fdb54386fbc10e14b55f6dd37497e65923ec48728abe3b3c85b1d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f9ae77c69984d7472435ccfceda7c74637a4b2374e6529d40d47dae464629058a778c76208f7ca9c1644ecc2e50a44ca507abcd265fb57cff22c83fc7f031cf5
|
|
7
|
+
data.tar.gz: 3d620912beddcea78dc6953c461281f35bf5ea1c9d68c3cfe0c8a25c60cefc79f36c4834c559d59f448e1d749956755148425bd421a8f20e17859fd24f867e8f
|
data/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
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 7.1.2
|
|
7
|
+
|
|
8
|
+
Bug Fixes
|
|
9
|
+
|
|
10
|
+
* Fix memory leak in Draw#annotate when the geometry copy fails (#1854)
|
|
11
|
+
* Fix affine matrix not being restored when Draw#annotate raises (#1853)
|
|
12
|
+
* Fix use-after-free in Draw#annotate when a callback destroys the image (#1852)
|
|
13
|
+
* Fix memory leak in Draw#annotate when a geometry argument raises (#1850)
|
|
14
|
+
|
|
6
15
|
## RMagick 7.1.1
|
|
7
16
|
|
|
8
17
|
Bug Fixes
|
data/Rakefile
CHANGED
|
@@ -195,7 +195,9 @@ if RUBY_PLATFORM.include?('linux')
|
|
|
195
195
|
)
|
|
196
196
|
|
|
197
197
|
namespace :spec do
|
|
198
|
-
RubyMemcheck::RSpec::RakeTask.new(valgrind: :compile)
|
|
198
|
+
RubyMemcheck::RSpec::RakeTask.new(valgrind: :compile) do |t|
|
|
199
|
+
t.rspec_opts = '--tag "~slow"' unless ENV['SLOW']
|
|
200
|
+
end
|
|
199
201
|
end
|
|
200
202
|
end
|
|
201
203
|
|
data/ext/RMagick/rmdraw.cpp
CHANGED
|
@@ -836,72 +836,88 @@ Draw_undercolor_eq(VALUE self, VALUE undercolor)
|
|
|
836
836
|
}
|
|
837
837
|
|
|
838
838
|
|
|
839
|
+
struct Draw_annotate_args
|
|
840
|
+
{
|
|
841
|
+
VALUE self;
|
|
842
|
+
VALUE image_arg;
|
|
843
|
+
VALUE width_arg;
|
|
844
|
+
VALUE height_arg;
|
|
845
|
+
VALUE x_arg;
|
|
846
|
+
VALUE y_arg;
|
|
847
|
+
VALUE text;
|
|
848
|
+
Draw *draw;
|
|
849
|
+
AffineMatrix keep;
|
|
850
|
+
#if defined(IMAGEMAGICK_7)
|
|
851
|
+
ExceptionInfo *exception;
|
|
852
|
+
#endif
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
|
|
839
856
|
/**
|
|
840
|
-
*
|
|
857
|
+
* Release what annotate_body acquired and restore the affine matrix.
|
|
841
858
|
*
|
|
842
|
-
*
|
|
843
|
-
* which is executed in the context of a Draw object.
|
|
859
|
+
* No Ruby usage (internal function)
|
|
844
860
|
*
|
|
845
|
-
* @param
|
|
846
|
-
*
|
|
847
|
-
* @
|
|
848
|
-
* @param height_arg [Numeric] the height
|
|
849
|
-
* @param x_arg [Numeric] x position
|
|
850
|
-
* @param y_arg [Numeric] y position
|
|
851
|
-
* @param text [String] the annotation text
|
|
852
|
-
* @return [Magick::Draw] self
|
|
861
|
+
* @param arg the annotate arguments
|
|
862
|
+
* @return nil
|
|
863
|
+
* @see Draw_annotate
|
|
853
864
|
*/
|
|
854
|
-
VALUE
|
|
855
|
-
|
|
856
|
-
VALUE image_arg,
|
|
857
|
-
VALUE width_arg,
|
|
858
|
-
VALUE height_arg,
|
|
859
|
-
VALUE x_arg,
|
|
860
|
-
VALUE y_arg,
|
|
861
|
-
VALUE text)
|
|
865
|
+
static VALUE
|
|
866
|
+
annotate_ensure(VALUE arg)
|
|
862
867
|
{
|
|
863
|
-
|
|
868
|
+
struct Draw_annotate_args *annotate = (struct Draw_annotate_args *)arg;
|
|
869
|
+
Draw *draw = annotate->draw;
|
|
870
|
+
|
|
871
|
+
magick_free(draw->info->text);
|
|
872
|
+
draw->info->text = NULL;
|
|
873
|
+
draw->info->affine = annotate->keep;
|
|
874
|
+
|
|
875
|
+
#if defined(IMAGEMAGICK_7)
|
|
876
|
+
if (annotate->exception)
|
|
877
|
+
{
|
|
878
|
+
DestroyExceptionInfo(annotate->exception);
|
|
879
|
+
annotate->exception = NULL;
|
|
880
|
+
}
|
|
881
|
+
#endif
|
|
882
|
+
|
|
883
|
+
return Qnil;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* Annotate the image.
|
|
889
|
+
*
|
|
890
|
+
* No Ruby usage (internal function)
|
|
891
|
+
*
|
|
892
|
+
* @param arg the annotate arguments
|
|
893
|
+
* @return self
|
|
894
|
+
* @see Draw_annotate
|
|
895
|
+
*/
|
|
896
|
+
static VALUE
|
|
897
|
+
annotate_body(VALUE arg)
|
|
898
|
+
{
|
|
899
|
+
struct Draw_annotate_args *annotate = (struct Draw_annotate_args *)arg;
|
|
900
|
+
Draw *draw = annotate->draw;
|
|
864
901
|
Image *image;
|
|
865
902
|
unsigned long width, height;
|
|
866
903
|
long x, y;
|
|
867
|
-
AffineMatrix keep;
|
|
868
904
|
char geometry_str[100];
|
|
869
905
|
char *embed_text;
|
|
870
906
|
#if defined(IMAGEMAGICK_7)
|
|
871
907
|
ExceptionInfo *exception;
|
|
872
908
|
#endif
|
|
873
909
|
|
|
874
|
-
// Save the affine matrix in case it is modified by
|
|
875
|
-
// Draw#rotation=
|
|
876
|
-
draw = get_draw(self);
|
|
877
|
-
keep = draw->info->affine;
|
|
878
|
-
|
|
879
|
-
image_arg = rm_cur_image(image_arg);
|
|
880
|
-
image = rm_check_frozen(image_arg);
|
|
881
|
-
|
|
882
910
|
// If we have an optional parm block, run it in self's context,
|
|
883
911
|
// allowing the app a chance to modify the object's attributes
|
|
884
912
|
if (rb_block_given_p())
|
|
885
913
|
{
|
|
886
|
-
rb_yield(self);
|
|
914
|
+
rb_yield(annotate->self);
|
|
887
915
|
}
|
|
888
916
|
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
embed_text = StringValueCStr(text);
|
|
894
|
-
draw->info->text = ConstantString(embed_text);
|
|
895
|
-
#if defined(IMAGEMAGICK_7)
|
|
896
|
-
exception = AcquireExceptionInfo();
|
|
897
|
-
#endif
|
|
898
|
-
|
|
899
|
-
// Create geometry string, copy to Draw structure, overriding
|
|
900
|
-
// any previously existing value.
|
|
901
|
-
width = NUM2ULONG(width_arg);
|
|
902
|
-
height = NUM2ULONG(height_arg);
|
|
903
|
-
x = NUM2LONG(x_arg);
|
|
904
|
-
y = NUM2LONG(y_arg);
|
|
917
|
+
width = NUM2ULONG(annotate->width_arg);
|
|
918
|
+
height = NUM2ULONG(annotate->height_arg);
|
|
919
|
+
x = NUM2LONG(annotate->x_arg);
|
|
920
|
+
y = NUM2LONG(annotate->y_arg);
|
|
905
921
|
|
|
906
922
|
if (width == 0 && height == 0)
|
|
907
923
|
{
|
|
@@ -916,25 +932,81 @@ VALUE Draw_annotate(
|
|
|
916
932
|
|
|
917
933
|
magick_clone_string(&draw->info->geometry, geometry_str);
|
|
918
934
|
|
|
935
|
+
// Store in Draw structure. The text is drawn as given: it is not run
|
|
936
|
+
// through InterpretImageProperties(), so a `%[...]` or `%x` escape in it is
|
|
937
|
+
// not expanded. Everything those escapes provide is available directly from
|
|
938
|
+
// Ruby -- Image#columns, Image#filename, Image#artifact and so on.
|
|
939
|
+
embed_text = StringValueCStr(annotate->text);
|
|
940
|
+
image = rm_check_frozen(annotate->image_arg);
|
|
941
|
+
draw->info->text = ConstantString(embed_text);
|
|
942
|
+
|
|
919
943
|
#if defined(IMAGEMAGICK_7)
|
|
920
|
-
|
|
944
|
+
annotate->exception = AcquireExceptionInfo();
|
|
945
|
+
GVL_STRUCT_TYPE(AnnotateImage) args = { image, draw->info, annotate->exception };
|
|
921
946
|
#else
|
|
922
947
|
GVL_STRUCT_TYPE(AnnotateImage) args = { image, draw->info };
|
|
923
948
|
#endif
|
|
924
949
|
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(AnnotateImage), &args);
|
|
925
950
|
|
|
926
|
-
magick_free(draw->info->text);
|
|
927
|
-
draw->info->text = NULL;
|
|
928
|
-
draw->info->affine = keep;
|
|
929
|
-
|
|
930
951
|
#if defined(IMAGEMAGICK_7)
|
|
952
|
+
exception = annotate->exception;
|
|
953
|
+
annotate->exception = NULL;
|
|
954
|
+
|
|
931
955
|
CHECK_EXCEPTION();
|
|
932
956
|
DestroyExceptionInfo(exception);
|
|
933
957
|
#else
|
|
934
958
|
rm_check_image_exception(image, RetainOnError);
|
|
935
959
|
#endif
|
|
936
960
|
|
|
937
|
-
return self;
|
|
961
|
+
return annotate->self;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* Annotates an image with text.
|
|
967
|
+
*
|
|
968
|
+
* - Additional Draw attribute methods may be called in the optional block,
|
|
969
|
+
* which is executed in the context of a Draw object.
|
|
970
|
+
*
|
|
971
|
+
* @param image_arg [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
|
972
|
+
* imagelist, uses the current image.
|
|
973
|
+
* @param width_arg [Numeric] the width
|
|
974
|
+
* @param height_arg [Numeric] the height
|
|
975
|
+
* @param x_arg [Numeric] x position
|
|
976
|
+
* @param y_arg [Numeric] y position
|
|
977
|
+
* @param text [String] the annotation text
|
|
978
|
+
* @return [Magick::Draw] self
|
|
979
|
+
*/
|
|
980
|
+
VALUE Draw_annotate(
|
|
981
|
+
VALUE self,
|
|
982
|
+
VALUE image_arg,
|
|
983
|
+
VALUE width_arg,
|
|
984
|
+
VALUE height_arg,
|
|
985
|
+
VALUE x_arg,
|
|
986
|
+
VALUE y_arg,
|
|
987
|
+
VALUE text)
|
|
988
|
+
{
|
|
989
|
+
struct Draw_annotate_args annotate;
|
|
990
|
+
|
|
991
|
+
// Save the affine matrix in case it is modified by
|
|
992
|
+
// Draw#rotation=
|
|
993
|
+
annotate.draw = get_draw(self);
|
|
994
|
+
annotate.keep = annotate.draw->info->affine;
|
|
995
|
+
|
|
996
|
+
annotate.self = self;
|
|
997
|
+
annotate.image_arg = rm_cur_image(image_arg);
|
|
998
|
+
annotate.width_arg = width_arg;
|
|
999
|
+
annotate.height_arg = height_arg;
|
|
1000
|
+
annotate.x_arg = x_arg;
|
|
1001
|
+
annotate.y_arg = y_arg;
|
|
1002
|
+
annotate.text = text;
|
|
1003
|
+
#if defined(IMAGEMAGICK_7)
|
|
1004
|
+
annotate.exception = NULL;
|
|
1005
|
+
#endif
|
|
1006
|
+
|
|
1007
|
+
rm_check_frozen(annotate.image_arg);
|
|
1008
|
+
|
|
1009
|
+
return rb_ensure(annotate_body, (VALUE)&annotate, annotate_ensure, (VALUE)&annotate);
|
|
938
1010
|
}
|
|
939
1011
|
|
|
940
1012
|
|
data/lib/rmagick/version.rb
CHANGED
data/lib/rvg/deep_equal.rb
CHANGED
|
@@ -17,7 +17,7 @@ module Magick
|
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
[Shape, TextBase, Image, Group, Content, Use, ClipPath, Pattern,
|
|
20
|
+
[Shape, TextBase, Image, Group, Content, Use, ClipPath, Pattern, RVG].each do |c|
|
|
21
21
|
c.class_eval do
|
|
22
22
|
def deep_equal(other)
|
|
23
23
|
ivs = instance_variables
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rmagick
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.1.
|
|
4
|
+
version: 7.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tim Hunter
|
|
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
143
143
|
version: '0'
|
|
144
144
|
requirements:
|
|
145
145
|
- ImageMagick 6.9.0+ (for ImageMagick 6) or 7.1.0+ (for ImageMagick 7)
|
|
146
|
-
rubygems_version: 4.0.
|
|
146
|
+
rubygems_version: 4.0.18
|
|
147
147
|
specification_version: 4
|
|
148
148
|
summary: Ruby binding to ImageMagick
|
|
149
149
|
test_files: []
|