8320097: Improve Image transformations

Reviewed-by: jdv, psadhukhan, aivanov, rhalade
This commit is contained in:
Phil Race 2024-03-29 17:40:00 +00:00 committed by Jaikiran Pai
parent 553f21ae53
commit 8cc84bf71e
2 changed files with 10 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -369,6 +369,13 @@ public class DrawImage implements DrawImagePipe
final AffineTransform itx;
try {
itx = tx.createInverse();
double[] mat = new double[6];
itx.getMatrix(mat);
for (double d : mat) {
if (!Double.isFinite(d)) {
return;
}
}
} catch (final NoninvertibleTransformException ignored) {
// Non-invertible transform means no output
return;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -120,7 +120,7 @@ TransformInterpFunc *pBicubicFunc = BicubicInterp;
/* We reject coordinates not less than 1<<30 so that the distance between */
/* any 2 of them is less than 1<<31 which would overflow into the sign */
/* bit of a signed long value used to represent fixed point coordinates. */
#define TX_FIXED_UNSAFE(v) (fabs(v) >= (1<<30))
#define TX_FIXED_UNSAFE(v) (isinf(v) || isnan(v) || fabs(v) >= (1<<30))
static jboolean
checkOverflow(jint dxoff, jint dyoff,
SurfaceDataBounds *pBounds,