| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "gpu/command_buffer/service/stream_texture_manager_in_process_android.h
" | 5 #include "gpu/command_buffer/service/stream_texture_manager_in_process_android.h
" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "gpu/command_buffer/service/texture_manager.h" | 9 #include "gpu/command_buffer/service/texture_manager.h" |
| 10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 uint32 stream_id = next_id_++; | 129 uint32 stream_id = next_id_++; |
| 130 base::Closure release_callback = | 130 base::Closure release_callback = |
| 131 base::Bind(&StreamTextureManagerInProcess::OnReleaseStreamTexture, | 131 base::Bind(&StreamTextureManagerInProcess::OnReleaseStreamTexture, |
| 132 weak_factory_.GetWeakPtr(), stream_id); | 132 weak_factory_.GetWeakPtr(), stream_id); |
| 133 scoped_refptr<gfx::GLImage> gl_image(new GLImageImpl(surface_texture, | 133 scoped_refptr<gfx::GLImage> gl_image(new GLImageImpl(surface_texture, |
| 134 release_callback)); | 134 release_callback)); |
| 135 | 135 |
| 136 gfx::Size size = gl_image->GetSize(); | 136 gfx::Size size = gl_image->GetSize(); |
| 137 texture_manager->SetTarget(texture, GL_TEXTURE_EXTERNAL_OES); | 137 texture_manager->SetTarget(texture, GL_TEXTURE_EXTERNAL_OES); |
| 138 texture_manager->SetLevelInfo(texture, | 138 texture_manager->SetLevelInfo(texture, GL_TEXTURE_EXTERNAL_OES, 0, GL_RGBA, |
| 139 GL_TEXTURE_EXTERNAL_OES, | 139 size.width(), size.height(), 1, 0, GL_RGBA, |
| 140 0, | 140 GL_UNSIGNED_BYTE, gfx::Rect(size)); |
| 141 GL_RGBA, | |
| 142 size.width(), | |
| 143 size.height(), | |
| 144 1, | |
| 145 0, | |
| 146 GL_RGBA, | |
| 147 GL_UNSIGNED_BYTE, | |
| 148 true); | |
| 149 texture_manager->SetLevelImage( | 141 texture_manager->SetLevelImage( |
| 150 texture, GL_TEXTURE_EXTERNAL_OES, 0, gl_image.get()); | 142 texture, GL_TEXTURE_EXTERNAL_OES, 0, gl_image.get()); |
| 151 | 143 |
| 152 { | 144 { |
| 153 base::AutoLock lock(map_lock_); | 145 base::AutoLock lock(map_lock_); |
| 154 textures_[stream_id] = surface_texture; | 146 textures_[stream_id] = surface_texture; |
| 155 } | 147 } |
| 156 | 148 |
| 157 if (next_id_ == 0) | 149 if (next_id_ == 0) |
| 158 next_id_++; | 150 next_id_++; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 171 StreamTextureManagerInProcess::GetSurfaceTexture(uint32 stream_id) { | 163 StreamTextureManagerInProcess::GetSurfaceTexture(uint32 stream_id) { |
| 172 base::AutoLock lock(map_lock_); | 164 base::AutoLock lock(map_lock_); |
| 173 TextureMap::const_iterator it = textures_.find(stream_id); | 165 TextureMap::const_iterator it = textures_.find(stream_id); |
| 174 if (it != textures_.end()) | 166 if (it != textures_.end()) |
| 175 return it->second; | 167 return it->second; |
| 176 | 168 |
| 177 return NULL; | 169 return NULL; |
| 178 } | 170 } |
| 179 | 171 |
| 180 } // namespace gpu | 172 } // namespace gpu |
| OLD | NEW |