Skip to content

Commit 451656c

Browse files
committed
Use getXRound and getYRound
1 parent c8cdf9f commit 451656c

1 file changed

Lines changed: 19 additions & 45 deletions

File tree

src/renderer/webgl/pipelines/MultiPipeline.js

Lines changed: 19 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -272,17 +272,19 @@ var MultiPipeline = new Class({
272272
var xw = x + frameWidth;
273273
var yh = y + frameHeight;
274274

275-
var tx0 = calcMatrix.getX(x, y);
276-
var ty0 = calcMatrix.getY(x, y);
275+
var roundPixels = camera.roundPixels;
277276

278-
var tx1 = calcMatrix.getX(x, yh);
279-
var ty1 = calcMatrix.getY(x, yh);
277+
var tx0 = calcMatrix.getXRound(x, y, roundPixels);
278+
var ty0 = calcMatrix.getYRound(x, y, roundPixels);
280279

281-
var tx2 = calcMatrix.getX(xw, yh);
282-
var ty2 = calcMatrix.getY(xw, yh);
280+
var tx1 = calcMatrix.getXRound(x, yh, roundPixels);
281+
var ty1 = calcMatrix.getYRound(x, yh, roundPixels);
283282

284-
var tx3 = calcMatrix.getX(xw, y);
285-
var ty3 = calcMatrix.getY(xw, y);
283+
var tx2 = calcMatrix.getXRound(xw, yh, roundPixels);
284+
var ty2 = calcMatrix.getYRound(xw, yh, roundPixels);
285+
286+
var tx3 = calcMatrix.getXRound(xw, y, roundPixels);
287+
var ty3 = calcMatrix.getYRound(xw, y, roundPixels);
286288

287289
var getTint = Utils.getTintAppendFloatAlpha;
288290
var cameraAlpha = camera.alpha;
@@ -292,21 +294,6 @@ var MultiPipeline = new Class({
292294
var tintBL = getTint(gameObject.tintBottomLeft, cameraAlpha * gameObject._alphaBL);
293295
var tintBR = getTint(gameObject.tintBottomRight, cameraAlpha * gameObject._alphaBR);
294296

295-
if (camera.roundPixels)
296-
{
297-
tx0 = Math.round(tx0);
298-
ty0 = Math.round(ty0);
299-
300-
tx1 = Math.round(tx1);
301-
ty1 = Math.round(ty1);
302-
303-
tx2 = Math.round(tx2);
304-
ty2 = Math.round(ty2);
305-
306-
tx3 = Math.round(tx3);
307-
ty3 = Math.round(ty3);
308-
}
309-
310297
if (this.shouldFlush(6))
311298
{
312299
this.flush();
@@ -474,32 +461,19 @@ var MultiPipeline = new Class({
474461
// Multiply by the Sprite matrix, store result in calcMatrix
475462
camMatrix.multiply(spriteMatrix, calcMatrix);
476463

477-
var tx0 = calcMatrix.getX(x, y);
478-
var ty0 = calcMatrix.getY(x, y);
479-
480-
var tx1 = calcMatrix.getX(x, yh);
481-
var ty1 = calcMatrix.getY(x, yh);
482-
483-
var tx2 = calcMatrix.getX(xw, yh);
484-
var ty2 = calcMatrix.getY(xw, yh);
464+
var roundPixels = camera.roundPixels;
485465

486-
var tx3 = calcMatrix.getX(xw, y);
487-
var ty3 = calcMatrix.getY(xw, y);
466+
var tx0 = calcMatrix.getXRound(x, y, roundPixels);
467+
var ty0 = calcMatrix.getYRound(x, y, roundPixels);
488468

489-
if (camera.roundPixels)
490-
{
491-
tx0 = Math.round(tx0);
492-
ty0 = Math.round(ty0);
493-
494-
tx1 = Math.round(tx1);
495-
ty1 = Math.round(ty1);
469+
var tx1 = calcMatrix.getXRound(x, yh, roundPixels);
470+
var ty1 = calcMatrix.getYRound(x, yh, roundPixels);
496471

497-
tx2 = Math.round(tx2);
498-
ty2 = Math.round(ty2);
472+
var tx2 = calcMatrix.getXRound(xw, yh, roundPixels);
473+
var ty2 = calcMatrix.getYRound(xw, yh, roundPixels);
499474

500-
tx3 = Math.round(tx3);
501-
ty3 = Math.round(ty3);
502-
}
475+
var tx3 = calcMatrix.getXRound(xw, y, roundPixels);
476+
var ty3 = calcMatrix.getYRound(xw, y, roundPixels);
503477

504478
if (textureUnit === undefined)
505479
{

0 commit comments

Comments
 (0)