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/browser/compositor/gl_helper_readback_support.h" | |
6 #include "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "components/display_compositor/gl_helper_readback_support.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 display_compositor { |
11 | 11 |
12 GLHelperReadbackSupport::GLHelperReadbackSupport(gpu::gles2::GLES2Interface* gl) | 12 GLHelperReadbackSupport::GLHelperReadbackSupport(gpu::gles2::GLES2Interface* gl) |
13 : gl_(gl) { | 13 : gl_(gl) { |
14 InitializeReadbackSupport(); | 14 InitializeReadbackSupport(); |
15 } | 15 } |
16 | 16 |
17 GLHelperReadbackSupport::~GLHelperReadbackSupport() {} | 17 GLHelperReadbackSupport::~GLHelperReadbackSupport() {} |
18 | 18 |
19 void GLHelperReadbackSupport::InitializeReadbackSupport() { | 19 void GLHelperReadbackSupport::InitializeReadbackSupport() { |
20 // We are concerned about 16, 32-bit formats only. The below are the most | 20 // We are concerned about 16, 32-bit formats only. The below are the most |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 GLenum* type_out) { | 68 GLenum* type_out) { |
69 for (unsigned int i = 0; i < format_cache_.size(); i++) { | 69 for (unsigned int i = 0; i < format_cache_.size(); i++) { |
70 if (format_cache_[i].format == format && format_cache_[i].type == type) { | 70 if (format_cache_[i].format == format && format_cache_[i].type == type) { |
71 *format_out = format_cache_[i].read_format; | 71 *format_out = format_cache_[i].read_format; |
72 *type_out = format_cache_[i].read_type; | 72 *type_out = format_cache_[i].read_type; |
73 return; | 73 return; |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 const int kTestSize = 64; | 77 const int kTestSize = 64; |
78 content::ScopedTexture dst_texture(gl_); | 78 display_compositor::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(GL_TEXTURE_2D, 0, format, kTestSize, kTestSize, 0, format, | 84 gl_->TexImage2D(GL_TEXTURE_2D, 0, format, kTestSize, kTestSize, 0, format, |
85 type, NULL); | 85 type, NULL); |
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); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 case kARGB_4444_SkColorType: | 162 case kARGB_4444_SkColorType: |
163 return GLHelperReadbackSupport::NOT_SUPPORTED; | 163 return GLHelperReadbackSupport::NOT_SUPPORTED; |
164 default: | 164 default: |
165 NOTREACHED(); | 165 NOTREACHED(); |
166 break; | 166 break; |
167 } | 167 } |
168 | 168 |
169 return GLHelperReadbackSupport::NOT_SUPPORTED; | 169 return GLHelperReadbackSupport::NOT_SUPPORTED; |
170 } | 170 } |
171 | 171 |
172 } // namespace content | 172 } // namespace display_compositor |
OLD | NEW |