Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: gpu/command_buffer/common/gles2_cmd_utils.cc

Issue 1516683007: Remove code duplication in GPU command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/common/gles2_cmd_utils.cc
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.cc b/gpu/command_buffer/common/gles2_cmd_utils.cc
index 30f4e2b720bac6940909673e1e91474deb35641c..c0a5cd5ec714ce808cf9e5682a055775d5f7eb79 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.cc
+++ b/gpu/command_buffer/common/gles2_cmd_utils.cc
@@ -542,40 +542,11 @@ bool GLES2Util::ComputeImageDataSizes(
int width, int height, int depth, int format, int type,
int alignment, uint32* size, uint32* opt_unpadded_row_size,
uint32* opt_padded_row_size) {
- DCHECK(width >= 0 && height >= 0 && depth >= 0);
-
- uint32 bytes_per_group = ComputeImageGroupSize(format, type);
-
- uint32 unpadded_row_size;
- uint32 padded_row_size;
- if (!ComputeImageRowSizeHelper(width, bytes_per_group, alignment,
- &unpadded_row_size, &padded_row_size)) {
- return false;
- }
- uint32 num_of_rows;
- if (!SafeMultiplyUint32(height, depth, &num_of_rows)) {
- return false;
- }
- if (num_of_rows > 0) {
- uint32 size_of_all_but_last_row;
- if (!SafeMultiplyUint32((num_of_rows - 1), padded_row_size,
- &size_of_all_but_last_row)) {
- return false;
- }
- if (!SafeAddUint32(size_of_all_but_last_row, unpadded_row_size, size)) {
- return false;
- }
- } else {
- *size = 0;
- }
- if (opt_padded_row_size) {
- *opt_padded_row_size = padded_row_size;
- }
- if (opt_unpadded_row_size) {
- *opt_unpadded_row_size = unpadded_row_size;
- }
-
- return true;
+ PixelStoreParams params;
+ params.alignment = alignment;
+ return ComputeImageDataSizesES3(
+ width, height, depth, format, type, params,
+ size, opt_unpadded_row_size, opt_padded_row_size, nullptr);
}
bool GLES2Util::ComputeImageDataSizesES3(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698