Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Using new version of frame.cc and frame.hh

  • Loading branch information...
commit 2970494a56b968de8546dff6c0c62898cd47a86a 1 parent b6e5890
@wedesoft authored
Showing with 11 additions and 3 deletions.
  1. +10 −3 ext/frame.cc
  2. +1 −0  ext/frame.hh
View
13 ext/frame.cc
@@ -23,9 +23,7 @@ Frame::Frame( const string &typecode, int width, int height, char *data ):
VALUE mModule = rb_define_module( "Hornetseye" );
VALUE cMalloc = rb_define_class_under( mModule, "Malloc", rb_cObject );
VALUE cFrame = rb_define_class_under( mModule, "Frame", rb_cObject );
- VALUE rbSize = rb_funcall( cFrame, rb_intern( "storage_size" ), 3,
- rb_const_get( mModule, rb_intern( typecode.c_str() ) ),
- INT2NUM( width ), INT2NUM( height ) );
+ VALUE rbSize = INT2NUM( storageSize( typecode, width, height ) );
VALUE rbMemory;
if ( data != NULL ) {
rbMemory = Data_Wrap_Struct( cMalloc, 0, 0, (void *)data );
@@ -67,3 +65,12 @@ void Frame::markRubyMember(void)
rb_gc_mark( m_frame );
}
+int Frame::storageSize( const std::string &typecode, int width, int height )
+{
+ VALUE mModule = rb_define_module( "Hornetseye" );
+ VALUE cFrame = rb_define_class_under( mModule, "Frame", rb_cObject );
+ return NUM2INT( rb_funcall( cFrame, rb_intern( "storage_size" ), 3,
+ rb_const_get( mModule, rb_intern( typecode.c_str() ) ),
+ INT2NUM( width ), INT2NUM( height ) ) );
+}
+
View
1  ext/frame.hh
@@ -32,6 +32,7 @@ public:
char *data(void);
VALUE rubyObject(void) { return m_frame; }
void markRubyMember(void);
+ static int storageSize( const std::string &typecode, int width, int height );
protected:
VALUE m_frame;
};
Please sign in to comment.
Something went wrong with that request. Please try again.