Chromium Code Reviews| Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| index 5e1ec96deb2db0e2627a09fcd24820b653c90b71..55564cc33201aa963c9f5075896cbc6ccf651a14 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| @@ -13809,34 +13809,29 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM( |
| DoCopyTexImageIfNeeded(source_texture, source_target); |
| - // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix |
| + // GL_TEXTURE_EXTERNAL_OES texture requires that we apply a transform matrix |
| // before presenting. |
| if (source_target == GL_TEXTURE_EXTERNAL_OES) { |
| - // TODO(hkuang): get the StreamTexture transform matrix in GPU process |
| - // instead of using kIdentityMatrix crbug.com/226218. AVDACodecImage does |
| - // this correctly, but others (e.g., stream_texture_android.cc) don't. |
| - // (crbug.com/371500, crbug.com/588837) |
| - GLfloat transform_matrix[16]; |
| - memcpy(transform_matrix, kIdentityMatrix, sizeof(transform_matrix)); |
| if (GLStreamTextureImage* image = |
|
no sievers
2016/03/18 01:34:11
nit: merge ifs
|
| source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, |
| 0)) { |
| - image->GetTextureMatrix(transform_matrix); |
| + // The coordinate system of this matrix is y-up, not y-down, so a flip is |
| + // needed. |
| + GLfloat transform_matrix[16]; |
| + image->GetFlippedTextureMatrix(transform_matrix); |
| + copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
| + this, source_target, source_texture->service_id(), dest_target, |
| + dest_texture->service_id(), source_width, source_height, |
| + unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, |
| + unpack_unmultiply_alpha == GL_TRUE, transform_matrix); |
| + return; |
| } |
| - copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
| - this, source_target, source_texture->service_id(), dest_target, |
| - dest_texture->service_id(), source_width, source_height, |
| - unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, |
| - unpack_unmultiply_alpha == GL_TRUE, transform_matrix); |
| - } else { |
| - copy_texture_CHROMIUM_->DoCopyTexture( |
| - this, source_target, source_texture->service_id(), |
| - source_internal_format, dest_target, dest_texture->service_id(), |
| - internal_format, source_width, source_height, |
| - unpack_flip_y == GL_TRUE, |
| - unpack_premultiply_alpha == GL_TRUE, |
| - unpack_unmultiply_alpha == GL_TRUE); |
| } |
| + copy_texture_CHROMIUM_->DoCopyTexture( |
| + this, source_target, source_texture->service_id(), source_internal_format, |
| + dest_target, dest_texture->service_id(), internal_format, source_width, |
| + source_height, unpack_flip_y == GL_TRUE, |
| + unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE); |
| } |
| void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( |
| @@ -14007,16 +14002,33 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( |
| DoCopyTexImageIfNeeded(source_texture, source_target); |
| - // TODO(hkuang): get the StreamTexture transform matrix in GPU process. |
| - // crbug.com/226218. |
| + |
| + // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix |
| + // before presenting. |
| + if (source_target == GL_TEXTURE_EXTERNAL_OES) { |
| + if (GLStreamTextureImage* image = |
|
no sievers
2016/03/18 01:34:11
nit: merge ifs
Tobias Sargeant
2016/03/18 10:30:13
The inner if declares and assigns |image|, so it c
|
| + source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, |
| + 0)) { |
| + // The coordinate system of this matrix is y-up, not y-down, so a flip is |
| + // needed. |
| + GLfloat transform_matrix[16]; |
| + image->GetFlippedTextureMatrix(transform_matrix); |
| + copy_texture_CHROMIUM_->DoCopySubTextureWithTransform( |
| + this, source_target, source_texture->service_id(), |
| + source_internal_format, dest_target, dest_texture->service_id(), |
| + dest_internal_format, xoffset, yoffset, x, y, width, height, |
| + dest_width, dest_height, source_width, source_height, |
| + unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, |
| + unpack_unmultiply_alpha == GL_TRUE, transform_matrix); |
| + return; |
| + } |
| + } |
| copy_texture_CHROMIUM_->DoCopySubTexture( |
| this, source_target, source_texture->service_id(), source_internal_format, |
| - dest_target, dest_texture->service_id(), dest_internal_format, |
| - xoffset, yoffset, x, y, width, height, dest_width, dest_height, |
| - source_width, source_height, |
| - unpack_flip_y == GL_TRUE, |
| - unpack_premultiply_alpha == GL_TRUE, |
| - unpack_unmultiply_alpha == GL_TRUE); |
| + dest_target, dest_texture->service_id(), dest_internal_format, xoffset, |
| + yoffset, x, y, width, height, dest_width, dest_height, source_width, |
| + source_height, unpack_flip_y == GL_TRUE, |
| + unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE); |
| } |
| void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLuint source_id, |
| @@ -14177,22 +14189,11 @@ void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLuint source_id, |
| source_height, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| gfx::Rect(source_width, source_height)); |
| - // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix |
| - // before presenting. |
| - if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { |
| - // TODO(hkuang): get the StreamTexture transform matrix in GPU process |
| - // instead of using kIdentityMatrix crbug.com/226218. |
| - copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
| - this, source_texture->target(), source_texture->service_id(), |
| - dest_texture->target(), dest_texture->service_id(), source_width, |
| - source_height, false, false, false, kIdentityMatrix); |
| - } else { |
| - copy_texture_CHROMIUM_->DoCopyTexture( |
| - this, source_texture->target(), source_texture->service_id(), |
| - source_internal_format, dest_texture->target(), |
| - dest_texture->service_id(), GL_RGBA, source_width, source_height, false, |
| - false, false); |
| - } |
| + copy_texture_CHROMIUM_->DoCopyTexture( |
| + this, source_texture->target(), source_texture->service_id(), |
| + source_internal_format, dest_texture->target(), |
| + dest_texture->service_id(), GL_RGBA, source_width, source_height, false, |
| + false, false); |
| } |
| void GLES2DecoderImpl::DoTexStorage2DEXT( |