Index: gpu/command_buffer/service/gl_stream_texture_image.h |
diff --git a/gpu/command_buffer/service/gl_stream_texture_image.h b/gpu/command_buffer/service/gl_stream_texture_image.h |
index 0525a37adeceb22822b7a77ff60d165976bfd64c..daaa158ed02925664c1e6c17fd75e157e848bf9e 100644 |
--- a/gpu/command_buffer/service/gl_stream_texture_image.h |
+++ b/gpu/command_buffer/service/gl_stream_texture_image.h |
@@ -20,23 +20,27 @@ class GPU_EXPORT GLStreamTextureImage : public gl::GLImage { |
// Get the matrix. |
// Copy the texture matrix for this image into |matrix|. |
// Subclasses must return a matrix appropriate for a coordinate system where |
- // UV=(0,0) corresponds to the bottom left corner of the image. |
+ // UV=(0,0) corresponds to the top left corner of the image. |
virtual void GetTextureMatrix(float matrix[16]) = 0; |
- // Copy the texture matrix for this image into |matrix|, returning a matrix |
- // for which UV=(0,0) corresponds to the top left of corner of the image, |
- // which is what Chromium generally expects. |
- void GetFlippedTextureMatrix(float matrix[16]) { |
- GetTextureMatrix(matrix); |
- matrix[13] += matrix[5]; |
- matrix[5] = -matrix[5]; |
- } |
- |
void Flush() override {} |
protected: |
~GLStreamTextureImage() override {} |
+ // Convenience function for subclasses that deal with SurfaceTextures, whose |
+ // coordinate system has (0,0) at the bottom left of the image. |
+ // [ a e i m ] [ 1 0 0 0 ] [ a -e i m+e ] |
+ // [ b f j n ] [ 0 -1 0 1 ] = [ b -f j n+f ] |
+ // [ c g k o ] [ 0 0 1 0 ] [ c -g k o+g ] |
+ // [ d h l p ] [ 0 0 0 1 ] [ d -h l p+h ] |
+ static void YInvertMatrix(float matrix[16]) { |
+ for (int i = 0; i < 4; ++i) { |
+ matrix[i + 12] += matrix[i + 4]; |
+ matrix[i + 4] = -matrix[i + 4]; |
+ } |
+ } |
+ |
private: |
DISALLOW_COPY_AND_ASSIGN(GLStreamTextureImage); |
}; |