summaryrefslogtreecommitdiff
path: root/libs/gui/GLConsumerUtils.cpp
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2023-10-06 05:34:14 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2023-10-06 05:34:14 +0000
commit8b919d0eb0e816bdd67f11855e649ce3723930ee (patch)
treeb9785db180fb54b3a776f645cbb2a7ef480e0cb9 /libs/gui/GLConsumerUtils.cpp
parente4b64ebecf894e3047e46894a83ab8d37feabd3e (diff)
parent1961b2f7b191744f3fc6bb4d32f0da0ce3ee0567 (diff)
Merge "Merge Android 14" into main
Diffstat (limited to 'libs/gui/GLConsumerUtils.cpp')
-rw-r--r--libs/gui/GLConsumerUtils.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/libs/gui/GLConsumerUtils.cpp b/libs/gui/GLConsumerUtils.cpp
index 7a06c3d801..a1c69e7d6d 100644
--- a/libs/gui/GLConsumerUtils.cpp
+++ b/libs/gui/GLConsumerUtils.cpp
@@ -27,6 +27,13 @@ namespace android {
void GLConsumer::computeTransformMatrix(float outTransform[16],
const sp<GraphicBuffer>& buf, const Rect& cropRect, uint32_t transform,
bool filtering) {
+ computeTransformMatrix(outTransform, buf->getWidth(), buf->getHeight(), buf->getPixelFormat(),
+ cropRect, transform, filtering);
+}
+
+void GLConsumer::computeTransformMatrix(float outTransform[16], float bufferWidth,
+ float bufferHeight, PixelFormat pixelFormat,
+ const Rect& cropRect, uint32_t transform, bool filtering) {
// Transform matrices
static const mat4 mtxFlipH(
-1, 0, 0, 0,
@@ -60,8 +67,6 @@ void GLConsumer::computeTransformMatrix(float outTransform[16],
if (!cropRect.isEmpty()) {
float tx = 0.0f, ty = 0.0f, sx = 1.0f, sy = 1.0f;
- float bufferWidth = buf->getWidth();
- float bufferHeight = buf->getHeight();
float shrinkAmount = 0.0f;
if (filtering) {
// In order to prevent bilinear sampling beyond the edge of the
@@ -70,7 +75,7 @@ void GLConsumer::computeTransformMatrix(float outTransform[16],
// off each end, but because the chroma channels of YUV420 images
// are subsampled we may need to shrink the crop region by a whole
// texel on each side.
- switch (buf->getPixelFormat()) {
+ switch (pixelFormat) {
case PIXEL_FORMAT_RGBA_8888:
case PIXEL_FORMAT_RGBX_8888:
case PIXEL_FORMAT_RGBA_FP16: