summaryrefslogtreecommitdiff
path: root/libs/gui/GLConsumerUtils.cpp
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2023-08-25 13:45:39 -0700
committer Xin Li <delphij@google.com> 2023-08-25 13:45:39 -0700
commit1b988a4ee33de9cab9740ddc1ee70b1734c8e622 (patch)
treec4240b01ae5e973213d6532885fcc00fac6f9e0b /libs/gui/GLConsumerUtils.cpp
parent13da0f9a0f2d5fcb70418fcdceb0d184313d7f48 (diff)
parentb7bc7af7daca55a85bcc993c45c9be354d48f89a (diff)
Merge Android U (ab/10368041)
Bug: 291102124 Merged-In: I9b175092d433fc6d7b22b437a09d76d3d2e0ce14 Change-Id: If8a2897a99b111ba107f33c19537d40bcbdc802e
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: