OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // This file is here so other GLES2 related files can have a common set of | 5 // This file is here so other GLES2 related files can have a common set of |
6 // includes where appropriate. | 6 // includes where appropriate. |
7 | 7 |
8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
10 | 10 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 default: | 325 default: |
326 return 0; | 326 return 0; |
327 } | 327 } |
328 } | 328 } |
329 | 329 |
330 } // anonymous namespace | 330 } // anonymous namespace |
331 | 331 |
332 // Returns the amount of data glTexImage2D or glTexSubImage2D will access. | 332 // Returns the amount of data glTexImage2D or glTexSubImage2D will access. |
333 uint32 GLES2Util::ComputeImageDataSize( | 333 uint32 GLES2Util::ComputeImageDataSize( |
334 int width, int height, int format, int type, int unpack_alignment) { | 334 int width, int height, int format, int type, int unpack_alignment) { |
335 uint32 bytes_per_group = BytesPerElement(ElementsPerGroup(format, type)); | 335 uint32 bytes_per_group = |
| 336 BytesPerElement(type) * ElementsPerGroup(format, type); |
336 uint32 row_size = width * bytes_per_group; | 337 uint32 row_size = width * bytes_per_group; |
337 if (height > 1) { | 338 if (height > 1) { |
338 uint32 padded_row_size = ((row_size + unpack_alignment - 1) / | 339 uint32 padded_row_size = ((row_size + unpack_alignment - 1) / |
339 unpack_alignment) * unpack_alignment; | 340 unpack_alignment) * unpack_alignment; |
340 return height - 1 * padded_row_size + row_size; | 341 return (height - 1) * padded_row_size + row_size; |
341 } | 342 } |
342 return height * row_size; | 343 return height * row_size; |
343 } | 344 } |
344 | 345 |
345 } // namespace gles2 | 346 } // namespace gles2 |
346 } // namespace command_buffer | 347 } // namespace command_buffer |
347 | 348 |
OLD | NEW |