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 4e6db8694bfc0730f3b2e3cf265ee2ca9dc854e1..69ec1a7c2a13991ceb884c0790df8f8350d1593c 100644 |
--- a/content/renderer/media/android/webmediaplayer_android.cc |
+++ b/content/renderer/media/android/webmediaplayer_android.cc |
@@ -635,8 +635,11 @@ void WebMediaPlayerAndroid::paint(blink::WebCanvas* canvas, |
unsigned textureId = static_cast<unsigned>( |
(bitmap_.getTexture())->getTextureHandle()); |
DaleCurtis
2015/10/29 15:58:33
alignment seems wrong, git cl format?
dshwang
2015/10/29 17:44:46
"git cl format" produces this indentation.
|
- if (!copyVideoTextureToPlatformTexture(context3D, textureId, |
- GL_RGBA, GL_UNSIGNED_BYTE, true, false)) { |
+ if (!copyVideoTextureToPlatformTexture( |
+ context3D, |
+ CopyVideoTextureParams(CopyVideoTextureParams::FullCopy, |
+ GL_TEXTURE_2D, textureId, GL_RGBA, |
+ GL_UNSIGNED_BYTE, 0, 0, 0, true, false))) { |
return; |
} |
@@ -660,12 +663,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; |
@@ -696,9 +699,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(); |