SurfaceTexture: improve texture matrix computation
This change reduces the shrinking of the crop rectangle in some cases. It adds
a way to inform the SurfaceTexture that its texture will be used without
bilinear interpolation, and uses knowledge of the pixel format to avoid
shrinking unecessarily.
Change-Id: I72365f39f74ecb7fcc51b4cf42f2d0fa97727212
diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h
index 91cba76..f9cf0be 100644
--- a/include/gui/SurfaceTexture.h
+++ b/include/gui/SurfaceTexture.h
@@ -144,6 +144,10 @@
// updateTexImage() is called.
status_t setDefaultBufferSize(uint32_t width, uint32_t height);
+ // setFilteringEnabled sets whether the transform matrix should be computed
+ // for use with bilinear filtering.
+ void setFilteringEnabled(bool enabled);
+
// getCurrentBuffer returns the buffer associated with the current image.
sp<GraphicBuffer> getCurrentBuffer() const;
@@ -289,6 +293,11 @@
uint32_t mDefaultWidth, mDefaultHeight;
+ // mFilteringEnabled indicates whether the transform matrix is computed for
+ // use with bilinear filtering. It defaults to true and is changed by
+ // setFilteringEnabled().
+ bool mFilteringEnabled;
+
// mTexName is the name of the OpenGL texture to which streamed images will
// be bound when updateTexImage is called. It is set at construction time
// and can be changed with a call to attachToContext.