Skip to content

Commit

Permalink
Merge pull request #9 from danielbwatson/aspectFix
Browse files Browse the repository at this point in the history
Fixed face aspect ratio stretching.
  • Loading branch information
danielbwatson committed Mar 27, 2012
2 parents e226a61 + 34e61a6 commit 1c478e7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/webapp/scripts/html5player.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,25 @@ steal( '../lib/jquery',

$('canvas').dblclick(function() {
config.largeFace = !config.largeFace;
primaryCtx.clearRect(0, 0, primary.width, primary.height);
});

renderFrame = function() {
var primarySource, secondarySource;
var primarySource, secondarySource, width;

if (config.largeFace) {
primarySource = config.secondary;
secondarySource = config.primary;
width = config.primary.h * (config.secondary.w / config.secondary.h);
} else {
primarySource = config.primary;
secondarySource = config.secondary;
width = primarySource.w;
}

// Render a slice into the primary canvas.
primaryCtx.drawImage(video, primarySource.x, primarySource.y, primarySource.w, primarySource.h,
0, 0, config.primary.w, config.primary.h);
0, 0, width, config.primary.h);

secondaryCtx.drawImage(video, secondarySource.x, secondarySource.y, secondarySource.w, secondarySource.h,
0, 0, config.secondary.w, config.secondary.h);
Expand Down

0 comments on commit 1c478e7

Please sign in to comment.