Skip to content

Commit

Permalink
Only setting the canvas.style when devicePixelRatio !== 1.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Apr 17, 2013
1 parent b7a450e commit 198ddcb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/renderers/CanvasRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ THREE.CanvasRenderer = function ( parameters ) {
_canvas.width = _canvasWidth;
_canvas.height = _canvasHeight;

if ( updateStyle !== false ) {
if ( this.devicePixelRatio !== 1 && updateStyle !== false ) {

_canvas.style.width = width + 'px';
_canvas.style.height = height + 'px';
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ THREE.WebGLRenderer = function ( parameters ) {
_canvas.width = width * this.devicePixelRatio;
_canvas.height = height * this.devicePixelRatio;

if ( updateStyle !== false ) {
if ( this.devicePixelRatio !== 1 && updateStyle !== false ) {

_canvas.style.width = width + 'px';
_canvas.style.height = height + 'px';
Expand Down
8 changes: 7 additions & 1 deletion src/renderers/WebGLRenderer3.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ THREE.WebGLRenderer3 = function ( parameters ) {

var canvas = parameters.canvas !== undefined ? parameters.canvas : document.createElement( 'canvas' );

var devicePixelRatio = parameters.devicePixelRatio !== undefined
? parameters.devicePixelRatio
: window.devicePixelRatio !== undefined
? window.devicePixelRatio
: 1;

var gl;

try {
Expand Down Expand Up @@ -242,7 +248,7 @@ THREE.WebGLRenderer3 = function ( parameters ) {
canvas.width = width;
canvas.height = height;

if ( updateStyle !== false ) {
if ( devicePixelRatio !== 1 && updateStyle !== false ) {

canvas.style.width = width + 'px';
canvas.style.height = height + 'px';
Expand Down

0 comments on commit 198ddcb

Please sign in to comment.