--- a/jdk/make/sun/jpeg/Makefile Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/make/sun/jpeg/Makefile Mon Feb 21 14:22:08 2011 -0800
@@ -65,6 +65,19 @@
FILES_reorder += reorder-$(ARCH)
endif
endif
+
+ifeq ($(PLATFORM), linux)
+
+ # Suppress gcc warnings like "variable might be clobbered by 'longjmp'
+ # or 'vfork'": this warning indicates that some variable is placed to
+ # a register by optimized compiler and it's value might be lost on longjmp().
+ # Recommended way to avoid such warning is to declare the variable as
+ # volatile to prevent the optimization. However, this approach does not
+ # work because we have to declare all variables as volatile in result.
+
+ OTHER_CFLAGS += -Wno-clobbered
+endif
+
include $(BUILDDIR)/common/Mapfile-vers.gmk
include $(BUILDDIR)/common/Library.gmk
--- a/jdk/make/sun/jpeg/reorder-i586 Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/make/sun/jpeg/reorder-i586 Mon Feb 21 14:22:08 2011 -0800
@@ -22,7 +22,7 @@
text: .text%alloc_small: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jmemmgr.o;
text: .text%reset_marker_reader: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%jIInCtlr;
-text: .text%GET_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jpegdecoder.o;
+# text: .text%GET_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jpegdecoder.o;
text: .text%jReadHeader;
text: .text%jConsumeInput;
text: .text%reset_input_controller: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
@@ -30,36 +30,36 @@
text: .text%sun_jpeg_init_source;
text: .text%consume_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
text: .text%read_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
-text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
+# text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%sun_jpeg_fill_input_buffer;
-text: .text%RELEASE_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jpegdecoder.o;
-text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
+# text: .text%RELEASE_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jpegdecoder.o;
+# text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%emit_message: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jerror.o;
-text: .text%next_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
+# text: .text%next_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%get_interesting_appn: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
-text: .text%examine_app0: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
+# text: .text%examine_app0: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%skip_variable: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%sun_jpeg_skip_input_data;
-text: .text%examine_app14: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
+# text: .text%examine_app14: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%get_dqt: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%jAlcQTable;
text: .text%get_sof: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
-text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
+# text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%get_dht: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%jAlcHTable;
text: .text%get_sos: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
-text: .text%initial_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
+# text: .text%initial_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
text: .text%jDivRound;
-text: .text%default_decompress_parms: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdapimin.o;
+# text: .text%default_decompress_parms: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdapimin.o;
text: .text%jHasMultScn;
text: .text%jStrtDecompress;
text: .text%jIDMaster;
-text: .text%master_selection: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
+# text: .text%master_selection: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
text: .text%jCalcDimensions;
-text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
-text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
+# text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
+# text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
text: .text%jIDColor;
-text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o;
+# text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o;
text: .text%jIUpsampler;
text: .text%jRound;
text: .text%alloc_sarray: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jmemmgr.o;
@@ -70,16 +70,16 @@
text: .text%jIHDecoder;
text: .text%jIDCoefC;
text: .text%jIDMainC;
-text: .text%alloc_funny_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
+# text: .text%alloc_funny_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
text: .text%realize_virt_arrays: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jmemmgr.o;
text: .text%start_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
-text: .text%per_scan_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
-text: .text%latch_quant_tables: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
+# text: .text%per_scan_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
+# text: .text%latch_quant_tables: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
text: .text%start_pass_huff_decoder: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o;
text: .text%jMkDDerived;
text: .text%start_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o;
-text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o;
-text: .text%output_pass_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdapistd.o;
+# text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o;
+# text: .text%output_pass_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdapistd.o;
text: .text%prepare_for_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
text: .text%start_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jddctmgr.o;
text: .text%start_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o;
@@ -87,7 +87,7 @@
text: .text%start_pass_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o;
text: .text%start_pass_dpost: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdpostct.o;
text: .text%start_pass_main: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
-text: .text%make_funny_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
+# text: .text%make_funny_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
text: .text%jReadScanlines;
text: .text%process_data_context_main: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
text: .text%decompress_onepass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o;
@@ -100,11 +100,11 @@
text: .text%fullsize_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o;
text: .text%h2v2_fancy_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o;
text: .text%ycc_rgb_convert: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o;
-text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
-text: .text%process_restart: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o;
+# text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
+# text: .text%process_restart: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o;
text: .text%read_restart_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%finish_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
-text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
+# text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
text: .text%jFinDecompress;
text: .text%finish_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
text: .text%sun_jpeg_term_source;
--- a/jdk/make/sun/jpeg/reorder-sparc Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/make/sun/jpeg/reorder-sparc Mon Feb 21 14:22:08 2011 -0800
@@ -30,10 +30,10 @@
text: .text%sun_jpeg_init_source;
text: .text%consume_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
text: .text%read_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
-text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
+# text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%sun_jpeg_fill_input_buffer;
text: .text%RELEASE_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jpegdecoder.o;
-text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
+# text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%emit_message: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jerror.o;
text: .text%next_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%get_interesting_appn: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
@@ -44,7 +44,7 @@
text: .text%get_dqt: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%jAlcQTable;
text: .text%get_sof: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
-text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
+# text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%get_dht: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%jAlcHTable;
text: .text%get_sos: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
@@ -56,10 +56,10 @@
text: .text%jIDMaster;
text: .text%master_selection: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
text: .text%jCalcDimensions;
-text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
-text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
+# text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
+# text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
text: .text%jIDColor;
-text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o;
+# text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o;
text: .text%jIUpsampler;
text: .text%jRound;
text: .text%alloc_sarray: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jmemmgr.o;
@@ -78,7 +78,7 @@
text: .text%start_pass_huff_decoder: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o;
text: .text%jMkDDerived;
text: .text%start_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o;
-text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o;
+# text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcoefct.o;
text: .text%output_pass_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdapistd.o;
text: .text%prepare_for_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
text: .text%start_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jddctmgr.o;
@@ -100,11 +100,11 @@
text: .text%fullsize_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o;
text: .text%h2v2_fancy_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdsample.o;
text: .text%ycc_rgb_convert: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdcolor.o;
-text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
-text: .text%process_restart: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o;
+# text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
+#text: .text%process_restart: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdhuff.o;
text: .text%read_restart_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmarker.o;
text: .text%finish_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdinput.o;
-text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
+# text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmainct.o;
text: .text%jFinDecompress;
text: .text%finish_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj/jdmaster.o;
text: .text%sun_jpeg_term_source;
--- a/jdk/make/sun/jpeg/reorder-sparcv9 Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/make/sun/jpeg/reorder-sparcv9 Mon Feb 21 14:22:08 2011 -0800
@@ -30,10 +30,10 @@
text: .text%sun_jpeg_init_source;
text: .text%consume_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdinput.o;
text: .text%read_markers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
-text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
+# text: .text%first_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
text: .text%sun_jpeg_fill_input_buffer;
text: .text%RELEASE_ARRAYS: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jpegdecoder.o;
-text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
+# text: .text%get_soi: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
text: .text%emit_message: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jerror.o;
text: .text%next_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
text: .text%get_interesting_appn: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
@@ -44,7 +44,7 @@
text: .text%get_dqt: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
text: .text%jAlcQTable;
text: .text%get_sof: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
-text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
+# text: .text%get_dri: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
text: .text%get_dht: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
text: .text%jAlcHTable;
text: .text%get_sos: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
@@ -56,10 +56,10 @@
text: .text%jIDMaster;
text: .text%master_selection: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o;
text: .text%jCalcDimensions;
-text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o;
-text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o;
+# text: .text%use_merged_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o;
+# text: .text%prepare_range_limit_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o;
text: .text%jIDColor;
-text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcolor.o;
+# text: .text%build_ycc_rgb_table: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcolor.o;
text: .text%jIUpsampler;
text: .text%jRound;
text: .text%alloc_sarray: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jmemmgr.o;
@@ -78,7 +78,7 @@
text: .text%start_pass_huff_decoder: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdhuff.o;
text: .text%jMkDDerived;
text: .text%start_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcoefct.o;
-text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcoefct.o;
+# text: .text%start_iMCU_row: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcoefct.o;
text: .text%output_pass_setup: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdapistd.o;
text: .text%prepare_for_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o;
text: .text%start_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jddctmgr.o;
@@ -100,11 +100,11 @@
text: .text%fullsize_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdsample.o;
text: .text%h2v2_fancy_upsample: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdsample.o;
text: .text%ycc_rgb_convert: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdcolor.o;
-text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmainct.o;
+# text: .text%set_wraparound_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmainct.o;
text: .text%process_restart: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdhuff.o;
text: .text%read_restart_marker: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmarker.o;
text: .text%finish_input_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdinput.o;
-text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmainct.o;
+# text: .text%set_bottom_pointers: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmainct.o;
text: .text%jFinDecompress;
text: .text%finish_output_pass: OUTPUTDIR/tmp/sun/sun.awt/jpeg/obj64/jdmaster.o;
text: .text%sun_jpeg_term_source;
--- a/jdk/src/share/classes/sun/awt/image/ImageFetcher.java Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/share/classes/sun/awt/image/ImageFetcher.java Mon Feb 21 14:22:08 2011 -0800
@@ -61,8 +61,10 @@
/**
* Adds an ImageFetchable to the queue of items to fetch. Instantiates
* a new ImageFetcher if it's reasonable to do so.
+ * If there is no available fetcher to process an ImageFetchable, then
+ * reports failure to caller.
*/
- public static void add(ImageFetchable src) {
+ public static boolean add(ImageFetchable src) {
final FetcherInfo info = FetcherInfo.getFetcherInfo();
synchronized(info.waitList) {
if (!info.waitList.contains(src)) {
@@ -71,9 +73,23 @@
info.numFetchers < info.fetchers.length) {
createFetchers(info);
}
- info.waitList.notify();
+ /* Creation of new fetcher may fail due to high vm load
+ * or some other reason.
+ * If there is already exist, but busy, fetcher, we leave
+ * the src in queue (it will be handled by existing
+ * fetcher later).
+ * Otherwise, we report failure: there is no fetcher
+ * to handle the src.
+ */
+ if (info.numFetchers > 0) {
+ info.waitList.notify();
+ } else {
+ info.waitList.removeElement(src);
+ return false;
+ }
}
}
+ return true;
}
/**
@@ -291,11 +307,15 @@
public Object run() {
for (int i = 0; i < info.fetchers.length; i++) {
if (info.fetchers[i] == null) {
- info.fetchers[i] = new ImageFetcher(
+ ImageFetcher f = new ImageFetcher(
fetcherGroup, i);
- info.fetchers[i].start();
- info.numFetchers++;
- break;
+ try {
+ f.start();
+ info.fetchers[i] = f;
+ info.numFetchers++;
+ break;
+ } catch (Error e) {
+ }
}
}
return null;
--- a/jdk/src/share/classes/sun/awt/image/InputStreamImageSource.java Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/share/classes/sun/awt/image/InputStreamImageSource.java Mon Feb 21 14:22:08 2011 -0800
@@ -164,8 +164,13 @@
private synchronized void startProduction() {
if (!awaitingFetch) {
- ImageFetcher.add(this);
- awaitingFetch = true;
+ if (ImageFetcher.add(this)) {
+ awaitingFetch = true;
+ } else {
+ ImageConsumerQueue cq = consumers;
+ consumers = null;
+ errorAllConsumers(cq, false);
+ }
}
}
--- a/jdk/src/share/classes/sun/font/FontUtilities.java Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/share/classes/sun/font/FontUtilities.java Mon Feb 21 14:22:08 2011 -0800
@@ -30,6 +30,8 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
+import java.lang.ref.SoftReference;
+import java.util.concurrent.ConcurrentHashMap;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -383,6 +385,10 @@
* }
* return fuir;
*/
+ private static volatile
+ SoftReference<ConcurrentHashMap<PhysicalFont, CompositeFont>>
+ compMapRef = new SoftReference(null);
+
public static FontUIResource getCompositeFontUIResource(Font font) {
FontUIResource fuir = new FontUIResource(font);
@@ -402,12 +408,22 @@
FontManager fm = FontManagerFactory.getInstance();
CompositeFont dialog2D =
- (CompositeFont) fm.findFont2D("dialog", font.getStyle(), FontManager.NO_FALLBACK);
+ (CompositeFont) fm.findFont2D("dialog", font.getStyle(),
+ FontManager.NO_FALLBACK);
if (dialog2D == null) { /* shouldn't happen */
return fuir;
}
PhysicalFont physicalFont = (PhysicalFont)font2D;
- CompositeFont compFont = new CompositeFont(physicalFont, dialog2D);
+ ConcurrentHashMap<PhysicalFont, CompositeFont> compMap = compMapRef.get();
+ if (compMap == null) { // Its been collected.
+ compMap = new ConcurrentHashMap<PhysicalFont, CompositeFont>();
+ compMapRef = new SoftReference(compMap);
+ }
+ CompositeFont compFont = compMap.get(physicalFont);
+ if (compFont == null) {
+ compFont = new CompositeFont(physicalFont, dialog2D);
+ compMap.put(physicalFont, compFont);
+ }
FontAccess.getFontAccess().setFont2D(fuir, compFont.handle);
/* marking this as a created font is needed as only created fonts
* copy their creator's handles.
--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c Mon Feb 21 14:22:08 2011 -0800
@@ -109,8 +109,8 @@
jobject stream; // ImageInputStream or ImageOutputStream
jbyteArray hstreamBuffer; // Handle to a Java buffer for the stream
JOCTET *buf; // Pinned buffer pointer */
- int bufferOffset; // holds offset between unpin and the next pin
- int bufferLength; // Allocated, nut just used
+ size_t bufferOffset; // holds offset between unpin and the next pin
+ size_t bufferLength; // Allocated, nut just used
int suspendable; // Set to true to suspend input
long remaining_skip; // Used only on input
} streamBuffer, *streamBufferPtr;
@@ -129,7 +129,7 @@
* Used to signal that no data need be restored from an unpin to a pin.
* I.e. the buffer is empty.
*/
-#define NO_DATA -1
+#define NO_DATA ((size_t)-1)
// Forward reference
static void resetStreamBuffer(JNIEnv *env, streamBufferPtr sb);
@@ -389,7 +389,6 @@
static imageIODataPtr initImageioData (JNIEnv *env,
j_common_ptr cinfo,
jobject obj) {
- int i, j;
imageIODataPtr data = (imageIODataPtr) malloc (sizeof(imageIOData));
if (data == NULL) {
@@ -982,7 +981,7 @@
streamBufferPtr sb = &data->streamBuf;
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
jint ret;
- int offset, buflen;
+ size_t offset, buflen;
/*
* The original (jpegdecoder.c) had code here that called
@@ -1520,7 +1519,7 @@
imageio_dispose((j_common_ptr)cinfo);
return 0;
}
- return (jlong) ret;
+ return ptr_to_jlong(ret);
}
/*
@@ -1535,7 +1534,7 @@
jlong ptr,
jobject source) {
- imageIODataPtr data = (imageIODataPtr) ptr;
+ imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
j_common_ptr cinfo;
if (data == NULL) {
@@ -1574,7 +1573,7 @@
int h_samp0, h_samp1, h_samp2;
int v_samp0, v_samp1, v_samp2;
jboolean retval = JNI_FALSE;
- imageIODataPtr data = (imageIODataPtr) ptr;
+ imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
j_decompress_ptr cinfo;
struct jpeg_source_mgr *src;
sun_jpeg_error_ptr jerr;
@@ -1772,7 +1771,7 @@
jlong ptr,
jint code) {
- imageIODataPtr data = (imageIODataPtr) ptr;
+ imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
j_decompress_ptr cinfo;
if (data == NULL) {
@@ -1814,7 +1813,7 @@
struct jpeg_source_mgr *src;
JSAMPROW scanLinePtr = NULL;
jint bands[MAX_BANDS];
- int i, j;
+ int i;
jint *body;
int scanlineLimit;
int pixelStride;
@@ -1824,14 +1823,12 @@
pixelBufferPtr pb;
sun_jpeg_error_ptr jerr;
boolean done;
- jint *bandSize;
- int maxBandValue, halfMaxBandValue;
boolean mustScale = FALSE;
boolean progressive = FALSE;
boolean orderedBands = TRUE;
- imageIODataPtr data = (imageIODataPtr) ptr;
+ imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
j_decompress_ptr cinfo;
- unsigned int numBytes;
+ size_t numBytes;
/* verify the inputs */
@@ -1849,7 +1846,7 @@
cinfo = (j_decompress_ptr) data->jpegObj;
- if ((numBands < 1) ||
+ if ((numBands < 1) || (numBands > MAX_BANDS) ||
(sourceXStart < 0) || (sourceXStart >= (jint)cinfo->image_width) ||
(sourceYStart < 0) || (sourceYStart >= (jint)cinfo->image_height) ||
(sourceWidth < 1) || (sourceWidth > (jint)cinfo->image_width) ||
@@ -1863,10 +1860,10 @@
return JNI_FALSE;
}
- if (stepX > cinfo->image_width) {
+ if (stepX > (jint)cinfo->image_width) {
stepX = cinfo->image_width;
}
- if (stepY > cinfo->image_height) {
+ if (stepY > (jint)cinfo->image_height) {
stepY = cinfo->image_height;
}
@@ -2119,7 +2116,7 @@
jobject this,
jlong ptr) {
- imageIODataPtr data = (imageIODataPtr) ptr;
+ imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
if (data == NULL) {
JNU_ThrowByName(env,
@@ -2137,7 +2134,7 @@
(JNIEnv *env,
jobject this,
jlong ptr) {
- imageIODataPtr data = (imageIODataPtr) ptr;
+ imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
j_decompress_ptr cinfo;
if (data == NULL) {
@@ -2159,7 +2156,7 @@
jobject this,
jlong ptr) {
- imageIODataPtr data = (imageIODataPtr) ptr;
+ imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
j_decompress_ptr cinfo;
sun_jpeg_error_ptr jerr;
@@ -2232,7 +2229,7 @@
jclass reader,
jlong ptr) {
- imageIODataPtr data = (imageIODataPtr) ptr;
+ imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
j_common_ptr info = destroyImageioData(env, data);
imageio_dispose(info);
@@ -2317,8 +2314,8 @@
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
/* find out how much needs to be written */
- jint datacount = sb->bufferLength - dest->free_in_buffer;
-
+ /* this conversion from size_t to jint is safe, because the lenght of the buffer is limited by jint */
+ jint datacount = (jint)(sb->bufferLength - dest->free_in_buffer);
if (datacount != 0) {
RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte));
@@ -2485,7 +2482,7 @@
imageio_dispose((j_common_ptr)cinfo);
return 0;
}
- return (jlong) ret;
+ return ptr_to_jlong(ret);
}
JNIEXPORT void JNICALL
@@ -2495,7 +2492,7 @@
jlong ptr,
jobject destination) {
- imageIODataPtr data = (imageIODataPtr) ptr;
+ imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
j_compress_ptr cinfo;
if (data == NULL) {
@@ -2526,7 +2523,7 @@
struct jpeg_destination_mgr *dest;
sun_jpeg_error_ptr jerr;
- imageIODataPtr data = (imageIODataPtr) ptr;
+ imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
j_compress_ptr cinfo;
if (data == NULL) {
@@ -2625,10 +2622,11 @@
jint *scanData;
jint *bandSize;
int maxBandValue, halfMaxBandValue;
- imageIODataPtr data = (imageIODataPtr) ptr;
+ imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
j_compress_ptr cinfo;
UINT8** scale = NULL;
+
/* verify the inputs */
if (data == NULL) {
@@ -2740,6 +2738,16 @@
buffer);
JNU_ThrowByName(env, "javax/imageio/IIOException", buffer);
}
+
+ if (scale != NULL) {
+ for (i = 0; i < numBands; i++) {
+ if (scale[i] != NULL) {
+ free(scale[i]);
+ }
+ }
+ free(scale);
+ }
+
free(scanLinePtr);
return data->abortFlag;
}
@@ -2953,7 +2961,7 @@
jobject this,
jlong ptr) {
- imageIODataPtr data = (imageIODataPtr) ptr;
+ imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
if (data == NULL) {
JNU_ThrowByName(env,
@@ -2970,7 +2978,7 @@
(JNIEnv *env,
jobject this,
jlong ptr) {
- imageIODataPtr data = (imageIODataPtr) ptr;
+ imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
j_compress_ptr cinfo;
if (data == NULL) {
@@ -3002,7 +3010,7 @@
jclass writer,
jlong ptr) {
- imageIODataPtr data = (imageIODataPtr) ptr;
+ imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
j_common_ptr info = destroyImageioData(env, data);
imageio_dispose(info);
--- a/jdk/src/share/native/sun/awt/image/jpeg/jdmarker.c Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/share/native/sun/awt/image/jpeg/jdmarker.c Mon Feb 21 14:22:08 2011 -0800
@@ -1325,14 +1325,14 @@
unsigned int length_limit)
{
my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
- long maxlength;
+ size_t maxlength;
jpeg_marker_parser_method processor;
/* Length limit mustn't be larger than what we can allocate
* (should only be a concern in a 16-bit environment).
*/
maxlength = cinfo->mem->max_alloc_chunk - SIZEOF(struct jpeg_marker_struct);
- if (((long) length_limit) > maxlength)
+ if (length_limit > maxlength)
length_limit = (unsigned int) maxlength;
/* Choose processor routine to use.
--- a/jdk/src/share/native/sun/awt/image/jpeg/jmemmgr.c Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/share/native/sun/awt/image/jpeg/jmemmgr.c Mon Feb 21 14:22:08 2011 -0800
@@ -133,7 +133,7 @@
jvirt_barray_ptr virt_barray_list;
/* This counts total space obtained from jpeg_get_small/large */
- long total_space_allocated;
+ size_t total_space_allocated;
/* alloc_sarray and alloc_barray set this value for use by virtual
* array routines.
@@ -588,8 +588,8 @@
/* Allocate the in-memory buffers for any unrealized virtual arrays */
{
my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
- long space_per_minheight, maximum_space, avail_mem;
- long minheights, max_minheights;
+ size_t space_per_minheight, maximum_space, avail_mem;
+ size_t minheights, max_minheights;
jvirt_sarray_ptr sptr;
jvirt_barray_ptr bptr;
@@ -1032,7 +1032,7 @@
jinit_memory_mgr (j_common_ptr cinfo)
{
my_mem_ptr mem;
- long max_to_use;
+ size_t max_to_use;
int pool;
size_t test_mac;
@@ -1109,8 +1109,10 @@
if ((memenv = getenv("JPEGMEM")) != NULL) {
char ch = 'x';
+ unsigned int mem_max = 0u;
- if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) {
+ if (sscanf(memenv, "%u%c", &mem_max, &ch) > 0) {
+ max_to_use = (size_t)mem_max;
if (ch == 'm' || ch == 'M')
max_to_use *= 1000L;
mem->pub.max_memory_to_use = max_to_use * 1000L;
--- a/jdk/src/share/native/sun/awt/image/jpeg/jmemnobs.c Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/share/native/sun/awt/image/jpeg/jmemnobs.c Mon Feb 21 14:22:08 2011 -0800
@@ -73,9 +73,9 @@
* Here we always say, "we got all you want bud!"
*/
-GLOBAL(long)
-jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
- long max_bytes_needed, long already_allocated)
+GLOBAL(size_t)
+jpeg_mem_available (j_common_ptr cinfo, size_t min_bytes_needed,
+ size_t max_bytes_needed, size_t already_allocated)
{
return max_bytes_needed;
}
@@ -100,7 +100,7 @@
* cleanup required. Here, there isn't any.
*/
-GLOBAL(long)
+GLOBAL(size_t)
jpeg_mem_init (j_common_ptr cinfo)
{
return 0; /* just set max_memory_to_use to 0 */
--- a/jdk/src/share/native/sun/awt/image/jpeg/jmemsys.h Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/share/native/sun/awt/image/jpeg/jmemsys.h Mon Feb 21 14:22:08 2011 -0800
@@ -104,10 +104,10 @@
* Conversely, zero may be returned to always use the minimum amount of memory.
*/
-EXTERN(long) jpeg_mem_available JPP((j_common_ptr cinfo,
- long min_bytes_needed,
- long max_bytes_needed,
- long already_allocated));
+EXTERN(size_t) jpeg_mem_available JPP((j_common_ptr cinfo,
+ size_t min_bytes_needed,
+ size_t max_bytes_needed,
+ size_t already_allocated));
/*
@@ -198,5 +198,5 @@
* all opened backing-store objects have been closed.
*/
-EXTERN(long) jpeg_mem_init JPP((j_common_ptr cinfo));
+EXTERN(size_t) jpeg_mem_init JPP((j_common_ptr cinfo));
EXTERN(void) jpeg_mem_term JPP((j_common_ptr cinfo));
--- a/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c Mon Feb 21 14:22:08 2011 -0800
@@ -328,7 +328,7 @@
if ((*env)->ExceptionOccurred(env) || !GET_ARRAYS(env, src)) {
cinfo->err->error_exit((struct jpeg_common_struct *) cinfo);
}
- if (ret <= src->remaining_skip) {
+ if (ret < 0 || (unsigned int)ret <= src->remaining_skip) {
return;
}
if (src->remaining_skip) {
@@ -397,7 +397,7 @@
}
num_bytes += src->remaining_skip;
src->remaining_skip = 0;
- ret = src->pub.bytes_in_buffer;
+ ret = (int)src->pub.bytes_in_buffer; /* this conversion is safe, because capacity of the buffer is limited by jnit */
if (ret >= num_bytes) {
src->pub.next_input_byte += num_bytes;
src->pub.bytes_in_buffer -= num_bytes;
--- a/jdk/src/share/native/sun/awt/image/jpeg/jpeglib.h Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/share/native/sun/awt/image/jpeg/jpeglib.h Mon Feb 21 14:22:08 2011 -0800
@@ -800,10 +800,10 @@
* used for virtual-array buffers.) May be changed by outer application
* after creating the JPEG object.
*/
- long max_memory_to_use;
+ size_t max_memory_to_use;
/* Maximum allocation request accepted by alloc_large. */
- long max_alloc_chunk;
+ size_t max_alloc_chunk;
};
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java Mon Feb 21 14:22:08 2011 -0800
@@ -479,8 +479,7 @@
if (xrpipe == null) {
try {
SunToolkit.awtLock();
- xgc = renderQueue.createGC(xid); // TODO: GC leak? where to
- // clean up?
+ xgc = XCreateGC(getNativeOps());
xrpipe = new XRRenderer(maskBuffer.getMaskBuffer());
xrtxpipe = new PixelToShapeConverter(xrpipe);
--- a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c Mon Feb 21 14:22:08 2011 -0800
@@ -595,15 +595,16 @@
}
XImage* X11SD_GetSharedImage(X11SDOps *xsdo, jint width, jint height,
- jboolean readBits)
+ jint maxWidth, jint maxHeight, jboolean readBits)
{
XImage * retImage = NULL;
if (cachedXImage != NULL &&
- X11SD_CachedXImageFits(width, height, xsdo->depth, readBits)) {
- /* sync so previous data gets flushed */
- XSync(awt_display, False);
- retImage = cachedXImage;
- cachedXImage = (XImage *)NULL;
+ X11SD_CachedXImageFits(width, height, maxWidth, maxHeight,
+ xsdo->depth, readBits)) {
+ /* sync so previous data gets flushed */
+ XSync(awt_display, False);
+ retImage = cachedXImage;
+ cachedXImage = (XImage *)NULL;
} else if (width * height * xsdo->depth > 0x10000) {
retImage = X11SD_CreateSharedImage(xsdo, width, height);
}
@@ -728,8 +729,8 @@
* it must be close enough to avoid excessive reading from the screen;
* otherwise it should just be at least the size requested.
*/
-jboolean X11SD_CachedXImageFits(jint width, jint height, jint depth,
- jboolean readBits)
+jboolean X11SD_CachedXImageFits(jint width, jint height, jint maxWidth,
+ jint maxHeight, jint depth, jboolean readBits)
{
/* we assume here that the cached image exists */
jint imgWidth = cachedXImage->width;
@@ -747,10 +748,14 @@
return JNI_TRUE;
}
- if ((imgWidth < width + 64) && (imgHeight < height + 64)) {
+ if ((imgWidth < width + 64) && (imgHeight < height + 64)
+ && imgWidth <= maxWidth && imgHeight <= maxHeight)
+ {
/* Cached image's width/height shouldn't be more than 64 pixels
* larger than requested, because the region in XShmGetImage
* can't be specified and we don't want to read too much.
+ * Furthermore it has to be smaller than maxWidth/Height
+ * so drawables are not read out of bounds.
*/
return JNI_TRUE;
}
@@ -1295,7 +1300,7 @@
SurfaceDataBounds *bounds,
jint lockFlags)
{
- int x, y, w, h;
+ int x, y, w, h, maxWidth, maxHeight;
int scan;
XImage * img = NULL;
Drawable drawable;
@@ -1311,10 +1316,31 @@
#ifdef MITSHM
if (useMitShmExt == CAN_USE_MITSHM) {
- if (xsdo->isPixmap && readBits) {
- X11SD_PuntPixmap(xsdo, w, h);
+ if (xsdo->isPixmap) {
+ if (readBits) {
+ X11SD_PuntPixmap(xsdo, w, h);
+ }
+ maxWidth = xsdo->pmWidth;
+ maxHeight = xsdo->pmHeight;
+ } else {
+ XWindowAttributes winAttr;
+ if (XGetWindowAttributes(awt_display,
+ (Window) xsdo->drawable, &winAttr) != 0) {
+ maxWidth = winAttr.width;
+ maxHeight = winAttr.height;
+ } else {
+ /* XGWA failed which isn't a good thing. Defaulting to using
+ * x,y means that after the subtraction of these we will use
+ * w=0, h=0 which is a reasonable default on such a failure.
+ */
+ maxWidth = x;
+ maxHeight = y;
+ }
}
- img = X11SD_GetSharedImage(xsdo, w, h, readBits);
+ maxWidth -= x;
+ maxHeight -= y;
+
+ img = X11SD_GetSharedImage(xsdo, w, h, maxWidth, maxHeight, readBits);
}
#endif /* MITSHM */
drawable = xsdo->drawable;
--- a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.h Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.h Mon Feb 21 14:22:08 2011 -0800
@@ -125,15 +125,21 @@
#define X11SD_LOCK_BY_SHMEM 4 /* surface locked by ShMemExt */
#ifdef MITSHM
-XImage * X11SD_GetSharedImage (X11SDOps *xsdo, jint width, jint height, jboolean readBits);
+XImage * X11SD_GetSharedImage (X11SDOps *xsdo,
+ jint width, jint height,
+ jint maxWidth, jint maxHeight,
+ jboolean readBits);
XImage * X11SD_CreateSharedImage (X11SDOps *xsdo, jint width, jint height);
Drawable X11SD_CreateSharedPixmap (X11SDOps *xsdo);
void X11SD_DropSharedSegment (XShmSegmentInfo *shminfo);
void X11SD_PuntPixmap (X11SDOps *xsdo, jint width, jint height);
void X11SD_UnPuntPixmap (X11SDOps *xsdo);
-jboolean X11SD_CachedXImageFits (jint width, jint height, jint depth, jboolean readBits);
+jboolean X11SD_CachedXImageFits (jint width, jint height,
+ jint maxWidth, jint maxHeight,
+ jint depth, jboolean readBits);
XImage * X11SD_GetCachedXImage (jint width, jint height, jboolean readBits);
#endif /* MITSHM */
+jint X11SD_InitWindow(JNIEnv *env, X11SDOps *xsdo);
void X11SD_DisposeOrCacheXImage (XImage * image);
void X11SD_DisposeXImage(XImage * image);
void X11SD_DirectRenderNotify(JNIEnv *env, X11SDOps *xsdo);
--- a/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java Mon Feb 21 14:22:08 2011 -0800
@@ -51,9 +51,12 @@
import java.awt.image.DataBuffer;
import java.awt.image.IndexColorModel;
import java.awt.image.WritableRaster;
+import java.awt.image.ComponentSampleModel;
+import java.awt.image.MultiPixelPackedSampleModel;
+import java.awt.image.SampleModel;
+
import sun.awt.image.ByteComponentRaster;
import sun.awt.image.BytePackedRaster;
-
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
@@ -1272,6 +1275,25 @@
return false;
}
+ int bitsPerPixel = 24;
+ SampleModel sm = deepImage.getSampleModel();
+ if (sm instanceof ComponentSampleModel) {
+ ComponentSampleModel csm = (ComponentSampleModel)sm;
+ bitsPerPixel = csm.getPixelStride() * 8;
+ } else if (sm instanceof MultiPixelPackedSampleModel) {
+ MultiPixelPackedSampleModel mppsm =
+ (MultiPixelPackedSampleModel)sm;
+ bitsPerPixel = mppsm.getPixelBitStride();
+ } else {
+ if (icm != null) {
+ int diw = deepImage.getWidth();
+ int dih = deepImage.getHeight();
+ if (diw > 0 && dih > 0) {
+ bitsPerPixel = data.length*8/diw/dih;
+ }
+ }
+ }
+
/* Because the caller's image has been rotated
* and sheared into our BufferedImage and because
* we will be handing that BufferedImage directly to
@@ -1289,7 +1311,7 @@
(float)Math.rint(scaledBounds.height+0.5),
0f, 0f,
deepImage.getWidth(), deepImage.getHeight(),
- icm);
+ bitsPerPixel, icm);
setClip(holdClip);
}
--- a/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java Mon Feb 21 14:22:08 2011 -0800
@@ -1212,13 +1212,14 @@
float destWidth, float destHeight,
float srcX, float srcY,
float srcWidth, float srcHeight,
+ int sampleBitsPerPixel,
IndexColorModel icm) {
int bitCount = 24;
byte[] bmiColors = null;
if (icm != null) {
- bitCount = icm.getPixelSize();
- bmiColors = new byte[(1<<bitCount)*4];
+ bitCount = sampleBitsPerPixel;
+ bmiColors = new byte[(1<<icm.getPixelSize())*4];
for (int i=0;i<icm.getMapSize(); i++) {
bmiColors[i*4+0]=(byte)(icm.getBlue(i)&0xff);
bmiColors[i*4+1]=(byte)(icm.getGreen(i)&0xff);
--- a/jdk/src/windows/classes/sun/print/Win32PrintService.java Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/windows/classes/sun/print/Win32PrintService.java Mon Feb 21 14:22:08 2011 -0800
@@ -31,6 +31,7 @@
import java.net.URL;
import java.util.Vector;
+import java.util.HashMap;
import javax.print.DocFlavor;
import javax.print.DocPrintJob;
@@ -205,6 +206,7 @@
private MediaPrintableArea[] mediaPrintables;
private MediaTray[] mediaTrays;
private PrinterResolution[] printRes;
+ private HashMap mpaMap;
private int nCopies;
private int prnCaps;
private int[] defaultSettings;
@@ -212,6 +214,7 @@
private boolean gotTrays;
private boolean gotCopies;
private boolean mediaInitialized;
+ private boolean mpaListInitialized;
private ArrayList idList;
private MediaSize[] mediaSizes;
@@ -380,43 +383,115 @@
// Add mediaName to the msnList
if (mediaName != null) {
added = addToUniqueList(msnList, mediaName);
-
- // get MediaPrintableArea only for supported MediaSizeName ?
- if (added && !queryFailure) {
- prnArea=getMediaPrintableArea(printer,
- ((Integer)idList.get(i)).intValue());
- if (prnArea != null) {
- try {
- MediaPrintableArea mpa =
- new MediaPrintableArea(prnArea[0],
- prnArea[1],
- prnArea[2],
- prnArea[3],
- MediaPrintableArea.INCH);
- printableList.add(mpa);
- } catch (IllegalArgumentException iae) {
- }
- } else {
- // Calling getMediaPrintableArea causes
- // much overhead so if first attempt failed, we should
- // just bail out.
- if (i==0) {
- queryFailure = true;
- }
- }
- }
}
}
// init mediaSizeNames
mediaSizeNames = new MediaSizeName[msnList.size()];
msnList.toArray(mediaSizeNames);
+ }
- // init mediaPrintables
- mediaPrintables = new MediaPrintableArea[printableList.size()];
- printableList.toArray(mediaPrintables);
+
+ /*
+ * Gets a list of MediaPrintableAreas using a call to native function.
+ * msn is MediaSizeName used to get a specific printable area. If null,
+ * it will get all the supported MediPrintableAreas.
+ */
+ private synchronized MediaPrintableArea[] getMediaPrintables(MediaSizeName msn)
+ {
+ if (msn == null) {
+ if (mpaListInitialized == true) {
+ return mediaPrintables;
+ }
+ } else {
+ // get from cached mapping of MPAs
+ if (mpaMap != null && (mpaMap.get(msn) != null)) {
+ MediaPrintableArea[] mpaArr = new MediaPrintableArea[1];
+ mpaArr[0] = (MediaPrintableArea)mpaMap.get(msn);
+ return mpaArr;
+ }
+ }
+
+ initMedia();
+
+ if ((mediaSizeNames == null) && (mediaSizeNames.length == 0)) {
+ return null;
+ }
+
+ MediaSizeName[] loopNames;
+ if (msn != null) {
+ loopNames = new MediaSizeName[1];
+ loopNames[0] = msn;
+ } else {
+ loopNames = mediaSizeNames;
+ }
+
+ if (mpaMap == null) {
+ mpaMap = new HashMap();
+ }
+
+ for (int i=0; i < loopNames.length; i++) {
+ MediaSizeName mediaName = loopNames[i];
+
+ if (mpaMap.get(mediaName) != null) {
+ continue;
+ }
+
+ if (mediaName != null) {
+ int defPaper = findPaperID(mediaName);
+ float[] prnArea = getMediaPrintableArea(printer, defPaper);
+ MediaPrintableArea printableArea = null;
+ if (prnArea != null) {
+ try {
+ printableArea = new MediaPrintableArea(prnArea[0],
+ prnArea[1],
+ prnArea[2],
+ prnArea[3],
+ MediaPrintableArea.INCH);
+
+ mpaMap.put(mediaName, printableArea);
+ }
+ catch (IllegalArgumentException e) {
+ }
+ } else {
+ // if getting MPA failed, we use MediaSize
+ MediaSize ms =
+ MediaSize.getMediaSizeForName((MediaSizeName)mediaName);
+
+ if (ms != null) {
+ try {
+ printableArea = new MediaPrintableArea(0, 0,
+ ms.getX(MediaSize.INCH),
+ ms.getY(MediaSize.INCH),
+ MediaPrintableArea.INCH);
+ mpaMap.put(mediaName, printableArea);
+ } catch (IllegalArgumentException e) {
+ }
+ }
+ }
+ } //mediaName != null
+ }
+
+ if (mpaMap.size() == 0) {
+ return null;
+ }
+
+ if (msn != null) {
+ if (mpaMap.get(msn) == null) {
+ return null;
+ }
+ MediaPrintableArea[] mpaArr = new MediaPrintableArea[1];
+ // by this time, we've already gotten the desired MPA
+ mpaArr[0] = (MediaPrintableArea)mpaMap.get(msn);
+ return mpaArr;
+ } else {
+ mediaPrintables = (MediaPrintableArea[])mpaMap.values().toArray(new MediaPrintableArea[0]);
+ mpaListInitialized = true;
+ return mediaPrintables;
+ }
}
+
private synchronized MediaTray[] getMediaTrays() {
if (gotTrays == true && mediaTrays != null) {
return mediaTrays;
@@ -626,7 +701,7 @@
private boolean isSupportedMediaPrintableArea(MediaPrintableArea mpa) {
- initMedia();
+ getMediaPrintables(null);
if (mediaPrintables != null) {
for (int i=0; i<mediaPrintables.length; i++) {
@@ -1250,57 +1325,32 @@
}
if (trays != null) {
System.arraycopy(trays, 0, arr,
- mediaSizeNames.length, trays.length);
+ len - trays.length, trays.length);
}
return arr;
} else if (category == MediaPrintableArea.class) {
- initMedia();
-
- if (mediaPrintables == null) {
- return null;
- }
-
// if getting printable area for a specific media size
- Media mediaName;
+ Media mediaName = null;
if ((attributes != null) &&
((mediaName =
(Media)attributes.get(Media.class)) != null)) {
- if (mediaName instanceof MediaSizeName) {
- MediaPrintableArea []arr = new MediaPrintableArea[1];
-
- if (mediaSizeNames.length == mediaPrintables.length) {
-
- for (int j=0; j < mediaSizeNames.length; j++) {
-
- if (mediaName.equals(mediaSizeNames[j])) {
- arr[0] = mediaPrintables[j];
- return arr;
- }
- }
- }
-
- MediaSize ms =
- MediaSize.getMediaSizeForName((MediaSizeName)mediaName);
-
- if (ms != null) {
- arr[0] = new MediaPrintableArea(0, 0,
- ms.getX(MediaSize.INCH),
- ms.getY(MediaSize.INCH),
- MediaPrintableArea.INCH);
- return arr;
- } else {
- return null;
- }
+ if (!(mediaName instanceof MediaSizeName)) {
+ // if an instance of MediaTray, fall thru returning
+ // all MediaPrintableAreas
+ mediaName = null;
}
- // else an instance of MediaTray, fall thru returning
- // all MediaPrintableAreas
}
- MediaPrintableArea []arr =
- new MediaPrintableArea[mediaPrintables.length];
- System.arraycopy(mediaPrintables, 0, arr, 0, mediaPrintables.length);
- return arr;
+ MediaPrintableArea[] mpas =
+ getMediaPrintables((MediaSizeName)mediaName);
+ if (mpas != null) {
+ MediaPrintableArea[] arr = new MediaPrintableArea[mpas.length];
+ System.arraycopy(mpas, 0, arr, 0, mpas.length);
+ return arr;
+ } else {
+ return null;
+ }
} else if (category == SunAlternateMedia.class) {
return new SunAlternateMedia(
(Media)getDefaultAttributeValue(Media.class));
--- a/jdk/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp Mon Feb 21 14:22:08 2011 -0800
@@ -107,8 +107,16 @@
// could retain their own DIB info and we would not need to
// recreate it every time.
+ // GetRasInfo implicitly calls GetPrimitiveArrayCritical
+ // and since GetDC uses JNI it needs to be called first.
+ HDC hDC = dstOps->GetDC(env, dstOps, 0, NULL, clip, NULL, 0);
+ if (hDC == NULL) {
+ SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
+ return;
+ }
srcOps->GetRasInfo(env, srcOps, &srcInfo);
if (srcInfo.rasBase == NULL) {
+ dstOps->ReleaseDC(env, dstOps, hDC);
SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
return;
}
@@ -174,13 +182,6 @@
bmi.colors.dwMasks[2] = bmask;
}
- HDC hDC = dstOps->GetDC(env, dstOps, 0, NULL, clip, NULL, 0);
- if (hDC == NULL) {
- SurfaceData_InvokeRelease(env, srcOps, &srcInfo);
- SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
- return;
- }
-
if (fastBlt) {
// Window could go away at any time, leaving bits on the screen
// from this GDI call, so make sure window still exists
--- a/jdk/test/java/awt/PrintJob/Text/StringWidth.java Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/test/java/awt/PrintJob/Text/StringWidth.java Mon Feb 21 14:22:08 2011 -0800
@@ -63,7 +63,8 @@
}
public static void main(String[] args) {
- new StringWidth();
+ StringWidth sw = new StringWidth();
+ sw.dispose();
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/font/StyledMetrics/BoldSpace.java Mon Feb 21 14:22:08 2011 -0800
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2008, 2011, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ @test
+ @bug 6686365 7017637
+ @summary Confirm that styling does not affect metrics of zero advance glyphs
+*/
+
+import java.awt.*;
+import java.awt.image.*;
+
+public class BoldSpace {
+ public static void main(String[] s) {
+ BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
+
+ String errMsg = "ZWJ Space char should have 0 advance\n";
+
+ Graphics g = bi.getGraphics();
+
+ // It turns out that some fonts inexplicably treat this as
+ // a standard character. In this 14 pt font, if we see an advance
+ // that's clearly bigger than we'd have introduced in bolding we'll
+ // not error out this test, presuming that its a consequence of
+ // the actual font data. A Linux font 'TLwg Type Bold' is the case
+ // in point.
+ int errorMargin = 4;
+ g.setFont(new Font("monospaced", Font.BOLD, 14));
+ //g.setFont(new Font("Lucida Sans Regular", Font.BOLD, 14));
+ FontMetrics fm = g.getFontMetrics();
+ System.out.println("Bold: " + fm.charWidth('\u200b'));
+ int cwid = fm.charWidth('\u200b');
+ if (cwid > 0 && cwid < errorMargin) {
+ throw new RuntimeException(errMsg);
+ }
+
+ ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+ RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
+ fm = g.getFontMetrics();
+ System.out.println("Bold + LCD: "+fm.charWidth('\u200b'));
+ cwid = fm.charWidth('\u200b');
+ if (cwid > 0 && cwid < errorMargin) {
+ throw new RuntimeException(errMsg);
+ }
+
+
+ ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
+ RenderingHints.VALUE_FRACTIONALMETRICS_ON);
+ ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+ RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+ fm = g.getFontMetrics();
+ System.out.println("Bold FM OFF + AA: " + fm.charWidth('\u200b'));
+ cwid = fm.charWidth('\u200b');
+ if (cwid > 0 && cwid < errorMargin) {
+ throw new RuntimeException(errMsg);
+ }
+
+ ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
+ RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
+ ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+ RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+ fm = g.getFontMetrics();
+ System.out.println("Bold FM ON + AA: " + fm.charWidth('\u200b'));
+ cwid = fm.charWidth('\u200b');
+ if (cwid > 0 && cwid < errorMargin) {
+ throw new RuntimeException(errMsg);
+ }
+
+ ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
+ RenderingHints.VALUE_FRACTIONALMETRICS_ON);
+ ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+ RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
+ fm = g.getFontMetrics();
+ System.out.println("Bold FM ON + nonAA: " + fm.charWidth('\u200b'));
+ cwid = fm.charWidth('\u200b');
+ if (cwid > 0 && cwid < errorMargin) {
+ throw new RuntimeException(errMsg);
+ }
+
+ System.out.println("All printed values should be 0 to PASS");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java Mon Feb 21 14:22:08 2011 -0800
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 2006, 2011, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ *
+ * @test
+ * @bug 4521945 7006865
+ * @summary Test printing images of different types.
+ * @author prr
+ * @run main/manual=yesno/timeout=900 ImageTypes
+ */
+
+import java.io.*;
+import static java.awt.Color.*;
+import java.awt.*;
+import java.awt.geom.*;
+import java.awt.event.*;
+import java.awt.print.*;
+import java.awt.image.*;
+import static java.awt.image.BufferedImage.*;
+import javax.print.*;
+import javax.print.attribute.*;
+import javax.print.attribute.standard.*;
+
+public class ImageTypes extends Frame implements ActionListener {
+
+ private ImageCanvas c;
+
+ public static void main(String args[]) {
+
+ ImageTypes f = new ImageTypes();
+ f.show();
+ }
+
+ public ImageTypes () {
+ super("Image Types Printing Test");
+ c = new ImageCanvas();
+ add("Center", c);
+
+ Button printThisButton = new Button("Print");
+ printThisButton.addActionListener(this);
+ Panel p = new Panel();
+ p.add(printThisButton);
+ add("South", p);
+ add("North", getInstructions());
+ addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ System.exit(0);
+ }
+ });
+
+ pack();
+ }
+
+ private TextArea getInstructions() {
+ TextArea ta = new TextArea(10, 60);
+ ta.setFont(new Font("Dialog", Font.PLAIN, 11));
+ ta.setText
+ ("This is a manual test as it requires that you compare "+
+ "the on-screen rendering with the printed output.\n"+
+ "Select the 'Print' button to print out the test.\n"+
+ "For each image compare the printed one to the on-screen one.\n"+
+ "The test PASSES if the onscreen and printed rendering match.");
+ return ta;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ PrinterJob pj = PrinterJob.getPrinterJob();
+
+ PrintRequestAttributeSet attrs = new HashPrintRequestAttributeSet();
+ if (pj != null && pj.printDialog(attrs)) {
+ pj.setPrintable(c);
+ try {
+ pj.print(attrs);
+ } catch (PrinterException pe) {
+ pe.printStackTrace();
+ throw new RuntimeException("Exception whilst printing.");
+ } finally {
+ System.out.println("PRINT RETURNED OK.");
+ }
+ }
+ }
+}
+
+class ImageCanvas extends Component implements Printable {
+
+ IndexColorModel icm2 = null;
+ IndexColorModel icm4 = null;
+ BufferedImage opaqueImg = null;
+ BufferedImage transImg = null;
+ int sw=99, sh=99;
+
+ void paintImage(BufferedImage bi, Color c1, Color c2) {
+
+ GradientPaint tp= new GradientPaint(0.0f, 0.0f, c1, 10f, 8f, c2, true);
+ Graphics2D g2d = (Graphics2D)bi.getGraphics();
+ g2d.setPaint(tp);
+ g2d.fillRect(0, 0, sw, sh);
+ g2d.setColor(gray);
+ int cnt=0;
+ Font font = new Font("Serif", Font.PLAIN, 11);
+ g2d.setFont(font);
+ FontMetrics fm = g2d.getFontMetrics();
+ for (int y=12;y<sh;y+=12) {
+ int x = 0;
+ while (x < sw) {
+ String s = (new Integer(++cnt)).toString();
+ g2d.drawString(s, x, y);
+ x+= fm.stringWidth(s);
+ }
+ }
+ }
+
+ ImageCanvas() {
+
+ opaqueImg = new BufferedImage(sw, sh, TYPE_INT_RGB);
+ Color o1 = new Color(0, 0, 0);
+ Color o2 = new Color(255, 255, 255);
+ paintImage(opaqueImg, o1, o2);
+
+ transImg = new BufferedImage(sw, sh, TYPE_INT_ARGB);
+ Color t1 = new Color(255, 255, 255, 220);
+ Color t2 = new Color(255, 200, 0, 220);
+ paintImage(transImg, t1, t2);
+
+ /* greyscale 2bpp */
+ byte[] arr2bpp = {(byte)0, (byte)0x55, (byte)0xaa, (byte)0xff};
+ icm2 = new IndexColorModel(2, 4, arr2bpp, arr2bpp, arr2bpp);
+
+ /* color 4bpp */
+ int[] cmap = new int[16];
+ cmap[0] = black.getRGB();
+ cmap[1] = white.getRGB();
+ cmap[2] = gray.getRGB();
+ cmap[3] = lightGray.getRGB();
+ cmap[4] = red.getRGB();
+ cmap[5] = green.getRGB();
+ cmap[6] = blue.getRGB();
+ cmap[7] = yellow.getRGB();
+ cmap[8] = cyan.getRGB();
+ cmap[9] = magenta.getRGB();
+ cmap[10] = orange.getRGB();
+ cmap[11] = pink.getRGB();
+ cmap[12] = darkGray.getRGB();
+ cmap[13] = 192 << 16 ; // dark red.
+ cmap[14] = 192 << 8; // dark green
+ cmap[15] = 192; // dark blue
+
+ icm4 = new IndexColorModel(4, 16, cmap, 0, false, -1,
+ DataBuffer.TYPE_BYTE);
+
+ }
+
+
+ public int print(Graphics g, PageFormat pgFmt, int pgIndex) {
+
+ if (pgIndex > 0) {
+ return Printable.NO_SUCH_PAGE;
+ }
+ Graphics2D g2d = (Graphics2D)g;
+ g2d.translate(pgFmt.getImageableX(), pgFmt.getImageableY());
+ paint(g2d);
+ return Printable.PAGE_EXISTS;
+ }
+
+ private void drawImage(Graphics g, int biType, IndexColorModel icm) {
+
+ BufferedImage bi;
+ if (icm != null) {
+ bi = new BufferedImage(sw, sh, biType, icm);
+ } else {
+ bi = new BufferedImage(sw, sh, biType);
+ }
+
+ Graphics big = bi.getGraphics();
+ if (bi.getColorModel().getPixelSize() <=2) {
+ big.drawImage(opaqueImg, 0, 0, null);
+ } else {
+ big.drawImage(transImg, 0, 0, null);
+ }
+ g.drawImage(bi, 0, 0, null);
+ }
+
+ public void paint(Graphics g) {
+
+ int incX = sw+10, incY = sh+10;
+
+ g.translate(10, 10);
+
+ drawImage(g, TYPE_INT_RGB, null);
+ g.translate(incX, 0);
+
+ drawImage(g, TYPE_INT_BGR, null);
+ g.translate(incX, 0);
+
+ drawImage(g, TYPE_INT_ARGB, null);
+ g.translate(incX, 0);
+
+ drawImage(g, TYPE_INT_ARGB_PRE, null);
+ g.translate(-3*incX, incY);
+
+ drawImage(g, TYPE_3BYTE_BGR, null);
+ g.translate(incX, 0);
+
+ drawImage(g, TYPE_4BYTE_ABGR, null);
+ g.translate(incX, 0);
+
+ drawImage(g, TYPE_4BYTE_ABGR_PRE, null);
+ g.translate(incX, 0);
+
+ drawImage(g, TYPE_USHORT_555_RGB, null);
+ g.translate(-3*incX, incY);
+
+ drawImage(g, TYPE_USHORT_555_RGB, null);
+ g.translate(incX, 0);
+
+ drawImage(g, TYPE_USHORT_GRAY, null);
+ g.translate(incX, 0);
+
+ drawImage(g, TYPE_BYTE_GRAY, null);
+ g.translate(incX, 0);
+
+ drawImage(g, TYPE_BYTE_INDEXED, null);
+ g.translate(-3*incX, incY);
+
+ drawImage(g, TYPE_BYTE_BINARY, null);
+ g.translate(incX, 0);
+
+ drawImage(g, TYPE_BYTE_BINARY, icm2);
+ g.translate(incX, 0);
+
+ drawImage(g, TYPE_BYTE_BINARY, icm4);
+ g.translate(incX, 0);
+
+ drawImage(g, TYPE_BYTE_INDEXED, icm2);
+ g.translate(-3*incX, incY);
+
+ drawImage(g, TYPE_BYTE_INDEXED, icm4);
+ g.translate(incX, 0);
+ }
+
+
+
+ /* Size is chosen to match default imageable width of a NA letter
+ * page. This means there will be clipping, what is clipped will
+ * depend on PageFormat orientation.
+ */
+ public Dimension getPreferredSize() {
+ return new Dimension(468, 600);
+ }
+
+}
--- a/jdk/test/javax/print/attribute/ServiceDialogTest.java Fri Feb 18 14:23:48 2011 -0800
+++ b/jdk/test/javax/print/attribute/ServiceDialogTest.java Mon Feb 21 14:22:08 2011 -0800
@@ -71,7 +71,7 @@
if (factories.length > 0) {
services[0] = factories[0].getPrintService(fos);
} else {
- throw new RuntimeException("No StreamPrintService available which would support "+flavor");
+ throw new RuntimeException("No StreamPrintService available which would support "+flavor);
}
services[2] = new TestPrintService("Test Printer");