Chromium Code Reviews| Index: content/renderer/media/android/webmediaplayer_android.cc |
| diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc |
| index 63f256d70d817221d6c3b13afb9b8a388e98c598..89c6ce649657396268a8061fbcdca3de830af1a3 100644 |
| --- a/content/renderer/media/android/webmediaplayer_android.cc |
| +++ b/content/renderer/media/android/webmediaplayer_android.cc |
| @@ -634,8 +634,10 @@ void WebMediaPlayerAndroid::paint(blink::WebCanvas* canvas, |
| unsigned textureId = static_cast<unsigned>( |
| (bitmap_.getTexture())->getTextureHandle()); |
| - if (!copyVideoTextureToPlatformTexture(context3D, textureId, |
| - GL_RGBA, GL_UNSIGNED_BYTE, true, false)) { |
| + if (!copyVideoTextureToPlatformTexture( |
| + context3D, |
| + {CopyVideoTextureParams::FullCopy, GL_TEXTURE_2D, textureId, GL_RGBA, |
|
DaleCurtis
2015/10/21 18:35:50
Hmm, does this work by way of a C++11 initializer
dshwang
2015/10/21 19:31:07
Yes, it's by C++11 initializer list; https://googl
DaleCurtis
2015/10/22 00:35:28
Yup, banned wholesale currently https://chromium-c
dshwang
2015/10/22 13:23:03
Thanks for investigation. I replace it to construc
|
| + GL_UNSIGNED_BYTE, 0, 0, 0, true, false})) { |
| return; |
| } |
| @@ -655,12 +657,12 @@ void WebMediaPlayerAndroid::paint(blink::WebCanvas* canvas, |
| bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture( |
| blink::WebGraphicsContext3D* web_graphics_context, |
| - unsigned int texture, |
| - unsigned int internal_format, |
| - unsigned int type, |
| - bool premultiply_alpha, |
| - bool flip_y) { |
| + const CopyVideoTextureParams& params) { |
| DCHECK(main_thread_checker_.CalledOnValidThread()); |
| + DCHECK((params.copyType == CopyVideoTextureParams::FullCopy && |
| + !params.xoffset && !params.yoffset) || |
| + (params.copyType == CopyVideoTextureParams::SubCopy && |
| + !params.internalFormat && !params.type)); |
| // Don't allow clients to copy an encrypted video frame. |
| if (needs_external_surface_) |
| return false; |
| @@ -691,9 +693,17 @@ bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture( |
| // value down to get the expected result. |
| // flip_y==true means to reverse the video orientation while |
| // flip_y==false means to keep the intrinsic orientation. |
| - web_graphics_context->copyTextureCHROMIUM( |
| - GL_TEXTURE_2D, src_texture, texture, internal_format, type, |
| - flip_y, premultiply_alpha, false); |
| + if (params.copyType == CopyVideoTextureParams::FullCopy) { |
| + web_graphics_context->copyTextureCHROMIUM( |
| + params.target, src_texture, params.texture, params.internalFormat, |
| + params.type, params.flipY, params.premultiplyAlpha, false); |
| + } else { |
| + web_graphics_context->copySubTextureCHROMIUM( |
| + params.target, src_texture, params.texture, params.xoffset, |
| + params.yoffset, 0, 0, video_frame->natural_size().width(), |
| + video_frame->natural_size().height(), params.flipY, |
| + params.premultiplyAlpha, false); |
| + } |
| web_graphics_context->deleteTexture(src_texture); |
| web_graphics_context->flush(); |