diff options
author | 2023-10-05 15:40:38 -0700 | |
---|---|---|
committer | 2023-10-05 15:40:38 -0700 | |
commit | 1961b2f7b191744f3fc6bb4d32f0da0ce3ee0567 (patch) | |
tree | b9785db180fb54b3a776f645cbb2a7ef480e0cb9 /libs/gui/GLConsumerUtils.cpp | |
parent | e4b64ebecf894e3047e46894a83ab8d37feabd3e (diff) | |
parent | 313d1596d818bc94fbab3d42b8c50306871f74a5 (diff) |
Merge Android 14
Bug: 298295554
Merged-In: I114a4cf83978f152959a6ec244d322603ff5257b
Change-Id: Ia35ae6e11052fcc3b2bdaabd6dc57d0d223de269
Diffstat (limited to 'libs/gui/GLConsumerUtils.cpp')
-rw-r--r-- | libs/gui/GLConsumerUtils.cpp | 11 |
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: |