Skip to content
Browse files

Using Node#memorise

  • Loading branch information...
1 parent 5e66dba commit 8dcb93a18579a4bdad6cefbe49195f382a9b1ba5 @wedesoft committed Dec 20, 2010
Showing with 11 additions and 13 deletions.
  1. +5 −5 Rakefile
  2. +1 −2 lib/hornetseye-xorg/opengloutput.rb
  3. +4 −4 lib/hornetseye-xorg/x11display.rb
  4. +1 −2 lib/hornetseye-xorg/ximageoutput.rb
View
10 Rakefile
@@ -7,7 +7,7 @@ require 'rake/loaders/makefile'
require 'rbconfig'
PKG_NAME = 'hornetseye-xorg'
-PKG_VERSION = '0.3.1'
+PKG_VERSION = '0.5.0'
CFG = RbConfig::CONFIG
CXX = ENV[ 'CXX' ] || 'g++'
RB_FILES = FileList[ 'lib/**/*.rb' ]
@@ -115,8 +115,8 @@ begin
s.extra_rdoc_files = []
s.rdoc_options = %w{--no-private}
s.add_dependency %<malloc>, [ '~> 1.1' ]
- s.add_dependency %<multiarray>, [ '~> 0.9' ]
- s.add_dependency %<hornetseye-frame>, [ '~> 0.6' ]
+ s.add_dependency %<multiarray>, [ '~> 0.15' ]
+ s.add_dependency %<hornetseye-frame>, [ '~> 0.9' ]
s.add_development_dependency %q{rake}
end
GEM_SOURCE = "#{PKG_NAME}-#{PKG_VERSION}.gem"
@@ -138,8 +138,8 @@ begin
s.extra_rdoc_files = []
s.rdoc_options = %w{--no-private}
s.add_dependency %<malloc>, [ '~> 1.1' ]
- s.add_dependency %<multiarray>, [ '~> 0.9' ]
- s.add_dependency %<hornetseye-frame>, [ '~> 0.6' ]
+ s.add_dependency %<multiarray>, [ '~> 0.15' ]
+ s.add_dependency %<hornetseye-frame>, [ '~> 0.9' ]
end
GEM_BINARY = "#{PKG_NAME}-#{PKG_VERSION}-#{$BINSPEC.platform}.gem"
desc "Build the gem file #{GEM_SOURCE}"
View
3 lib/hornetseye-xorg/opengloutput.rb
@@ -21,8 +21,7 @@ class OpenGLOutput
def write( frame )
target = frame.rgb? ? UBYTERGB : UBYTE
- frame = frame.to_type target unless frame.typecode == target
- super frame
+ super frame.to_type( target ).memorise
end
end
View
8 lib/hornetseye-xorg/x11display.rb
@@ -37,7 +37,7 @@ def show( *args, &action )
frame, width, height = *args
width ||= frame.width
height ||= ( width.to_f * frame.height / frame.width ).round
- display = new
+ display = options[ :display ] || new
output = options[ :output ].new
output.write frame
window = X11Window.new display, output, width, height
@@ -51,10 +51,10 @@ def show( *args, &action )
frame
else
width, height = *args
- result = action.call
+ display = options[ :display ] || new
+ result = action.call display
width ||= result.shape[0]
height ||= ( width.to_f * result.shape[1] / result.shape[0] ).round
- display = new
output = options[ :output ].new
window = X11Window.new display, output, width, height
window.title = options[ :title ]
@@ -71,7 +71,7 @@ def show( *args, &action )
display.process_events
end
break unless display.status?
- result = action.call
+ result = action.call display
end
ensure
window.close
View
3 lib/hornetseye-xorg/ximageoutput.rb
@@ -20,8 +20,7 @@ module Hornetseye
class XImageOutput
def write( frame )
- frame = frame.to_type UBYTERGB unless frame.typecode == UBYTERGB
- super frame
+ super frame.to_type( UBYTERGB ).memorise
end
end

0 comments on commit 8dcb93a

Please sign in to comment.
Something went wrong with that request. Please try again.