OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/texture_manager.h" | 5 #include "gpu/command_buffer/service/texture_manager.h" |
6 #include "base/bits.h" | 6 #include "base/bits.h" |
7 #include "gpu/command_buffer/service/context_group.h" | 7 #include "gpu/command_buffer/service/context_group.h" |
8 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 8 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
9 | 9 |
10 namespace gpu { | 10 namespace gpu { |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 : max_texture_size_(max_texture_size), | 258 : max_texture_size_(max_texture_size), |
259 max_cube_map_texture_size_(max_cube_map_texture_size), | 259 max_cube_map_texture_size_(max_cube_map_texture_size), |
260 max_levels_(ComputeMipMapCount(max_texture_size, | 260 max_levels_(ComputeMipMapCount(max_texture_size, |
261 max_texture_size, | 261 max_texture_size, |
262 max_texture_size)), | 262 max_texture_size)), |
263 max_cube_map_levels_(ComputeMipMapCount(max_cube_map_texture_size, | 263 max_cube_map_levels_(ComputeMipMapCount(max_cube_map_texture_size, |
264 max_cube_map_texture_size, | 264 max_cube_map_texture_size, |
265 max_cube_map_texture_size)) { | 265 max_cube_map_texture_size)) { |
266 } | 266 } |
267 | 267 |
268 void TextureManager::CreateTextureInfo(GLuint texture_id) { | 268 TextureManager::TextureInfo* TextureManager::CreateTextureInfo( |
| 269 GLuint texture_id) { |
| 270 TextureInfo::Ref info(new TextureInfo(texture_id)); |
269 std::pair<TextureInfoMap::iterator, bool> result = | 271 std::pair<TextureInfoMap::iterator, bool> result = |
270 texture_infos_.insert( | 272 texture_infos_.insert(std::make_pair(texture_id, info)); |
271 std::make_pair(texture_id, | |
272 TextureInfo::Ref(new TextureInfo(texture_id)))); | |
273 DCHECK(result.second); | 273 DCHECK(result.second); |
| 274 return info.get(); |
274 } | 275 } |
275 | 276 |
276 TextureManager::TextureInfo* TextureManager::GetTextureInfo( | 277 TextureManager::TextureInfo* TextureManager::GetTextureInfo( |
277 GLuint texture_id) { | 278 GLuint texture_id) { |
278 TextureInfoMap::iterator it = texture_infos_.find(texture_id); | 279 TextureInfoMap::iterator it = texture_infos_.find(texture_id); |
279 return it != texture_infos_.end() ? it->second : NULL; | 280 return it != texture_infos_.end() ? it->second : NULL; |
280 } | 281 } |
281 | 282 |
282 void TextureManager::RemoveTextureInfo(GLuint texture_id) { | 283 void TextureManager::RemoveTextureInfo(GLuint texture_id) { |
283 TextureInfoMap::iterator it = texture_infos_.find(texture_id); | 284 TextureInfoMap::iterator it = texture_infos_.find(texture_id); |
284 if (it != texture_infos_.end()) { | 285 if (it != texture_infos_.end()) { |
285 it->second->MarkAsDeleted(); | 286 it->second->MarkAsDeleted(); |
286 texture_infos_.erase(texture_id); | 287 texture_infos_.erase(texture_id); |
287 } | 288 } |
288 } | 289 } |
289 | 290 |
290 } // namespace gles2 | 291 } // namespace gles2 |
291 } // namespace gpu | 292 } // namespace gpu |
292 | 293 |
293 | 294 |
OLD | NEW |