Skip to content

Commit

Permalink
PDFBOX-5852: don't create an unused array
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1920945 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
lehmi committed Sep 26, 2024
1 parent d9fe5fc commit 69ba6dd
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,12 @@ private double getArea(Point2D a, Point2D b, Point2D c)
public float[] calcColor(Point2D p)
{
int numberOfColorComponents = color[0].length;
float[] pCol = new float[numberOfColorComponents];
float[] pCol = null;

switch (degree)
{
case 1:
pCol = new float[numberOfColorComponents];
for (int i = 0; i < numberOfColorComponents; i++)
{
// average
Expand All @@ -246,8 +247,10 @@ public float[] calcColor(Point2D p)
case 2:
// linear interpolation
Point tp = new Point((int) Math.round(p.getX()), (int) Math.round(p.getY()));
return line.calcColor(tp);
pCol = line.calcColor(tp);
break;
default:
pCol = new float[numberOfColorComponents];
float aw = (float) (getArea(p, corner[1], corner[2]) / area);
float bw = (float) (getArea(p, corner[2], corner[0]) / area);
float cw = (float) (getArea(p, corner[0], corner[1]) / area);
Expand Down

0 comments on commit 69ba6dd

Please sign in to comment.