1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
1054 return null;
1055 }
1056 bytesread += n;
1057 bytestoread -= n;
1058 }
1059
1060 return profileData;
1061 }
1062
1063
1064 /**
1065 * Constructs an ICC_Profile for which the actual loading of the
1066 * profile data from a file and the initialization of the CMM should
1067 * be deferred as long as possible.
1068 * Deferral is only used for standard profiles.
1069 * If deferring is disabled, then getStandardProfile() ensures
1070 * that all of the appropriate access privileges are granted
1071 * when loading this profile.
1072 * If deferring is enabled, then the deferred activation
1073 * code will take care of access privileges.
1074 * @see activateDeferredProfile()
1075 */
1076 static ICC_Profile getDeferredInstance(ProfileDeferralInfo pdi) {
1077 if (!ProfileDeferralMgr.deferring) {
1078 return getStandardProfile(pdi.filename);
1079 }
1080 if (pdi.colorSpaceType == ColorSpace.TYPE_RGB) {
1081 return new ICC_ProfileRGB(pdi);
1082 } else if (pdi.colorSpaceType == ColorSpace.TYPE_GRAY) {
1083 return new ICC_ProfileGray(pdi);
1084 } else {
1085 return new ICC_Profile(pdi);
1086 }
1087 }
1088
1089
1090 void activateDeferredProfile() throws ProfileDataException {
1091 byte profileData[];
1092 final String fileName = deferralInfo.filename;
1093
1094 profileActivator = null;
|
1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
1054 return null;
1055 }
1056 bytesread += n;
1057 bytestoread -= n;
1058 }
1059
1060 return profileData;
1061 }
1062
1063
1064 /**
1065 * Constructs an ICC_Profile for which the actual loading of the
1066 * profile data from a file and the initialization of the CMM should
1067 * be deferred as long as possible.
1068 * Deferral is only used for standard profiles.
1069 * If deferring is disabled, then getStandardProfile() ensures
1070 * that all of the appropriate access privileges are granted
1071 * when loading this profile.
1072 * If deferring is enabled, then the deferred activation
1073 * code will take care of access privileges.
1074 * @see #activateDeferredProfile()
1075 */
1076 static ICC_Profile getDeferredInstance(ProfileDeferralInfo pdi) {
1077 if (!ProfileDeferralMgr.deferring) {
1078 return getStandardProfile(pdi.filename);
1079 }
1080 if (pdi.colorSpaceType == ColorSpace.TYPE_RGB) {
1081 return new ICC_ProfileRGB(pdi);
1082 } else if (pdi.colorSpaceType == ColorSpace.TYPE_GRAY) {
1083 return new ICC_ProfileGray(pdi);
1084 } else {
1085 return new ICC_Profile(pdi);
1086 }
1087 }
1088
1089
1090 void activateDeferredProfile() throws ProfileDataException {
1091 byte profileData[];
1092 final String fileName = deferralInfo.filename;
1093
1094 profileActivator = null;
|