phantom_svg 1.1.5 → 1.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48bf0ef07eb30630badd79f40f4ad0fbfe931aef
4
- data.tar.gz: 07bf143c218de8e5faa02fa8cbee553d3824f9dd
3
+ metadata.gz: 0ed311e5c5b6787b8984e939a0cd48a2ec06671e
4
+ data.tar.gz: fe58f330e16bc38f061a3465a35ba2ce889398b7
5
5
  SHA512:
6
- metadata.gz: 33fff8e8ae8734aa6962766d11afbe8f0634ef7905e505b92a04f8003950aed08f21ec3a1d703e9f67b2c730fd15b087644b1a739fa8ebe3f1f0ce80583dd3db
7
- data.tar.gz: 965c26886716b1ee3326d168e795968317a6da0b8c5fa57ffdd3524311479462ef30e406a74c36e6ed65a742fab803f467c5bef24755dbb018f89371baceedee
6
+ metadata.gz: c0701c8cb58da9f3a988d8f85d4bcf84fac1819ce9a44c7c10de085b69d23c81c0f652416b4b24e28cf45bd2a73e54a174837ae1c66026eb0c5f5ab8f788a7d1
7
+ data.tar.gz: a151651bbb47d559781c53e3d1b6fc9e00bdb3acb448650cb224374f0fd6575369c722356240664dda2b1cd27bbdf65cfb4d44ddc4a45d2783100ec8f4e2168f
@@ -44,13 +44,16 @@ module Phantom
44
44
  Parser::SVGWriter.new.write("#{path}.svg", frame)
45
45
 
46
46
  handle = RSVG::Handle.new_from_file("#{path}.svg")
47
- surface = Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32, width, height)
48
- context = Cairo::Context.new(surface)
49
- context.scale(width.to_f / handle.dimensions.width,
50
- height.to_f / handle.dimensions.height)
51
- context.render_rsvg_handle(handle)
52
- surface.write_to_png("#{path}.png")
53
- surface.finish
47
+ Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32, width, height) do |surface|
48
+ Cairo::Context.new(surface) do |context|
49
+ context.scale(width.to_f / handle.dimensions.width,
50
+ height.to_f / handle.dimensions.height)
51
+ context.render_rsvg_handle(handle)
52
+ surface.write_to_png("#{path}.png")
53
+ surface.finish
54
+ end
55
+ end
56
+ handle.close
54
57
  end
55
58
  end # class PNGWriter
56
59
  end # module Parser
@@ -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.5'
4
+ s.version = '1.1.6'
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' \
@@ -600,4 +600,49 @@ describe Phantom::SVG::Base do
600
600
  @loader.save_svg(destination)
601
601
  end
602
602
  end
603
+
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
+ # it '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
+ # loader = Phantom::SVG::Base.new(source)
619
+
620
+ # loop_count.times do |i|
621
+ # loader.save_apng(destination)
622
+
623
+ # GC.start
624
+
625
+ # print '.' if ((i+1) % print_interval) == 0
626
+ # print '|' if ((i+1) % cr_interval) == 0
627
+ # end
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
603
648
  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.5
4
+ version: 1.1.6
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-01-07 00:00:00.000000000 Z
13
+ date: 2015-03-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cairo