Remove ratio arg from createHDCanvas()

This commit is contained in:
Riley Shaw 2015-02-18 11:38:49 -05:00
parent 66bc0836a3
commit 8d0210f1d4
3 changed files with 7 additions and 7 deletions

View File

@ -6,12 +6,12 @@ var createCanvasElement = function (width, height, cellSize, id, insertAfter, ba
// Creates a scaled-up canvas based on the device's // Creates a scaled-up canvas based on the device's
// resolution, then displays it properly using styles // resolution, then displays it properly using styles
function createHDCanvas (ratio) { function createHDCanvas () {
var canvas = document.createElement('canvas'); var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d'); var ctx = canvas.getContext('2d');
// Creates a dummy canvas to test device's pixel ratio // Creates a dummy canvas to test device's pixel ratio
ratio = (function () { var ratio = (function () {
var ctx = document.createElement('canvas').getContext('2d'); var ctx = document.createElement('canvas').getContext('2d');
var dpr = window.devicePixelRatio || 1; var dpr = window.devicePixelRatio || 1;
var bsr = ctx.webkitBackingStorePixelRatio || var bsr = ctx.webkitBackingStorePixelRatio ||
@ -26,7 +26,7 @@ var createCanvasElement = function (width, height, cellSize, id, insertAfter, ba
canvas.height = height * ratio; canvas.height = height * ratio;
canvas.style.width = width + 'px'; canvas.style.width = width + 'px';
canvas.style.height = height + 'px'; canvas.style.height = height + 'px';
ctx.setTransform(ratio, 0, 0, ratio, 0, 0); ctx.scale(ratio, ratio);
ctx.font = 'bold ' + cellSize + 'px Arial'; ctx.font = 'bold ' + cellSize + 'px Arial';
if (id) canvas.id = id; if (id) canvas.id = id;

6
dist/terra.js vendored
View File

@ -260,12 +260,12 @@ var createCanvasElement = function (width, height, cellSize, id, insertAfter, ba
// Creates a scaled-up canvas based on the device's // Creates a scaled-up canvas based on the device's
// resolution, then displays it properly using styles // resolution, then displays it properly using styles
function createHDCanvas (ratio) { function createHDCanvas () {
var canvas = document.createElement('canvas'); var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d'); var ctx = canvas.getContext('2d');
// Creates a dummy canvas to test device's pixel ratio // Creates a dummy canvas to test device's pixel ratio
ratio = (function () { var ratio = (function () {
var ctx = document.createElement('canvas').getContext('2d'); var ctx = document.createElement('canvas').getContext('2d');
var dpr = window.devicePixelRatio || 1; var dpr = window.devicePixelRatio || 1;
var bsr = ctx.webkitBackingStorePixelRatio || var bsr = ctx.webkitBackingStorePixelRatio ||
@ -280,7 +280,7 @@ var createCanvasElement = function (width, height, cellSize, id, insertAfter, ba
canvas.height = height * ratio; canvas.height = height * ratio;
canvas.style.width = width + 'px'; canvas.style.width = width + 'px';
canvas.style.height = height + 'px'; canvas.style.height = height + 'px';
ctx.setTransform(ratio, 0, 0, ratio, 0, 0); ctx.scale(ratio, ratio);
ctx.font = 'bold ' + cellSize + 'px Arial'; ctx.font = 'bold ' + cellSize + 'px Arial';
if (id) canvas.id = id; if (id) canvas.id = id;

2
dist/terra.min.js vendored

File diff suppressed because one or more lines are too long