| 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 10110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10121 } | 10121 } |
| 10122 | 10122 |
| 10123 texture_manager()->SetLevelInfo( | 10123 texture_manager()->SetLevelInfo( |
| 10124 dest_texture_ref, GL_TEXTURE_2D, level, internal_format, source_width, | 10124 dest_texture_ref, GL_TEXTURE_2D, level, internal_format, source_width, |
| 10125 source_height, 1, 0, internal_format, dest_type, true); | 10125 source_height, 1, 0, internal_format, dest_type, true); |
| 10126 } else { | 10126 } else { |
| 10127 texture_manager()->SetLevelCleared( | 10127 texture_manager()->SetLevelCleared( |
| 10128 dest_texture_ref, GL_TEXTURE_2D, level, true); | 10128 dest_texture_ref, GL_TEXTURE_2D, level, true); |
| 10129 } | 10129 } |
| 10130 | 10130 |
| 10131 ScopedModifyPixels modify(dest_texture_ref); |
| 10132 |
| 10133 // Try using GLImage::CopyTexImage when possible. |
| 10134 bool unpack_premultiply_alpha_change = |
| 10135 unpack_premultiply_alpha_ ^ unpack_unpremultiply_alpha_; |
| 10136 if (image && !unpack_flip_y_ && !unpack_premultiply_alpha_change && !level) { |
| 10137 glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); |
| 10138 if (image->CopyTexImage(GL_TEXTURE_2D)) |
| 10139 return; |
| 10140 } |
| 10141 |
| 10131 DoWillUseTexImageIfNeeded(source_texture, source_texture->target()); | 10142 DoWillUseTexImageIfNeeded(source_texture, source_texture->target()); |
| 10132 ScopedModifyPixels modify(dest_texture_ref); | |
| 10133 | 10143 |
| 10134 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix | 10144 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix |
| 10135 // before presenting. | 10145 // before presenting. |
| 10136 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { | 10146 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { |
| 10137 // TODO(hkuang): get the StreamTexture transform matrix in GPU process | 10147 // TODO(hkuang): get the StreamTexture transform matrix in GPU process |
| 10138 // instead of using default matrix crbug.com/226218. | 10148 // instead of using default matrix crbug.com/226218. |
| 10139 const static GLfloat default_matrix[16] = {1.0f, 0.0f, 0.0f, 0.0f, | 10149 const static GLfloat default_matrix[16] = {1.0f, 0.0f, 0.0f, 0.0f, |
| 10140 0.0f, 1.0f, 0.0f, 0.0f, | 10150 0.0f, 1.0f, 0.0f, 0.0f, |
| 10141 0.0f, 0.0f, 1.0f, 0.0f, | 10151 0.0f, 0.0f, 1.0f, 0.0f, |
| 10142 0.0f, 0.0f, 0.0f, 1.0f}; | 10152 0.0f, 0.0f, 0.0f, 1.0f}; |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11017 } | 11027 } |
| 11018 } | 11028 } |
| 11019 | 11029 |
| 11020 // Include the auto-generated part of this file. We split this because it means | 11030 // Include the auto-generated part of this file. We split this because it means |
| 11021 // we can easily edit the non-auto generated parts right here in this file | 11031 // we can easily edit the non-auto generated parts right here in this file |
| 11022 // instead of having to edit some template or the code generator. | 11032 // instead of having to edit some template or the code generator. |
| 11023 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 11033 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 11024 | 11034 |
| 11025 } // namespace gles2 | 11035 } // namespace gles2 |
| 11026 } // namespace gpu | 11036 } // namespace gpu |
| OLD | NEW |