Skip to content

Commit

Permalink
Make MatrixTransformationsProcessor constructor to take in Lists.
Browse files Browse the repository at this point in the history
* Replace ImmutableLists to List interface for constructors

PiperOrigin-RevId: 472433434
  • Loading branch information
leonwind authored and marcbaechinger committed Oct 19, 2022
1 parent c0ad9f5 commit ce0e3a4
Showing 1 changed file with 29 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.google.common.collect.ImmutableList;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;

/**
* Applies a sequence of {@link MatrixTransformation MatrixTransformations} in the vertex shader and
Expand Down Expand Up @@ -134,16 +135,20 @@
*/
public static MatrixTransformationProcessor create(
Context context,
ImmutableList<GlMatrixTransformation> matrixTransformations,
ImmutableList<RgbMatrix> rgbMatrices,
List<GlMatrixTransformation> matrixTransformations,
List<RgbMatrix> rgbMatrices,
boolean useHdr)
throws FrameProcessingException {
GlProgram glProgram =
createGlProgram(
context, VERTEX_SHADER_TRANSFORMATION_PATH, FRAGMENT_SHADER_TRANSFORMATION_PATH);

// No transfer functions needed, because input and output are both optical colors.
return new MatrixTransformationProcessor(glProgram, matrixTransformations, rgbMatrices, useHdr);
return new MatrixTransformationProcessor(
glProgram,
ImmutableList.copyOf(matrixTransformations),
ImmutableList.copyOf(rgbMatrices),
useHdr);
}

/**
Expand Down Expand Up @@ -171,8 +176,8 @@ public static MatrixTransformationProcessor create(
*/
public static MatrixTransformationProcessor createWithExternalSamplerApplyingEotf(
Context context,
ImmutableList<GlMatrixTransformation> matrixTransformations,
ImmutableList<RgbMatrix> rgbMatrices,
List<GlMatrixTransformation> matrixTransformations,
List<RgbMatrix> rgbMatrices,
ColorInfo electricalColorInfo)
throws FrameProcessingException {
boolean useHdr = ColorInfo.isTransferHdr(electricalColorInfo);
Expand Down Expand Up @@ -203,7 +208,11 @@ public static MatrixTransformationProcessor createWithExternalSamplerApplyingEot
glProgram.setIntUniform("uEotfColorTransfer", colorTransfer);
}

return new MatrixTransformationProcessor(glProgram, matrixTransformations, rgbMatrices, useHdr);
return new MatrixTransformationProcessor(
glProgram,
ImmutableList.copyOf(matrixTransformations),
ImmutableList.copyOf(rgbMatrices),
useHdr);
}

/**
Expand All @@ -227,8 +236,8 @@ public static MatrixTransformationProcessor createWithExternalSamplerApplyingEot
*/
public static MatrixTransformationProcessor createApplyingOetf(
Context context,
ImmutableList<GlMatrixTransformation> matrixTransformations,
ImmutableList<RgbMatrix> rgbMatrices,
List<GlMatrixTransformation> matrixTransformations,
List<RgbMatrix> rgbMatrices,
ColorInfo electricalColorInfo)
throws FrameProcessingException {
boolean useHdr = ColorInfo.isTransferHdr(electricalColorInfo);
Expand All @@ -246,7 +255,11 @@ public static MatrixTransformationProcessor createApplyingOetf(
glProgram.setIntUniform("uOetfColorTransfer", colorTransfer);
}

return new MatrixTransformationProcessor(glProgram, matrixTransformations, rgbMatrices, useHdr);
return new MatrixTransformationProcessor(
glProgram,
ImmutableList.copyOf(matrixTransformations),
ImmutableList.copyOf(rgbMatrices),
useHdr);
}

/**
Expand All @@ -270,8 +283,8 @@ public static MatrixTransformationProcessor createApplyingOetf(
*/
public static MatrixTransformationProcessor createWithExternalSamplerApplyingEotfThenOetf(
Context context,
ImmutableList<GlMatrixTransformation> matrixTransformations,
ImmutableList<RgbMatrix> rgbMatrices,
List<GlMatrixTransformation> matrixTransformations,
List<RgbMatrix> rgbMatrices,
ColorInfo electricalColorInfo)
throws FrameProcessingException {
boolean useHdr = ColorInfo.isTransferHdr(electricalColorInfo);
Expand Down Expand Up @@ -300,7 +313,11 @@ public static MatrixTransformationProcessor createWithExternalSamplerApplyingEot
glProgram.setIntUniform("uEotfColorTransfer", Format.NO_VALUE);
}

return new MatrixTransformationProcessor(glProgram, matrixTransformations, rgbMatrices, useHdr);
return new MatrixTransformationProcessor(
glProgram,
ImmutableList.copyOf(matrixTransformations),
ImmutableList.copyOf(rgbMatrices),
useHdr);
}

/**
Expand Down

0 comments on commit ce0e3a4

Please sign in to comment.