File tree Expand file tree Collapse file tree 3 files changed +14
-17
lines changed
library/src/main/java/com/bumptech/glide/load Expand file tree Collapse file tree 3 files changed +14
-17
lines changed Original file line number Diff line number Diff line change 29
29
* Bitmap will actually use the requested color space.
30
30
*/
31
31
public enum PreferredColorSpace {
32
- /** don't set prefer ColorSpace. */
33
- NULL ,
34
32
/** Prefers to decode images using {@link android.graphics.ColorSpace.Named#SRGB}. */
35
33
SRGB ,
36
34
/** Prefers to decode images using {@link android.graphics.ColorSpace.Named#DISPLAY_P3}. */
Original file line number Diff line number Diff line change @@ -129,17 +129,18 @@ public boolean onPartialImage(@NonNull DecodeException e) {
129
129
}
130
130
131
131
decoder .setTargetSize (resizeWidth , resizeHeight );
132
-
133
- if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .P ) {
134
- boolean isP3Eligible =
135
- preferredColorSpace == PreferredColorSpace .DISPLAY_P3
136
- && info .getColorSpace () != null
137
- && info .getColorSpace ().isWideGamut ();
138
- decoder .setTargetColorSpace (
139
- ColorSpace .get (
140
- isP3Eligible ? ColorSpace .Named .DISPLAY_P3 : ColorSpace .Named .SRGB ));
141
- } else if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
142
- decoder .setTargetColorSpace (ColorSpace .get (ColorSpace .Named .SRGB ));
132
+ if (preferredColorSpace != null ) {
133
+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .P ) {
134
+ boolean isP3Eligible =
135
+ preferredColorSpace == PreferredColorSpace .DISPLAY_P3
136
+ && info .getColorSpace () != null
137
+ && info .getColorSpace ().isWideGamut ();
138
+ decoder .setTargetColorSpace (
139
+ ColorSpace .get (
140
+ isP3Eligible ? ColorSpace .Named .DISPLAY_P3 : ColorSpace .Named .SRGB ));
141
+ } else if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
142
+ decoder .setTargetColorSpace (ColorSpace .get (ColorSpace .Named .SRGB ));
143
+ }
143
144
}
144
145
}
145
146
});
Original file line number Diff line number Diff line change @@ -62,9 +62,7 @@ public final class Downsampler {
62
62
* limitations.
63
63
*/
64
64
public static final Option <PreferredColorSpace > PREFERRED_COLOR_SPACE =
65
- Option .memory (
66
- "com.bumptech.glide.load.resource.bitmap.Downsampler.PreferredColorSpace" ,
67
- PreferredColorSpace .SRGB );
65
+ Option .memory ("com.bumptech.glide.load.resource.bitmap.Downsampler.PreferredColorSpace" );
68
66
/**
69
67
* Indicates the {@link com.bumptech.glide.load.resource.bitmap.DownsampleStrategy} option that
70
68
* will be used to calculate the sample size to use to downsample an image given the original and
@@ -376,7 +374,7 @@ private Bitmap decodeFromWrappedStreams(
376
374
}
377
375
}
378
376
379
- if (preferredColorSpace != PreferredColorSpace . NULL ) {
377
+ if (preferredColorSpace != null ) {
380
378
if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .P ) {
381
379
boolean isP3Eligible =
382
380
preferredColorSpace == PreferredColorSpace .DISPLAY_P3
You can’t perform that action at this time.
0 commit comments