Skip to content

Commit

Permalink
Add _maxPixelRatio setting to view
Browse files Browse the repository at this point in the history
  • Loading branch information
pandamicro committed Feb 3, 2019
1 parent 04151c6 commit 4ed900e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cocos2d/core/platform/CCView.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ var View = function () {
_t._autoFullScreen = false;
// The device's pixel ratio (for retina displays)
_t._devicePixelRatio = 1;
_t._maxPixelRatio = 2;
// Retina disabled by default
_t._retinaEnabled = false;
// Custom callback for resize event
Expand Down Expand Up @@ -1083,7 +1084,7 @@ cc.ContainerStrategy = cc.Class({
// Setup pixel ratio for retina display
var devicePixelRatio = view._devicePixelRatio = 1;
if (view.isRetinaEnabled())
devicePixelRatio = view._devicePixelRatio = Math.min(2, window.devicePixelRatio || 1);
devicePixelRatio = view._devicePixelRatio = Math.min(view._maxPixelRatio, window.devicePixelRatio || 1);
// Setup canvas
locCanvas.width = w * devicePixelRatio;
locCanvas.height = h * devicePixelRatio;
Expand Down

0 comments on commit 4ed900e

Please sign in to comment.