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 "content/common/gpu/client/gl_helper_readback_support.h" | 5 #include "content/common/gpu/client/gl_helper_readback_support.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "gpu/GLES2/gl2extchromium.h" | 7 #include "gpu/GLES2/gl2extchromium.h" |
8 #include "third_party/skia/include/core/SkImageInfo.h" | 8 #include "third_party/skia/include/core/SkImageInfo.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 const int kTestSize = 64; | 77 const int kTestSize = 64; |
78 content::ScopedTexture dst_texture(gl_); | 78 content::ScopedTexture dst_texture(gl_); |
79 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, dst_texture); | 79 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, dst_texture); |
80 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 80 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
81 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 81 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
82 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 82 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
83 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 83 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
84 gl_->TexImage2D( | 84 gl_->TexImage2D( |
85 GL_TEXTURE_2D, 0, format, kTestSize, kTestSize, 0, format, type, NULL); | 85 GL_TEXTURE_2D, 0, format, kTestSize, kTestSize, 0, format, type, nullptr); |
86 ScopedFramebuffer dst_framebuffer(gl_); | 86 ScopedFramebuffer dst_framebuffer(gl_); |
87 ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(gl_, | 87 ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(gl_, |
88 dst_framebuffer); | 88 dst_framebuffer); |
89 gl_->FramebufferTexture2D( | 89 gl_->FramebufferTexture2D( |
90 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, dst_texture, 0); | 90 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, dst_texture, 0); |
91 GLint format_tmp = 0, type_tmp = 0; | 91 GLint format_tmp = 0, type_tmp = 0; |
92 gl_->GetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &format_tmp); | 92 gl_->GetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &format_tmp); |
93 gl_->GetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &type_tmp); | 93 gl_->GetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &type_tmp); |
94 *format_out = format_tmp; | 94 *format_out = format_tmp; |
95 *type_out = type_tmp; | 95 *type_out = type_tmp; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 return GLHelperReadbackSupport::NOT_SUPPORTED; | 174 return GLHelperReadbackSupport::NOT_SUPPORTED; |
175 default: | 175 default: |
176 NOTREACHED(); | 176 NOTREACHED(); |
177 break; | 177 break; |
178 } | 178 } |
179 | 179 |
180 return GLHelperReadbackSupport::NOT_SUPPORTED; | 180 return GLHelperReadbackSupport::NOT_SUPPORTED; |
181 } | 181 } |
182 | 182 |
183 } // namespace content | 183 } // namespace content |
OLD | NEW |