OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GL_STREAM_TEXTURE_IMAGE_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GL_STREAM_TEXTURE_IMAGE_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_GL_STREAM_TEXTURE_IMAGE_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_GL_STREAM_TEXTURE_IMAGE_H_ |
7 | 7 |
8 #include "gpu/gpu_export.h" | 8 #include "gpu/gpu_export.h" |
9 #include "ui/gl/gl_image.h" | 9 #include "ui/gl/gl_image.h" |
10 | 10 |
11 namespace gpu { | 11 namespace gpu { |
12 namespace gles2 { | 12 namespace gles2 { |
13 | 13 |
14 // Specialization of GLImage that allows us to support (stream) textures | 14 // Specialization of GLImage that allows us to support (stream) textures |
15 // that supply a texture matrix. | 15 // that supply a texture matrix. |
16 class GPU_EXPORT GLStreamTextureImage : public gl::GLImage { | 16 class GPU_EXPORT GLStreamTextureImage : public gl::GLImage { |
17 public: | 17 public: |
18 GLStreamTextureImage() {} | 18 GLStreamTextureImage() {} |
19 | 19 |
20 // Get the matrix. | 20 // Get the matrix. |
21 // Copy the texture matrix for this image into |matrix|. | 21 // Copy the texture matrix for this image into |matrix|. |
22 // Subclasses must return a matrix appropriate for a coordinate system where | 22 // Subclasses must return a matrix appropriate for a coordinate system where |
23 // UV=(0,0) corresponds to the top left corner of the image. | 23 // UV=(0,0) corresponds to the top left corner of the image. |
24 virtual void GetTextureMatrix(float matrix[16]) = 0; | 24 virtual void GetTextureMatrix(float matrix[16]) = 0; |
25 | 25 |
26 void Flush() override {} | 26 void Flush() override {} |
27 | 27 |
| 28 virtual void NotifyPromotionHint(bool promotion_hint, |
| 29 int display_x, |
| 30 int display_y) {} |
| 31 |
28 protected: | 32 protected: |
29 ~GLStreamTextureImage() override {} | 33 ~GLStreamTextureImage() override {} |
30 | 34 |
31 // Convenience function for subclasses that deal with SurfaceTextures, whose | 35 // Convenience function for subclasses that deal with SurfaceTextures, whose |
32 // coordinate system has (0,0) at the bottom left of the image. | 36 // coordinate system has (0,0) at the bottom left of the image. |
33 // [ a e i m ] [ 1 0 0 0 ] [ a -e i m+e ] | 37 // [ a e i m ] [ 1 0 0 0 ] [ a -e i m+e ] |
34 // [ b f j n ] [ 0 -1 0 1 ] = [ b -f j n+f ] | 38 // [ b f j n ] [ 0 -1 0 1 ] = [ b -f j n+f ] |
35 // [ c g k o ] [ 0 0 1 0 ] [ c -g k o+g ] | 39 // [ c g k o ] [ 0 0 1 0 ] [ c -g k o+g ] |
36 // [ d h l p ] [ 0 0 0 1 ] [ d -h l p+h ] | 40 // [ d h l p ] [ 0 0 0 1 ] [ d -h l p+h ] |
37 static void YInvertMatrix(float matrix[16]) { | 41 static void YInvertMatrix(float matrix[16]) { |
38 for (int i = 0; i < 4; ++i) { | 42 for (int i = 0; i < 4; ++i) { |
39 matrix[i + 12] += matrix[i + 4]; | 43 matrix[i + 12] += matrix[i + 4]; |
40 matrix[i + 4] = -matrix[i + 4]; | 44 matrix[i + 4] = -matrix[i + 4]; |
41 } | 45 } |
42 } | 46 } |
43 | 47 |
44 private: | 48 private: |
45 DISALLOW_COPY_AND_ASSIGN(GLStreamTextureImage); | 49 DISALLOW_COPY_AND_ASSIGN(GLStreamTextureImage); |
46 }; | 50 }; |
47 | 51 |
48 } // namespace gles2 | 52 } // namespace gles2 |
49 } // namespace gpu | 53 } // namespace gpu |
50 | 54 |
51 #endif // GPU_COMMAND_BUFFER_SERVICE_GL_STREAM_TEXTURE_IMAGE_H_ | 55 #endif // GPU_COMMAND_BUFFER_SERVICE_GL_STREAM_TEXTURE_IMAGE_H_ |
OLD | NEW |