Streamline the BufferedImage functionality in the compressor so that it works the same way as compressing a "normal" image, and deprecate the old BufferedImage methods and other redundant methods. Eliminate the use of deprecated features in the test programs.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1168 632fc199-4ca6-4c93-a231-07263d6284db
diff --git a/java/TJExample.java b/java/TJExample.java
index a4971a4..7562114 100644
--- a/java/TJExample.java
+++ b/java/TJExample.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C)2011-2012 D. R. Commander. All Rights Reserved.
+ * Copyright (C)2011-2012, 2014 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -324,11 +324,11 @@
tjc.setSubsamp(outSubsamp);
tjc.setJPEGQuality(outQual);
if (img != null)
- jpegBuf = tjc.compress(img, flags);
+ tjc.setSourceImage(img, 0, 0, 0, 0);
else {
- tjc.setSourceImage(bmpBuf, width, 0, height, TJ.PF_BGRX);
- jpegBuf = tjc.compress(flags);
+ tjc.setSourceImage(bmpBuf, 0, 0, width, 0, height, TJ.PF_BGRX);
}
+ jpegBuf = tjc.compress(flags);
jpegSize = tjc.getCompressedSize();
tjc.close();