mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 14:40:38 +00:00
The CanvasRenderer.BlitImage
function has been removed, as has the associated blitImage
property from the Canvas Renderer as they're no longer used.
This commit is contained in:
parent
fbb67ac201
commit
26cc84522d
4 changed files with 20 additions and 60 deletions
|
@ -140,6 +140,7 @@ The Tile Sprite Game Object has been given an internal overhaul to make it more
|
||||||
* You can now specify the `lineHeight` of a Retro Font in the Retro Font Config object (thanks @FelixNemis)
|
* You can now specify the `lineHeight` of a Retro Font in the Retro Font Config object (thanks @FelixNemis)
|
||||||
* When a Static Tilemap Layer is generated in WebGL it will use the Cameras `roundPixels` value to clamp the tile coordinates.
|
* When a Static Tilemap Layer is generated in WebGL it will use the Cameras `roundPixels` value to clamp the tile coordinates.
|
||||||
* The `CanvasRenderer.DrawImage` function has been removed, as has the associated `drawImage` property from the Canvas Renderer as they're no longer used.
|
* The `CanvasRenderer.DrawImage` function has been removed, as has the associated `drawImage` property from the Canvas Renderer as they're no longer used.
|
||||||
|
* The `CanvasRenderer.BlitImage` function has been removed, as has the associated `blitImage` property from the Canvas Renderer as they're no longer used.
|
||||||
|
|
||||||
### Game Config Resolution Specific Bug Fixes
|
### Game Config Resolution Specific Bug Fixes
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,8 @@ var BlitterCanvasRenderer = function (renderer, src, interpolationPercentage, ca
|
||||||
parentMatrix.copyToContext(ctx);
|
parentMatrix.copyToContext(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var roundPixels = camera.roundPixels;
|
||||||
|
|
||||||
// Render bobs
|
// Render bobs
|
||||||
for (var i = 0; i < list.length; i++)
|
for (var i = 0; i < list.length; i++)
|
||||||
{
|
{
|
||||||
|
@ -74,7 +76,23 @@ var BlitterCanvasRenderer = function (renderer, src, interpolationPercentage, ca
|
||||||
|
|
||||||
if (!flip)
|
if (!flip)
|
||||||
{
|
{
|
||||||
renderer.blitImage(dx + bob.x + cameraScrollX, dy + bob.y + cameraScrollY, bob.frame);
|
if (roundPixels)
|
||||||
|
{
|
||||||
|
dx |= 0;
|
||||||
|
dy |= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.drawImage(
|
||||||
|
frame.source.image,
|
||||||
|
cd.x,
|
||||||
|
cd.y,
|
||||||
|
cd.width,
|
||||||
|
cd.height,
|
||||||
|
dx + bob.x + cameraScrollX,
|
||||||
|
dy + bob.y + cameraScrollY,
|
||||||
|
cd.width,
|
||||||
|
cd.height
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -129,15 +129,6 @@ var CanvasRenderer = new Class({
|
||||||
*/
|
*/
|
||||||
this.currentContext = this.gameContext;
|
this.currentContext = this.gameContext;
|
||||||
|
|
||||||
/**
|
|
||||||
* [description]
|
|
||||||
*
|
|
||||||
* @name Phaser.Renderer.Canvas.CanvasRenderer#blitImage
|
|
||||||
* @type {function}
|
|
||||||
* @since 3.0.0
|
|
||||||
*/
|
|
||||||
this.blitImage = BlitImage(this.config.roundPixels);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* [description]
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
/**
|
|
||||||
* @author Richard Davey <rich@photonstorm.com>
|
|
||||||
* @copyright 2018 Photon Storm Ltd.
|
|
||||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
||||||
*/
|
|
||||||
|
|
||||||
var roundPixels = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No scaling, anchor, rotation or effects, literally draws the frame directly to the canvas.
|
|
||||||
*
|
|
||||||
* @function Phaser.Renderer.Canvas.BlitImage
|
|
||||||
* @since 3.0.0
|
|
||||||
*
|
|
||||||
* @param {number} dx - The x coordinate to render the Frame to.
|
|
||||||
* @param {number} dy - The y coordinate to render the Frame to.
|
|
||||||
* @param {Phaser.Textures.Frame} frame - The Frame to render.
|
|
||||||
*/
|
|
||||||
var BlitImage = function (dx, dy, frame)
|
|
||||||
{
|
|
||||||
var ctx = this.currentContext;
|
|
||||||
var cd = frame.canvasData;
|
|
||||||
|
|
||||||
if (roundPixels)
|
|
||||||
{
|
|
||||||
dx |= 0;
|
|
||||||
dy |= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.drawImage(
|
|
||||||
frame.source.image,
|
|
||||||
cd.x,
|
|
||||||
cd.y,
|
|
||||||
cd.width,
|
|
||||||
cd.height,
|
|
||||||
dx,
|
|
||||||
dy,
|
|
||||||
cd.width,
|
|
||||||
cd.height
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Special return so we can store the config value locally
|
|
||||||
|
|
||||||
module.exports = function (configRoundPixels)
|
|
||||||
{
|
|
||||||
roundPixels = configRoundPixels;
|
|
||||||
|
|
||||||
return BlitImage;
|
|
||||||
};
|
|
Loading…
Reference in a new issue