Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4aed786e authored by Sally Qi's avatar Sally Qi Committed by Android (Google) Code Review
Browse files

Merge "Use ColorSpace#getFromDataSpace in...

Merge "Use ColorSpace#getFromDataSpace in SurfaceControl#getCompositionColorSpaces instead of hardcoded conversion."
parents 7a303d65 938309fa
Loading
Loading
Loading
Loading
+3 −19
Original line number Diff line number Diff line
@@ -742,13 +742,6 @@ public final class SurfaceControl implements Parcelable {
     */
    public static final int POWER_MODE_ON_SUSPEND = 4;

    /**
     * internal representation of how to interpret pixel value, used only to convert to ColorSpace.
     */
    private static final int INTERNAL_DATASPACE_SRGB = 142671872;
    private static final int INTERNAL_DATASPACE_DISPLAY_P3 = 143261696;
    private static final int INTERNAL_DATASPACE_SCRGB = 411107328;

    private void assignNativeObject(long nativeObject, String callsite) {
        if (mNativeObject != 0) {
            release();
@@ -2195,18 +2188,9 @@ public final class SurfaceControl implements Parcelable {
        ColorSpace[] colorSpaces = { srgb, srgb };
        if (dataspaces.length == 2) {
            for (int i = 0; i < 2; ++i) {
                switch(dataspaces[i]) {
                    case INTERNAL_DATASPACE_DISPLAY_P3:
                        colorSpaces[i] = ColorSpace.get(ColorSpace.Named.DISPLAY_P3);
                        break;
                    case INTERNAL_DATASPACE_SCRGB:
                        colorSpaces[i] = ColorSpace.get(ColorSpace.Named.EXTENDED_SRGB);
                        break;
                    case INTERNAL_DATASPACE_SRGB:
                    // Other dataspace is not recognized, use SRGB color space instead,
                    // the default value of the array is already SRGB, thus do nothing.
                    default:
                        break;
                ColorSpace cs = ColorSpace.getFromDataSpace(dataspaces[i]);
                if (cs != null) {
                    colorSpaces[i] = cs;
                }
            }
        }