New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8264002: Delete outdated assumptions about ColorSpace initialization #3140
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2000, 2021, 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 | ||
|
@@ -25,13 +25,12 @@ | |
|
||
package com.sun.imageio.plugins.jpeg; | ||
|
||
import java.awt.color.ColorSpace; | ||
import java.awt.image.ColorModel; | ||
|
||
import javax.imageio.ImageTypeSpecifier; | ||
import javax.imageio.plugins.jpeg.JPEGQTable; | ||
import javax.imageio.plugins.jpeg.JPEGHuffmanTable; | ||
|
||
import java.awt.image.ColorModel; | ||
import java.awt.color.ColorSpace; | ||
import java.awt.color.ICC_ColorSpace; | ||
import javax.imageio.plugins.jpeg.JPEGQTable; | ||
|
||
/** | ||
* A class containing JPEG-related constants, definitions, and | ||
|
@@ -199,39 +198,11 @@ public class JPEG { | |
|
||
static final int [] bOffsRGB = { 2, 1, 0 }; | ||
|
||
/* These are kept in the inner class to avoid static initialization | ||
* of the CMM class until someone actually needs it. | ||
* (e.g. do not init CMM on the request for jpeg mime types) | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not necessary to delay the usage of ColorSpace, it itself defers the usage of cmm. |
||
public static class JCS { | ||
public static final ColorSpace sRGB = | ||
ColorSpace.getInstance(ColorSpace.CS_sRGB); | ||
} | ||
static final ColorSpace sRGB = ColorSpace.getInstance(ColorSpace.CS_sRGB); | ||
|
||
// Default value for ImageWriteParam | ||
public static final float DEFAULT_QUALITY = 0.75F; | ||
|
||
/** | ||
* Returns {@code true} if the given {@code ColorSpace} | ||
* object is an instance of ICC_ColorSpace but is not one of the | ||
* standard {@code ColorSpaces} returned by | ||
* {@code ColorSpace.getInstance()}. | ||
*/ | ||
static boolean isNonStandardICC(ColorSpace cs) { | ||
boolean retval = false; | ||
if ((cs instanceof ICC_ColorSpace) | ||
&& (!cs.isCS_sRGB()) | ||
&& (!cs.equals(ColorSpace.getInstance(ColorSpace.CS_CIEXYZ))) | ||
&& (!cs.equals(ColorSpace.getInstance(ColorSpace.CS_GRAY))) | ||
&& (!cs.equals(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB))) | ||
&& (!cs.equals(ColorSpace.getInstance(ColorSpace.CS_PYCC))) | ||
) { | ||
retval = true; | ||
} | ||
return retval; | ||
} | ||
|
||
|
||
/** | ||
* Returns {@code true} if the given imageType can be used | ||
* in a JFIF file. If {@code input} is true, then the | ||
|
@@ -342,5 +313,4 @@ static float convertToLinearQuality(float quality) { | |
} | ||
return tables; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method above was added by the tiff implementation in jdk9 and it is mostly a copy of the older code in the jpeg plugin. I merged two methods and leave it here in the "common" code.