Skip to content

Commit 61d4253

Browse files
committed
PDFBOX-5660: optimize, as suggested by Valery Bokov; closes #301
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1929424 13f79535-47bb-0310-9956-ffa450edef68
1 parent fc048bd commit 61d4253

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceGray.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public BufferedImage toRGBImage(WritableRaster raster) throws IOException
8484
int height = raster.getHeight();
8585

8686
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
87+
WritableRaster dstRaster = image.getRaster();
8788

8889
int[] gray = new int[1];
8990
int[] rgb = new int[3];
@@ -95,7 +96,7 @@ public BufferedImage toRGBImage(WritableRaster raster) throws IOException
9596
rgb[0] = gray[0];
9697
rgb[1] = gray[0];
9798
rgb[2] = gray[0];
98-
image.getRaster().setPixel(x, y, rgb);
99+
dstRaster.setPixel(x, y, rgb);
99100
}
100101
}
101102

0 commit comments

Comments
 (0)