Chromium Code Reviews| 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/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 5900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5911 GL_INVALID_OPERATION)) { | 5911 GL_INVALID_OPERATION)) { |
| 5912 if (params) { | 5912 if (params) { |
| 5913 *params = 0; | 5913 *params = 0; |
| 5914 } | 5914 } |
| 5915 return true; | 5915 return true; |
| 5916 } | 5916 } |
| 5917 if (params) { | 5917 if (params) { |
| 5918 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper", | 5918 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper", |
| 5919 GetErrorState()); | 5919 GetErrorState()); |
| 5920 glGetIntegerv(pname, params); | 5920 glGetIntegerv(pname, params); |
| 5921 if (glGetError() != GL_NO_ERROR) { | 5921 bool is_valid_format = true; |
|
Zhenyao Mo
2016/07/19 16:42:38
You just need one is_valid, and you can initialize
| |
| 5922 bool is_valid_type = true; | |
| 5923 if (pname == GL_IMPLEMENTATION_COLOR_READ_FORMAT) { | |
| 5924 is_valid_format = validators_->read_pixel_format.IsValid(*params); | |
| 5925 } else { | |
| 5926 is_valid_type = validators_->read_pixel_type.IsValid(*params); | |
| 5927 } | |
|
qiankun
2016/07/19 09:16:29
Maybe" ? : " is simpler than if-else. You just nee
| |
| 5928 if (glGetError() != GL_NO_ERROR || !is_valid_format || | |
| 5929 !is_valid_type) { | |
|
yunchao
2016/07/19 09:39:32
What it returns if the format/type is invalid?
| |
| 5922 if (pname == GL_IMPLEMENTATION_COLOR_READ_FORMAT) { | 5930 if (pname == GL_IMPLEMENTATION_COLOR_READ_FORMAT) { |
| 5923 *params = GLES2Util::GetGLReadPixelsImplementationFormat( | 5931 *params = GLES2Util::GetGLReadPixelsImplementationFormat( |
| 5924 GetBoundReadFrameBufferInternalFormat(), | 5932 GetBoundReadFrameBufferInternalFormat(), |
| 5925 GetBoundReadFrameBufferTextureType(), | 5933 GetBoundReadFrameBufferTextureType(), |
| 5926 feature_info_->feature_flags().ext_read_format_bgra); | 5934 feature_info_->feature_flags().ext_read_format_bgra); |
| 5927 } else { | 5935 } else { |
| 5928 *params = GLES2Util::GetGLReadPixelsImplementationType( | 5936 *params = GLES2Util::GetGLReadPixelsImplementationType( |
| 5929 GetBoundReadFrameBufferInternalFormat(), | 5937 GetBoundReadFrameBufferInternalFormat(), |
| 5930 GetBoundReadFrameBufferTextureType()); | 5938 GetBoundReadFrameBufferTextureType()); |
| 5931 } | 5939 } |
| (...skipping 11472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 17404 } | 17412 } |
| 17405 | 17413 |
| 17406 // Include the auto-generated part of this file. We split this because it means | 17414 // Include the auto-generated part of this file. We split this because it means |
| 17407 // we can easily edit the non-auto generated parts right here in this file | 17415 // we can easily edit the non-auto generated parts right here in this file |
| 17408 // instead of having to edit some template or the code generator. | 17416 // instead of having to edit some template or the code generator. |
| 17409 #include "base/macros.h" | 17417 #include "base/macros.h" |
| 17410 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17418 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 17411 | 17419 |
| 17412 } // namespace gles2 | 17420 } // namespace gles2 |
| 17413 } // namespace gpu | 17421 } // namespace gpu |
| OLD | NEW |