Skip to content
Browse files

CavasRendered.roundPixels can now be set from options

  • Loading branch information...
1 parent 10271cb commit d67ad1748ad04b4fc2b4a23fb4870d05b8ffb8d0 @tiriana tiriana committed
Showing with 6 additions and 2 deletions.
  1. +3 −0 .gitignore
  2. +3 −2 src/core/renderers/canvas/CanvasRenderer.js
View
3 .gitignore
@@ -24,3 +24,6 @@ npm-debug.log
node_modules
docs/
examples_old/
+
+# jetBrains IDE ignores
+.idea
View
5 src/core/renderers/canvas/CanvasRenderer.js
@@ -21,6 +21,7 @@ var SystemRenderer = require('../SystemRenderer'),
* @param [options.resolution=1] {number} the resolution of the renderer retina would be 2
* @param [options.clearBeforeRender=true] {boolean} This sets if the CanvasRenderer will clear the canvas or
* not before the new render pass.
+ * @param [options.roundPixels=false] {boolean} If true Pixi will Math.floor() x/y values when rendering, stopping pixel interpolation.
*/
function CanvasRenderer(width, height, options)
{
@@ -55,7 +56,7 @@ function CanvasRenderer(width, height, options)
*
* @member {boolean}
*/
- this.roundPixels = false;
+ this.roundPixels = options.roundPixels === true;
/**
* Tracks the active scale mode for this renderer.
@@ -219,7 +220,7 @@ CanvasRenderer.prototype.resize = function (w, h)
//reset the scale mode.. oddly this seems to be reset when the canvas is resized.
//surely a browser bug?? Let pixi fix that for you..
this.currentScaleMode = CONST.SCALE_MODES.DEFAULT;
-
+
if(this.smoothProperty)
{
this.context[this.smoothProperty] = (this.currentScaleMode === CONST.SCALE_MODES.LINEAR);

0 comments on commit d67ad17

Please sign in to comment.
Something went wrong with that request. Please try again.