OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/gles2_cmd_utils.h" | 7 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
8 #include "gpu/command_buffer/service/feature_info.h" | 8 #include "gpu/command_buffer/service/feature_info.h" |
9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
10 #include "gpu/command_buffer/service/mailbox_manager.h" | 10 #include "gpu/command_buffer/service/mailbox_manager.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 GLint xoffset, | 324 GLint xoffset, |
325 GLint yoffset, | 325 GLint yoffset, |
326 GLsizei width, | 326 GLsizei width, |
327 GLsizei height, | 327 GLsizei height, |
328 GLenum format, | 328 GLenum format, |
329 GLenum type) const { | 329 GLenum type) const { |
330 size_t face_index = GLTargetToFaceIndex(face); | 330 size_t face_index = GLTargetToFaceIndex(face); |
331 if (level >= 0 && face_index < level_infos_.size() && | 331 if (level >= 0 && face_index < level_infos_.size() && |
332 static_cast<size_t>(level) < level_infos_[face_index].size()) { | 332 static_cast<size_t>(level) < level_infos_[face_index].size()) { |
333 const LevelInfo& info = level_infos_[GLTargetToFaceIndex(face)][level]; | 333 const LevelInfo& info = level_infos_[GLTargetToFaceIndex(face)][level]; |
334 GLint right; | 334 int32 right; |
335 GLint top; | 335 int32 top; |
336 return SafeAdd(xoffset, width, &right) && | 336 return SafeAddInt32(xoffset, width, &right) && |
337 SafeAdd(yoffset, height, &top) && | 337 SafeAddInt32(yoffset, height, &top) && |
338 xoffset >= 0 && | 338 xoffset >= 0 && |
339 yoffset >= 0 && | 339 yoffset >= 0 && |
340 right <= info.width && | 340 right <= info.width && |
341 top <= info.height && | 341 top <= info.height && |
342 format == info.internal_format && | 342 format == info.internal_format && |
343 type == info.type; | 343 type == info.type; |
344 } | 344 } |
345 return false; | 345 return false; |
346 } | 346 } |
347 | 347 |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 | 1044 |
1045 GLsizei TextureManager::ComputeMipMapCount( | 1045 GLsizei TextureManager::ComputeMipMapCount( |
1046 GLsizei width, GLsizei height, GLsizei depth) { | 1046 GLsizei width, GLsizei height, GLsizei depth) { |
1047 return 1 + base::bits::Log2Floor(std::max(std::max(width, height), depth)); | 1047 return 1 + base::bits::Log2Floor(std::max(std::max(width, height), depth)); |
1048 } | 1048 } |
1049 | 1049 |
1050 } // namespace gles2 | 1050 } // namespace gles2 |
1051 } // namespace gpu | 1051 } // namespace gpu |
1052 | 1052 |
1053 | 1053 |
OLD | NEW |