OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
6 #include <GLES2/gl2chromium.h> | 6 #include <GLES2/gl2chromium.h> |
7 #include <GLES2/gl2ext.h> | 7 #include <GLES2/gl2ext.h> |
8 #include <GLES2/gl2extchromium.h> | 8 #include <GLES2/gl2extchromium.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 SHADER( | 70 SHADER( |
71 precision mediump float; | 71 precision mediump float; |
72 uniform sampler2D a_texture; | 72 uniform sampler2D a_texture; |
73 varying vec2 v_texCoord; | 73 varying vec2 v_texCoord; |
74 void main() { | 74 void main() { |
75 gl_FragColor = texture2D(a_texture, v_texCoord); | 75 gl_FragColor = texture2D(a_texture, v_texCoord); |
76 } | 76 } |
77 ); | 77 ); |
78 // clang-format on | 78 // clang-format on |
79 | 79 |
80 std::vector<uint8> GetTexturePixel(const gfx::GpuMemoryBuffer::Format format) { | 80 std::vector<uint8> GetTexturePixel(gfx::GpuMemoryBuffer::Format format) { |
81 std::vector<uint8> pixel; | 81 std::vector<uint8> pixel; |
82 switch (format) { | 82 switch (format) { |
83 case gfx::GpuMemoryBuffer::R_8: | 83 case gfx::GpuMemoryBuffer::R_8: |
84 pixel.push_back(255u); | 84 pixel.push_back(255u); |
85 return pixel; | 85 return pixel; |
86 case gfx::GpuMemoryBuffer::RGBA_8888: | 86 case gfx::GpuMemoryBuffer::RGBA_8888: |
87 pixel.push_back(255u); | 87 pixel.push_back(255u); |
88 pixel.push_back(0u); | 88 pixel.push_back(0u); |
89 pixel.push_back(0u); | 89 pixel.push_back(0u); |
90 pixel.push_back(255u); | 90 pixel.push_back(255u); |
(...skipping 13 matching lines...) Expand all Loading... |
104 case gfx::GpuMemoryBuffer::YUV_420: | 104 case gfx::GpuMemoryBuffer::YUV_420: |
105 NOTREACHED(); | 105 NOTREACHED(); |
106 return std::vector<uint8>(); | 106 return std::vector<uint8>(); |
107 } | 107 } |
108 | 108 |
109 NOTREACHED(); | 109 NOTREACHED(); |
110 return std::vector<uint8>(); | 110 return std::vector<uint8>(); |
111 } | 111 } |
112 | 112 |
113 std::vector<uint8> GetFramebufferPixel( | 113 std::vector<uint8> GetFramebufferPixel( |
114 const gfx::GpuMemoryBuffer::Format format) { | 114 gfx::GpuMemoryBuffer::Format format) { |
115 std::vector<uint8> pixel; | 115 std::vector<uint8> pixel; |
116 switch (format) { | 116 switch (format) { |
117 case gfx::GpuMemoryBuffer::R_8: | 117 case gfx::GpuMemoryBuffer::R_8: |
118 case gfx::GpuMemoryBuffer::RGBA_8888: | 118 case gfx::GpuMemoryBuffer::RGBA_8888: |
119 case gfx::GpuMemoryBuffer::BGRA_8888: | 119 case gfx::GpuMemoryBuffer::BGRA_8888: |
120 pixel.push_back(255u); | 120 pixel.push_back(255u); |
121 pixel.push_back(0u); | 121 pixel.push_back(0u); |
122 pixel.push_back(0u); | 122 pixel.push_back(0u); |
123 pixel.push_back(255u); | 123 pixel.push_back(255u); |
124 return pixel; | 124 return pixel; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 } | 251 } |
252 | 252 |
253 INSTANTIATE_TEST_CASE_P(GpuMemoryBufferTests, | 253 INSTANTIATE_TEST_CASE_P(GpuMemoryBufferTests, |
254 GpuMemoryBufferTest, | 254 GpuMemoryBufferTest, |
255 ::testing::Values(gfx::GpuMemoryBuffer::R_8, | 255 ::testing::Values(gfx::GpuMemoryBuffer::R_8, |
256 gfx::GpuMemoryBuffer::RGBA_8888, | 256 gfx::GpuMemoryBuffer::RGBA_8888, |
257 gfx::GpuMemoryBuffer::BGRA_8888)); | 257 gfx::GpuMemoryBuffer::BGRA_8888)); |
258 | 258 |
259 } // namespace gles2 | 259 } // namespace gles2 |
260 } // namespace gpu | 260 } // namespace gpu |
OLD | NEW |