diff options
author | Jamie Gennis <jgennis@google.com> | 2011-01-12 14:57:29 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-01-12 14:57:29 -0800 |
commit | 103198a10cc22a49270a787d04b8ab484d2ec235 (patch) | |
tree | e630f2eaf512c5ab0394d737d1c67715f05a2b7b /include | |
parent | d688e5af1c95a8b5a482c146cd789c2be45f9663 (diff) | |
parent | b598fb90727be45e926a11abefc319819a733540 (diff) | |
download | frameworks_base-103198a10cc22a49270a787d04b8ab484d2ec235.zip frameworks_base-103198a10cc22a49270a787d04b8ab484d2ec235.tar.gz frameworks_base-103198a10cc22a49270a787d04b8ab484d2ec235.tar.bz2 |
Merge "Implement crop & transform for SurfaceTexture." into honeycomb
Diffstat (limited to 'include')
-rw-r--r-- | include/gui/SurfaceTexture.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h index cbc15d8..09cf2a2 100644 --- a/include/gui/SurfaceTexture.h +++ b/include/gui/SurfaceTexture.h @@ -70,6 +70,26 @@ public: // target texture belongs is bound to the calling thread. status_t updateTexImage(); + // getTransformMatrix retrieves the 4x4 texture coordinate transform matrix + // associated with the texture image set by the most recent call to + // updateTexImage. + // + // This transform matrix maps 2D homogeneous texture coordinates of the form + // (s, t, 0, 1) with s and t in the inclusive range [0, 1] to the texture + // coordinate that should be used to sample that location from the texture. + // Sampling the texture outside of the range of this transform is undefined. + // + // This transform is necessary to compensate for transforms that the stream + // content producer may implicitly apply to the content. By forcing users of + // a SurfaceTexture to apply this transform we avoid performing an extra + // copy of the data that would be needed to hide the transform from the + // user. + // + // The matrix is stored in column-major order so that it may be passed + // directly to OpenGL ES via the glLoadMatrixf or glUniformMatrix4fv + // functions. + void getTransformMatrix(float mtx[16]); + private: // freeAllBuffers frees the resources (both GraphicBuffer and EGLImage) for @@ -120,11 +140,37 @@ private: // reset mCurrentTexture to INVALID_BUFFER_SLOT. int mCurrentTexture; + // mCurrentCrop is the crop rectangle that applies to the current texture. + // It gets set to mLastQueuedCrop each time updateTexImage is called. + Rect mCurrentCrop; + + // mCurrentTransform is the transform identifier for the current texture. It + // gets set to mLastQueuedTransform each time updateTexImage is called. + uint32_t mCurrentTransform; + // mLastQueued is the buffer slot index of the most recently enqueued buffer. // At construction time it is initialized to INVALID_BUFFER_SLOT, and is // updated each time queueBuffer is called. int mLastQueued; + // mLastQueuedCrop is the crop rectangle for the buffer that was most + // recently queued. This gets set to mNextCrop each time queueBuffer gets + // called. + Rect mLastQueuedCrop; + + // mLastQueuedTransform is the transform identifier for the buffer that was + // most recently queued. This gets set to mNextTransform each time + // queueBuffer gets called. + uint32_t mLastQueuedTransform; + + // mNextCrop is the crop rectangle that will be used for the next buffer + // that gets queued. It is set by calling setCrop. + Rect mNextCrop; + + // mNextTransform is the transform identifier that will be used for the next + // buffer that gets queued. It is set by calling setTransform. + uint32_t mNextTransform; + // 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 // changed with a call to setTexName. |