| 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 // 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 <stdio.h> | 8 #include <stdio.h> | 
| 9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> | 
| 10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> | 
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 438       *ret_padded_row_size = row_size; | 438       *ret_padded_row_size = row_size; | 
| 439     } | 439     } | 
| 440   } | 440   } | 
| 441   if (ret_unpadded_row_size) { | 441   if (ret_unpadded_row_size) { | 
| 442     *ret_unpadded_row_size = row_size; | 442     *ret_unpadded_row_size = row_size; | 
| 443   } | 443   } | 
| 444 | 444 | 
| 445   return true; | 445   return true; | 
| 446 } | 446 } | 
| 447 | 447 | 
|  | 448 bool GLES2Util::ComputeEstimatedRenderbufferSize( | 
|  | 449     int width, int height, int samples, int internal_format, uint32* size) { | 
|  | 450   uint32 temp = 0; | 
|  | 451   if (!SafeMultiplyUint32(width, height, &temp)) { | 
|  | 452     return false; | 
|  | 453   } | 
|  | 454   if (!SafeMultiplyUint32(temp, samples, &temp)) { | 
|  | 455     return false; | 
|  | 456   } | 
|  | 457   if (!SafeMultiplyUint32( | 
|  | 458       temp, GLES2Util::RenderbufferBytesPerPixel(internal_format), &temp)) { | 
|  | 459     return false; | 
|  | 460   } | 
|  | 461   *size = temp; | 
|  | 462   return true; | 
|  | 463 } | 
|  | 464 | 
| 448 size_t GLES2Util::RenderbufferBytesPerPixel(int format) { | 465 size_t GLES2Util::RenderbufferBytesPerPixel(int format) { | 
| 449   switch (format) { | 466   switch (format) { | 
| 450     case GL_STENCIL_INDEX8: | 467     case GL_STENCIL_INDEX8: | 
| 451       return 1; | 468       return 1; | 
| 452     case GL_RGBA4: | 469     case GL_RGBA4: | 
| 453     case GL_RGB565: | 470     case GL_RGB565: | 
| 454     case GL_RGB5_A1: | 471     case GL_RGB5_A1: | 
| 455     case GL_DEPTH_COMPONENT16: | 472     case GL_DEPTH_COMPONENT16: | 
| 456       return 2; | 473       return 2; | 
| 457     case GL_RGB: | 474     case GL_RGB: | 
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 792   } | 809   } | 
| 793 | 810 | 
| 794   return true; | 811   return true; | 
| 795 } | 812 } | 
| 796 | 813 | 
| 797 #include "../common/gles2_cmd_utils_implementation_autogen.h" | 814 #include "../common/gles2_cmd_utils_implementation_autogen.h" | 
| 798 | 815 | 
| 799 }  // namespace gles2 | 816 }  // namespace gles2 | 
| 800 }  // namespace gpu | 817 }  // namespace gpu | 
| 801 | 818 | 
| OLD | NEW | 
|---|