Skip to content

Commit

Permalink
bump version, code styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciro S. Costa committed Aug 21, 2014
1 parent e39df7f commit 90f1810
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 44 deletions.
2 changes: 1 addition & 1 deletion bower.json
Expand Up @@ -2,7 +2,7 @@
"name": "qcode-decoder",
"main": "build/main.min.js",
"description": "Decodes QRCode in the browser and node",
"version": "0.0.4",
"version": "0.0.5",
"homepage": "https://github.com/cirocosta/qcode-decoder",
"authors": [
"Ciro S. Costa <ciro.costa@usp.br>"
Expand Down
43 changes: 26 additions & 17 deletions build/qcode-decoder.js
Expand Up @@ -3837,16 +3837,19 @@ function QRCodeDecoder () {
}

/**
* Prepares the canvas element (which will receive the image from the
* camera and provide what the algorithm needs for checking for a
* Prepares the canvas element (which will
* receive the image from the camera and provide
* what the algorithm needs for checking for a
* QRCode and then decoding it.)
* @param {DOMElement} canvasElem the canvas element
* @param {number} width The width that the canvas element
* should have
* @param {number} height The height that the canvas element
* should have
* @return {DOMElement} the canvas after the resize if
* width and height provided.
* @param {DOMElement} canvasElem the canvas
* element
* @param {number} width The width that
* the canvas element should have
* @param {number} height The height that
* the canvas element should have
* @return {DOMElement} the canvas
* after the resize if width and height
* provided.
*/
QRCodeDecoder.prototype.prepareCanvas = function (canvasElem, width, height) {
if (width && height) {
Expand All @@ -3864,16 +3867,18 @@ QRCodeDecoder.prototype.prepareCanvas = function (canvasElem, width, height) {

QRCodeDecoder.prototype._captureToCanvas = function () {
var scope = this;
var cWidth = this.canvasElem.width;
var cHeight = this.canvasElem.height;

if (this.tmrCapture) {
clearTimeout(this.tmrCapture);
}

var gCtx = this.canvasElem.getContext("2d");
gCtx.clearRect(0, 0, this.canvasElem.width, this.canvasElem.height);
gCtx.clearRect(0, 0, cWidth, cHeight);

try{
gCtx.drawImage(this.videoElem,0,0,this.canvasElem.width,this.canvasElem.height);
gCtx.drawImage(this.videoElem, 0, 0,cWidth,cHeight);
try{
qrcode.decode();
}
Expand All @@ -3893,7 +3898,8 @@ QRCodeDecoder.prototype._captureToCanvas = function () {
};

/**
* Verifies if the user has getUserMedia enabled in the browser.
* Verifies if the user has getUserMedia enabled
* in the browser.
*/
QRCodeDecoder.prototype.hasGetUserMedia = function () {
return !!(navigator.getUserMedia || navigator.webkitGetUserMedia ||
Expand All @@ -3910,10 +3916,12 @@ QRCodeDecoder.prototype.isCanvasSupported = function () {
};

/**
* Prepares the video element for receiving camera's input.
* @param {DOMElement} videoElem <video> dom element
* @param {Function} errcb callback function to be called in case
* of error
* Prepares the video element for receiving
* camera's input.
* @param {DOMElement} videoElem <video> dom
* element
* @param {Function} errcb callback
* function to be called in case of error
*/
QRCodeDecoder.prototype.prepareVideo = function(videoElem, errcb) {
var scope = this;
Expand Down Expand Up @@ -3942,7 +3950,8 @@ QRCodeDecoder.prototype.prepareVideo = function(videoElem, errcb) {
};

/**
* Releases a video stream that was being captured by prepareToVideo
* Releases a video stream that was being
* captured by prepareToVideo
*/
QRCodeDecoder.prototype.releaseVideo = function() {
this.stream.stop();
Expand Down
2 changes: 1 addition & 1 deletion build/qcode-decoder.min.js

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions gulpfile.js
Expand Up @@ -46,10 +46,6 @@ gulp.task('build', ['build-vendor'], function() {
.pipe(gulp.dest('build'));
});

// /**
// * Hinting and testing
// */

gulp.task('hint', function () {
return gulp.src('src/*.js')
.pipe(jshint())
Expand Down
5 changes: 1 addition & 4 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "qcode-decoder",
"version": "0.0.4",
"version": "0.0.5",
"description": "Decodes QRCode in the Browser and Node",
"main": "index.js",
"directories": {
Expand All @@ -11,9 +11,6 @@
"type": "git",
"url": "https://github.com/cirocosta/qcode-decoder.git"
},
"scripts": {
"test": "gulp test"
},
"author": "Ciro S. Costa <ciro9758@gmail.com> (http://cirocosta.github.io/)",
"license": "MIT",
"bugs": {
Expand Down
43 changes: 26 additions & 17 deletions src/qcode-decoder.js
Expand Up @@ -7,16 +7,19 @@ function QRCodeDecoder () {
}

/**
* Prepares the canvas element (which will receive the image from the
* camera and provide what the algorithm needs for checking for a
* Prepares the canvas element (which will
* receive the image from the camera and provide
* what the algorithm needs for checking for a
* QRCode and then decoding it.)
* @param {DOMElement} canvasElem the canvas element
* @param {number} width The width that the canvas element
* should have
* @param {number} height The height that the canvas element
* should have
* @return {DOMElement} the canvas after the resize if
* width and height provided.
* @param {DOMElement} canvasElem the canvas
* element
* @param {number} width The width that
* the canvas element should have
* @param {number} height The height that
* the canvas element should have
* @return {DOMElement} the canvas
* after the resize if width and height
* provided.
*/
QRCodeDecoder.prototype.prepareCanvas = function (canvasElem, width, height) {
if (width && height) {
Expand All @@ -34,16 +37,18 @@ QRCodeDecoder.prototype.prepareCanvas = function (canvasElem, width, height) {

QRCodeDecoder.prototype._captureToCanvas = function () {
var scope = this;
var cWidth = this.canvasElem.width;
var cHeight = this.canvasElem.height;

if (this.tmrCapture) {
clearTimeout(this.tmrCapture);
}

var gCtx = this.canvasElem.getContext("2d");
gCtx.clearRect(0, 0, this.canvasElem.width, this.canvasElem.height);
gCtx.clearRect(0, 0, cWidth, cHeight);

try{
gCtx.drawImage(this.videoElem,0,0,this.canvasElem.width,this.canvasElem.height);
gCtx.drawImage(this.videoElem, 0, 0,cWidth,cHeight);
try{
qrcode.decode();
}
Expand All @@ -63,7 +68,8 @@ QRCodeDecoder.prototype._captureToCanvas = function () {
};

/**
* Verifies if the user has getUserMedia enabled in the browser.
* Verifies if the user has getUserMedia enabled
* in the browser.
*/
QRCodeDecoder.prototype.hasGetUserMedia = function () {
return !!(navigator.getUserMedia || navigator.webkitGetUserMedia ||
Expand All @@ -80,10 +86,12 @@ QRCodeDecoder.prototype.isCanvasSupported = function () {
};

/**
* Prepares the video element for receiving camera's input.
* @param {DOMElement} videoElem <video> dom element
* @param {Function} errcb callback function to be called in case
* of error
* Prepares the video element for receiving
* camera's input.
* @param {DOMElement} videoElem <video> dom
* element
* @param {Function} errcb callback
* function to be called in case of error
*/
QRCodeDecoder.prototype.prepareVideo = function(videoElem, errcb) {
var scope = this;
Expand Down Expand Up @@ -112,7 +120,8 @@ QRCodeDecoder.prototype.prepareVideo = function(videoElem, errcb) {
};

/**
* Releases a video stream that was being captured by prepareToVideo
* Releases a video stream that was being
* captured by prepareToVideo
*/
QRCodeDecoder.prototype.releaseVideo = function() {
this.stream.stop();
Expand Down

0 comments on commit 90f1810

Please sign in to comment.