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 <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 6905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6916 | 6916 |
6917 uint32 unpadded_row_size; | 6917 uint32 unpadded_row_size; |
6918 uint32 padded_row_size; | 6918 uint32 padded_row_size; |
6919 if (!GLES2Util::ComputeImageDataSizes( | 6919 if (!GLES2Util::ComputeImageDataSizes( |
6920 width, 2, format, type, state_.pack_alignment, &temp_size, | 6920 width, 2, format, type, state_.pack_alignment, &temp_size, |
6921 &unpadded_row_size, &padded_row_size)) { | 6921 &unpadded_row_size, &padded_row_size)) { |
6922 LOCAL_SET_GL_ERROR( | 6922 LOCAL_SET_GL_ERROR( |
6923 GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); | 6923 GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); |
6924 return error::kNoError; | 6924 return error::kNoError; |
6925 } | 6925 } |
6926 // NOTE: Assumes the type is GL_UNSIGNED_BYTE which was true at the time | |
6927 // of this implementation. | |
6928 if (type != GL_UNSIGNED_BYTE) { | 6926 if (type != GL_UNSIGNED_BYTE) { |
6929 LOCAL_SET_GL_ERROR( | |
6930 GL_INVALID_OPERATION, "glReadPixels", | |
6931 "unsupported readPixel format"); | |
6932 return error::kNoError; | 6927 return error::kNoError; |
6933 } | 6928 } |
6934 switch (format) { | 6929 switch (format) { |
6935 case GL_RGBA: | 6930 case GL_RGBA: |
6936 case GL_BGRA_EXT: | 6931 case GL_BGRA_EXT: |
6937 case GL_ALPHA: { | 6932 case GL_ALPHA: { |
6938 int offset = (format == GL_ALPHA) ? 0 : 3; | 6933 int offset = (format == GL_ALPHA) ? 0 : 3; |
6939 int step = (format == GL_ALPHA) ? 1 : 4; | 6934 int step = (format == GL_ALPHA) ? 1 : 4; |
6940 uint8* dst = static_cast<uint8*>(pixels) + offset; | 6935 uint8* dst = static_cast<uint8*>(pixels) + offset; |
6941 for (GLint yy = 0; yy < height; ++yy) { | 6936 for (GLint yy = 0; yy < height; ++yy) { |
(...skipping 3491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10433 return error::kNoError; | 10428 return error::kNoError; |
10434 } | 10429 } |
10435 | 10430 |
10436 // Include the auto-generated part of this file. We split this because it means | 10431 // Include the auto-generated part of this file. We split this because it means |
10437 // we can easily edit the non-auto generated parts right here in this file | 10432 // we can easily edit the non-auto generated parts right here in this file |
10438 // instead of having to edit some template or the code generator. | 10433 // instead of having to edit some template or the code generator. |
10439 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10434 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10440 | 10435 |
10441 } // namespace gles2 | 10436 } // namespace gles2 |
10442 } // namespace gpu | 10437 } // namespace gpu |
OLD | NEW |