| 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 GLint xoffset, | 352 GLint xoffset, |
| 353 GLint yoffset, | 353 GLint yoffset, |
| 354 GLsizei width, | 354 GLsizei width, |
| 355 GLsizei height, | 355 GLsizei height, |
| 356 GLenum format, | 356 GLenum format, |
| 357 GLenum type) const { | 357 GLenum type) const { |
| 358 size_t face_index = GLTargetToFaceIndex(face); | 358 size_t face_index = GLTargetToFaceIndex(face); |
| 359 if (level >= 0 && face_index < level_infos_.size() && | 359 if (level >= 0 && face_index < level_infos_.size() && |
| 360 static_cast<size_t>(level) < level_infos_[face_index].size()) { | 360 static_cast<size_t>(level) < level_infos_[face_index].size()) { |
| 361 const LevelInfo& info = level_infos_[GLTargetToFaceIndex(face)][level]; | 361 const LevelInfo& info = level_infos_[GLTargetToFaceIndex(face)][level]; |
| 362 GLint right; | 362 int32 right; |
| 363 GLint top; | 363 int32 top; |
| 364 return SafeAdd(xoffset, width, &right) && | 364 return SafeAddInt32(xoffset, width, &right) && |
| 365 SafeAdd(yoffset, height, &top) && | 365 SafeAddInt32(yoffset, height, &top) && |
| 366 xoffset >= 0 && | 366 xoffset >= 0 && |
| 367 yoffset >= 0 && | 367 yoffset >= 0 && |
| 368 right <= info.width && | 368 right <= info.width && |
| 369 top <= info.height && | 369 top <= info.height && |
| 370 format == info.internal_format && | 370 format == info.internal_format && |
| 371 type == info.type; | 371 type == info.type; |
| 372 } | 372 } |
| 373 return false; | 373 return false; |
| 374 } | 374 } |
| 375 | 375 |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 return false; | 1070 return false; |
| 1071 } | 1071 } |
| 1072 | 1072 |
| 1073 GLsizei TextureManager::ComputeMipMapCount( | 1073 GLsizei TextureManager::ComputeMipMapCount( |
| 1074 GLsizei width, GLsizei height, GLsizei depth) { | 1074 GLsizei width, GLsizei height, GLsizei depth) { |
| 1075 return 1 + base::bits::Log2Floor(std::max(std::max(width, height), depth)); | 1075 return 1 + base::bits::Log2Floor(std::max(std::max(width, height), depth)); |
| 1076 } | 1076 } |
| 1077 | 1077 |
| 1078 } // namespace gles2 | 1078 } // namespace gles2 |
| 1079 } // namespace gpu | 1079 } // namespace gpu |
| OLD | NEW |