mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8357287: Unify usage of ICC profile "header size" constants in CMM-related code
Reviewed-by: honkar, prr
This commit is contained in:
parent
3bebb1fa76
commit
68c1d305e7
@ -57,6 +57,8 @@ import sun.java2d.cmm.Profile;
|
||||
import sun.java2d.cmm.ProfileDataVerifier;
|
||||
import sun.java2d.cmm.ProfileDeferralInfo;
|
||||
|
||||
import static sun.java2d.cmm.ProfileDataVerifier.HEADER_SIZE;
|
||||
|
||||
/**
|
||||
* A representation of color profile data for device independent and device
|
||||
* dependent color spaces based on the International Color Consortium
|
||||
@ -764,8 +766,6 @@ public sealed class ICC_Profile implements Serializable
|
||||
*/
|
||||
public static final int icXYZNumberX = 8;
|
||||
|
||||
private static final int HEADER_SIZE = 128;
|
||||
|
||||
/**
|
||||
* Constructs an {@code ICC_Profile} object with a given ID.
|
||||
*/
|
||||
@ -913,11 +913,11 @@ public sealed class ICC_Profile implements Serializable
|
||||
|
||||
static byte[] getProfileDataFromStream(InputStream s) throws IOException {
|
||||
BufferedInputStream bis = new BufferedInputStream(s);
|
||||
bis.mark(128); // 128 is the length of the ICC profile header
|
||||
bis.mark(HEADER_SIZE);
|
||||
|
||||
byte[] header = bis.readNBytes(128);
|
||||
if (header.length < 128 || header[36] != 0x61 || header[37] != 0x63 ||
|
||||
header[38] != 0x73 || header[39] != 0x70) {
|
||||
byte[] header = bis.readNBytes(HEADER_SIZE);
|
||||
if (header.length < HEADER_SIZE || header[36] != 0x61 ||
|
||||
header[37] != 0x63 || header[38] != 0x73 || header[39] != 0x70) {
|
||||
return null; /* not a valid profile */
|
||||
}
|
||||
int profileSize = intFromBigEndian(header, 0);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2025, 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
|
||||
@ -106,7 +106,7 @@ public class ProfileDataVerifier {
|
||||
*/
|
||||
private static final int MAX_TAG_COUNT = 100;
|
||||
|
||||
private static final int HEADER_SIZE = 128;
|
||||
public static final int HEADER_SIZE = 128;
|
||||
private static final int TOC_OFFSET = HEADER_SIZE + 4;
|
||||
private static final int TOC_RECORD_SIZE = 12;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user