Permalink
Browse files

if toBuffer has a cb, run it async. re #21

  • Loading branch information...
1 parent ac6c685 commit d71b0ae7b3e84306c5646e09903afd452387dbe8 @peterbraden committed Nov 9, 2012
Showing with 6 additions and 2 deletions.
  1. +4 −0 src/Matrix.cc
  2. +2 −2 test/unit.js
View
@@ -304,6 +304,10 @@ Handle<Value>
Matrix::ToBuffer(const v8::Arguments& args){
SETUP_FUNCTION(Matrix)
+ if (args.Length() > 0){
+ return Matrix::ToBufferAsync(args);
+ }
+
std::vector<uchar> vec(0);
std::vector<int> params(0);//CV_IMWRITE_JPEG_QUALITY 90
View
@@ -138,12 +138,12 @@ vows.describe('Smoke Tests OpenCV').addBatch({
}
- , "toBufferAsync": {
+ , "toBuffer Async": {
topic: function(cv){
var buf = fs.readFileSync('./examples/mona.png')
, cb = this.callback
cv.readImage(buf.slice(0), function(err, mat){
- var buff = mat.toBufferAsync(function(){
+ var buff = mat.toBuffer(function(){
cb.apply(this, arguments)
})
})

0 comments on commit d71b0ae

Please sign in to comment.