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 747a44ac8b241d0c64f0c6d91aef43933f9fbc47..b5bc370c5ba58af945a348050c9229c9f7fc5b40 100644 |
--- a/gpu/command_buffer/service/gl_stream_texture_image.h |
+++ b/gpu/command_buffer/service/gl_stream_texture_image.h |
@@ -20,24 +20,19 @@ |
// 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 top left corner of the image. |
+ // UV=(0,0) corresponds to the bottom 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]; |
+ } |
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); |