Chromium Code Reviews| Index: content/common/gpu/media/android_copying_backing_strategy.cc |
| diff --git a/content/common/gpu/media/android_copying_backing_strategy.cc b/content/common/gpu/media/android_copying_backing_strategy.cc |
| index cf166afc8fc512f13f28bf47f3deb0ee54c70253..fed4aecceedab4b65de068b9116b36b3595706b6 100644 |
| --- a/content/common/gpu/media/android_copying_backing_strategy.cc |
| +++ b/content/common/gpu/media/android_copying_backing_strategy.cc |
| @@ -161,4 +161,33 @@ bool AndroidCopyingBackingStrategy::ArePicturesOverlayable() { |
| return false; |
| } |
| +void AndroidCopyingBackingStrategy::UpdatePictureBufferSize( |
| + media::PictureBuffer* picture_buffer, |
| + const gfx::Size& new_size) { |
| + // This strategy uses 2D textures who's allocated memory is dependent on the |
| + // size. To update size in all places, we must: |
| + // 1) Update the PictureBuffer meta-data |
| + picture_buffer->set_size(new_size); |
| + |
| + // 2) Update the GL texture via glTextImage2D. This step assumes the caller |
| + // has made our GL context current. |
| + glBindTexture(GL_TEXTURE_2D, picture_buffer->texture_id()); |
| + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, new_size.width(), new_size.height(), |
| + 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); |
| + state_provider_->GetGlDecoder()->RestoreActiveTextureUnitBinding( |
| + GL_TEXTURE_2D); |
| + |
| + // 3) Update the CHROMIUM Texture's size. |
| + gpu::gles2::TextureRef* texture_ref = |
| + state_provider_->GetTextureForPicture(*picture_buffer); |
| + RETURN_IF_NULL(texture_ref); |
| + gpu::gles2::TextureManager* texture_manager = |
| + state_provider_->GetGlDecoder()->GetContextGroup()->texture_manager(); |
| + RETURN_IF_NULL(texture_manager); |
| + texture_manager->SetLevelInfo(texture_ref, GetTextureTarget(), 0, GL_RGBA, |
| + new_size.width(), new_size.height(), 1, 0, |
| + GL_RGBA, GL_UNSIGNED_BYTE, |
| + gfx::Rect(new_size.width(), new_size.height())); |
|
liberato (no reviews please)
2016/03/07 16:39:16
i think that gfx::Rect(new_size) works.
chcunningham
2016/03/08 03:19:36
Done.
|
| +} |
| + |
| } // namespace content |