Loading libs/gui/BufferQueue.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -57,9 +57,12 @@ #define ST_LOGE(x, ...) ALOGE("[%s] "x, mConsumerName.string(), ##__VA_ARGS__) #define ATRACE_BUFFER_INDEX(index) \ if (ATRACE_ENABLED()) { \ char ___traceBuf[1024]; \ snprintf(___traceBuf, 1024, "%s: %d", mConsumerName.string(), (index)); \ android::ScopedTrace ___bufTracer(ATRACE_TAG, ___traceBuf); snprintf(___traceBuf, 1024, "%s: %d", mConsumerName.string(), \ (index)); \ android::ScopedTrace ___bufTracer(ATRACE_TAG, ___traceBuf); \ } namespace android { Loading libs/gui/SurfaceTexture.cpp +10 −22 Original line number Diff line number Diff line Loading @@ -542,28 +542,16 @@ void SurfaceTexture::computeCurrentTransformMatrix() { // decoder, camera, etc.) would simply not use a crop rectangle (or at // least not tell the framework about it) so that the GPU can do the // correct edge behavior. int xshrink = 0, yshrink = 0; if (mCurrentCrop.left > 0) { tx = float(mCurrentCrop.left + 1) / float(buf->getWidth()); xshrink++; } else { tx = 0.0f; } if (mCurrentCrop.right < int32_t(buf->getWidth())) { xshrink++; } if (mCurrentCrop.bottom < int32_t(buf->getHeight())) { ty = (float(buf->getHeight() - mCurrentCrop.bottom) + 1.0f) / const float shrinkAmount = 1.0f; // the amount that each edge is shrunk tx = (float(mCurrentCrop.left) + shrinkAmount) / float(buf->getWidth()); ty = (float(buf->getHeight() - mCurrentCrop.bottom) + shrinkAmount) / float(buf->getHeight()); sx = (float(mCurrentCrop.width()) - (2.0f * shrinkAmount)) / float(buf->getWidth()); sy = (float(mCurrentCrop.height()) - (2.0f * shrinkAmount)) / float(buf->getHeight()); yshrink++; } else { ty = 0.0f; } if (mCurrentCrop.top > 0) { yshrink++; } sx = float(mCurrentCrop.width() - xshrink) / float(buf->getWidth()); sy = float(mCurrentCrop.height() - yshrink) / float(buf->getHeight()); } else { tx = 0.0f; ty = 0.0f; Loading libs/gui/tests/SurfaceTextureClient_test.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -580,13 +580,13 @@ TEST_F(SurfaceTextureClientTest, GetTransformMatrixSucceedsAfterFreeingBuffersWi // This accounts for the 1 texel shrink for each edge that's included in the // transform matrix to avoid texturing outside the crop region. EXPECT_EQ(.5f, mtx[0]); EXPECT_EQ(.375f, mtx[0]); EXPECT_EQ(0.f, mtx[1]); EXPECT_EQ(0.f, mtx[2]); EXPECT_EQ(0.f, mtx[3]); EXPECT_EQ(0.f, mtx[4]); EXPECT_EQ(-.5f, mtx[5]); EXPECT_EQ(-.375f, mtx[5]); EXPECT_EQ(0.f, mtx[6]); EXPECT_EQ(0.f, mtx[7]); Loading @@ -595,7 +595,7 @@ TEST_F(SurfaceTextureClientTest, GetTransformMatrixSucceedsAfterFreeingBuffersWi EXPECT_EQ(1.f, mtx[10]); EXPECT_EQ(0.f, mtx[11]); EXPECT_EQ(0.f, mtx[12]); EXPECT_EQ(.125f, mtx[12]); EXPECT_EQ(.5f, mtx[13]); EXPECT_EQ(0.f, mtx[14]); EXPECT_EQ(1.f, mtx[15]); Loading Loading
libs/gui/BufferQueue.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -57,9 +57,12 @@ #define ST_LOGE(x, ...) ALOGE("[%s] "x, mConsumerName.string(), ##__VA_ARGS__) #define ATRACE_BUFFER_INDEX(index) \ if (ATRACE_ENABLED()) { \ char ___traceBuf[1024]; \ snprintf(___traceBuf, 1024, "%s: %d", mConsumerName.string(), (index)); \ android::ScopedTrace ___bufTracer(ATRACE_TAG, ___traceBuf); snprintf(___traceBuf, 1024, "%s: %d", mConsumerName.string(), \ (index)); \ android::ScopedTrace ___bufTracer(ATRACE_TAG, ___traceBuf); \ } namespace android { Loading
libs/gui/SurfaceTexture.cpp +10 −22 Original line number Diff line number Diff line Loading @@ -542,28 +542,16 @@ void SurfaceTexture::computeCurrentTransformMatrix() { // decoder, camera, etc.) would simply not use a crop rectangle (or at // least not tell the framework about it) so that the GPU can do the // correct edge behavior. int xshrink = 0, yshrink = 0; if (mCurrentCrop.left > 0) { tx = float(mCurrentCrop.left + 1) / float(buf->getWidth()); xshrink++; } else { tx = 0.0f; } if (mCurrentCrop.right < int32_t(buf->getWidth())) { xshrink++; } if (mCurrentCrop.bottom < int32_t(buf->getHeight())) { ty = (float(buf->getHeight() - mCurrentCrop.bottom) + 1.0f) / const float shrinkAmount = 1.0f; // the amount that each edge is shrunk tx = (float(mCurrentCrop.left) + shrinkAmount) / float(buf->getWidth()); ty = (float(buf->getHeight() - mCurrentCrop.bottom) + shrinkAmount) / float(buf->getHeight()); sx = (float(mCurrentCrop.width()) - (2.0f * shrinkAmount)) / float(buf->getWidth()); sy = (float(mCurrentCrop.height()) - (2.0f * shrinkAmount)) / float(buf->getHeight()); yshrink++; } else { ty = 0.0f; } if (mCurrentCrop.top > 0) { yshrink++; } sx = float(mCurrentCrop.width() - xshrink) / float(buf->getWidth()); sy = float(mCurrentCrop.height() - yshrink) / float(buf->getHeight()); } else { tx = 0.0f; ty = 0.0f; Loading
libs/gui/tests/SurfaceTextureClient_test.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -580,13 +580,13 @@ TEST_F(SurfaceTextureClientTest, GetTransformMatrixSucceedsAfterFreeingBuffersWi // This accounts for the 1 texel shrink for each edge that's included in the // transform matrix to avoid texturing outside the crop region. EXPECT_EQ(.5f, mtx[0]); EXPECT_EQ(.375f, mtx[0]); EXPECT_EQ(0.f, mtx[1]); EXPECT_EQ(0.f, mtx[2]); EXPECT_EQ(0.f, mtx[3]); EXPECT_EQ(0.f, mtx[4]); EXPECT_EQ(-.5f, mtx[5]); EXPECT_EQ(-.375f, mtx[5]); EXPECT_EQ(0.f, mtx[6]); EXPECT_EQ(0.f, mtx[7]); Loading @@ -595,7 +595,7 @@ TEST_F(SurfaceTextureClientTest, GetTransformMatrixSucceedsAfterFreeingBuffersWi EXPECT_EQ(1.f, mtx[10]); EXPECT_EQ(0.f, mtx[11]); EXPECT_EQ(0.f, mtx[12]); EXPECT_EQ(.125f, mtx[12]); EXPECT_EQ(.5f, mtx[13]); EXPECT_EQ(0.f, mtx[14]); EXPECT_EQ(1.f, mtx[15]); Loading