phantom_svg 1.1.6 → 1.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phantom/parser/png_writer.rb +8 -2
- data/phantom_svg.gemspec +3 -3
- data/spec/phantom/svg_spec.rb +24 -44
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97969b47cb157d5b24f02e6ab5b73e700c65d7b2
|
4
|
+
data.tar.gz: 423b45aae2ca09f9d59525231392f6766ab6680d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49cd0d871b7e396bb231a6c9fa694153b2c2b56c0f6a6b96f1fc91adba3bb08a0966303e78c9369d31abb9791d79177a9ff6ceed552e3b3e7c26e4fa3e464af6
|
7
|
+
data.tar.gz: 4ca05283e96a19e3bde8443df8d15689e4e32e9ea6be21133e243032349079c18cf634b1f95878bf8a182d017a299fe073193ed7ed314cadefadf80b2c809c19
|
@@ -43,7 +43,14 @@ module Phantom
|
|
43
43
|
def create_temporary_file(path, frame, width, height)
|
44
44
|
Parser::SVGWriter.new.write("#{path}.svg", frame)
|
45
45
|
|
46
|
-
handle = RSVG::Handle.
|
46
|
+
handle = RSVG::Handle.new
|
47
|
+
File.open("#{path}.svg", "rb") do |file|
|
48
|
+
buffer = ""
|
49
|
+
while file.read(8192, buffer)
|
50
|
+
handle.write(buffer)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
handle.close
|
47
54
|
Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32, width, height) do |surface|
|
48
55
|
Cairo::Context.new(surface) do |context|
|
49
56
|
context.scale(width.to_f / handle.dimensions.width,
|
@@ -53,7 +60,6 @@ module Phantom
|
|
53
60
|
surface.finish
|
54
61
|
end
|
55
62
|
end
|
56
|
-
handle.close
|
57
63
|
end
|
58
64
|
end # class PNGWriter
|
59
65
|
end # module Parser
|
data/phantom_svg.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.platform = Gem::Platform::RUBY
|
3
3
|
s.name = 'phantom_svg'
|
4
|
-
s.version = '1.1.
|
4
|
+
s.version = '1.1.8'
|
5
5
|
s.license = 'LGPL-3'
|
6
6
|
s.summary = 'Hight end SVG manipulation tools for Ruby'
|
7
7
|
s.description = 'Hight end SVG manipulation tools for Ruby.\n' \
|
@@ -18,6 +18,6 @@ Gem::Specification.new do |s|
|
|
18
18
|
|
19
19
|
s.add_dependency 'cairo', '~> 1.14', '~> 1.14.1'
|
20
20
|
s.add_dependency 'rapngasm', '~> 3.1', '~> 3.1.6'
|
21
|
-
s.add_dependency 'rsvg2', '~> 2.2', '~> 2.2.
|
22
|
-
s.add_dependency 'rmagick', '~> 2.
|
21
|
+
s.add_dependency 'rsvg2', '~> 2.2', '~> 2.2.5'
|
22
|
+
s.add_dependency 'rmagick', '~> 2.15', '~> 2.15.0'
|
23
23
|
end
|
data/spec/phantom/svg_spec.rb
CHANGED
@@ -601,48 +601,28 @@ describe Phantom::SVG::Base do
|
|
601
601
|
end
|
602
602
|
end
|
603
603
|
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
# end
|
629
|
-
|
630
|
-
# # it 'simple test' do
|
631
|
-
# # source = "#{@source_dir}/gradation_test/0.svg"
|
632
|
-
|
633
|
-
# # loop_count = 5000
|
634
|
-
# # print_interval = (loop_count / 100).to_i
|
635
|
-
# # cr_interval = (loop_count / 10).to_i
|
636
|
-
|
637
|
-
# # loop_count.times do |i|
|
638
|
-
# # handle = RSVG::Handle.new_from_file(source)
|
639
|
-
# # handle.close
|
640
|
-
|
641
|
-
# # GC.start
|
642
|
-
|
643
|
-
# # print '.' if ((i+1) % print_interval) == 0
|
644
|
-
# # print '|' if ((i+1) % cr_interval) == 0
|
645
|
-
# # end
|
646
|
-
# # end
|
647
|
-
# end
|
604
|
+
describe 'leak test' do
|
605
|
+
before(:all) do
|
606
|
+
@source_dir = SPEC_SOURCE_DIR
|
607
|
+
@destination_dir = SPEC_TEMP_DIR
|
608
|
+
end
|
609
|
+
|
610
|
+
xit 'consecutively save_apng' do
|
611
|
+
source = "#{@source_dir}/gradation_test/animation.json"
|
612
|
+
destination = "#{@destination_dir}/leak_test.png"
|
613
|
+
|
614
|
+
loop_count = 300
|
615
|
+
print_interval = (loop_count / 100).to_i
|
616
|
+
cr_interval = (loop_count / 10).to_i
|
617
|
+
|
618
|
+
loop_count.times do |i|
|
619
|
+
loader = Phantom::SVG::Base.new(source)
|
620
|
+
loader.save_apng(destination)
|
621
|
+
loader = nil
|
622
|
+
|
623
|
+
print '.' if ((i+1) % print_interval) == 0
|
624
|
+
print '|' if ((i+1) % cr_interval) == 0
|
625
|
+
end
|
626
|
+
end
|
627
|
+
end
|
648
628
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phantom_svg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rika Yoshida
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-05-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: cairo
|
@@ -61,7 +61,7 @@ dependencies:
|
|
61
61
|
version: '2.2'
|
62
62
|
- - "~>"
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: 2.2.
|
64
|
+
version: 2.2.5
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -71,27 +71,27 @@ dependencies:
|
|
71
71
|
version: '2.2'
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 2.2.
|
74
|
+
version: 2.2.5
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: rmagick
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '2.
|
81
|
+
version: '2.15'
|
82
82
|
- - "~>"
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: 2.
|
84
|
+
version: 2.15.0
|
85
85
|
type: :runtime
|
86
86
|
prerelease: false
|
87
87
|
version_requirements: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
89
|
- - "~>"
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version: '2.
|
91
|
+
version: '2.15'
|
92
92
|
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version: 2.
|
94
|
+
version: 2.15.0
|
95
95
|
description: Hight end SVG manipulation tools for Ruby.\nIncludes chained keyframe
|
96
96
|
generation, (A)PNG conversion and more.
|
97
97
|
email: info@genshin.org
|
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
215
|
requirements:
|
216
216
|
- libapngasm
|
217
217
|
rubyforge_project:
|
218
|
-
rubygems_version: 2.4.
|
218
|
+
rubygems_version: 2.4.6
|
219
219
|
signing_key:
|
220
220
|
specification_version: 4
|
221
221
|
summary: Hight end SVG manipulation tools for Ruby
|