Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: webkit/media/android/webmediaplayer_android.cc

Issue 13620008: Enable 2D Canvas painting for Chrome on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing scherkus's comments. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webkit/media/android/webmediaplayer_android.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "webkit/media/android/webmediaplayer_android.h" 5 #include "webkit/media/android/webmediaplayer_android.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "cc/layers/video_layer.h" 10 #include "cc/layers/video_layer.h"
11 #include "gpu/GLES2/gl2extchromium.h"
11 #include "media/base/android/media_player_bridge.h" 12 #include "media/base/android/media_player_bridge.h"
12 #include "media/base/video_frame.h" 13 #include "media/base/video_frame.h"
13 #include "net/base/mime_util.h" 14 #include "net/base/mime_util.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient. h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient. h"
15 #include "webkit/compositor_bindings/web_layer_impl.h" 16 #include "webkit/compositor_bindings/web_layer_impl.h"
16 #include "webkit/media/android/webmediaplayer_manager_android.h" 17 #include "webkit/media/android/webmediaplayer_manager_android.h"
17 #include "webkit/media/media_switches.h" 18 #include "webkit/media/media_switches.h"
18 #include "webkit/media/webmediaplayer_util.h" 19 #include "webkit/media/webmediaplayer_util.h"
19 20
20 static const uint32 kGLTextureExternalOES = 0x8D65; 21 static const uint32 kGLTextureExternalOES = 0x8D65;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 240
240 void WebMediaPlayerAndroid::setSize(const WebKit::WebSize& size) { 241 void WebMediaPlayerAndroid::setSize(const WebKit::WebSize& size) {
241 } 242 }
242 243
243 void WebMediaPlayerAndroid::paint(WebKit::WebCanvas* canvas, 244 void WebMediaPlayerAndroid::paint(WebKit::WebCanvas* canvas,
244 const WebKit::WebRect& rect, 245 const WebKit::WebRect& rect,
245 uint8_t alpha) { 246 uint8_t alpha) {
246 NOTIMPLEMENTED(); 247 NOTIMPLEMENTED();
247 } 248 }
248 249
250 bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture(
251 WebKit::WebGraphicsContext3D* web_graphics_context,
252 unsigned int texture,
253 unsigned int level,
254 unsigned int internal_format,
255 bool premultiply_alpha,
256 bool flip_y) {
257 if (!texture_id_)
258 return false;
259
260 // The video is stored in a unmultiplied format, so premultiply if
xhwang 2013/04/16 17:51:36 nit: s/a/an/
hkuang1 2013/04/18 01:05:07 Done.
261 // necessary.
262 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
263 premultiply_alpha);
264
265 // Application itself needs to take care of setting the right flip_y
266 // value down to get the expected result.
267 // flip_y==true means to reverse the video orientation while
268 // flip_y==false means to keep the intrinsic orientation.
269 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y);
270 web_graphics_context->copyTextureCHROMIUM(GL_TEXTURE_2D, texture_id_,
271 texture, level, internal_format);
272 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false);
273 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
274 false);
xhwang 2013/04/16 17:51:36 We have web_graphics_context->flush() for better p
hkuang1 2013/04/18 01:05:07 This may bring some performance gain on desktop pl
275 return true;
276 }
277
249 bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const { 278 bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const {
250 return false; 279 return false;
251 } 280 }
252 281
253 bool WebMediaPlayerAndroid::didPassCORSAccessCheck() const { 282 bool WebMediaPlayerAndroid::didPassCORSAccessCheck() const {
254 return false; 283 return false;
255 } 284 }
256 285
257 WebMediaPlayer::MovieLoadType WebMediaPlayerAndroid::movieLoadType() const { 286 WebMediaPlayer::MovieLoadType WebMediaPlayerAndroid::movieLoadType() const {
258 // Deprecated. 287 // Deprecated.
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 503
475 void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) { 504 void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) {
476 needs_establish_peer_ = needs_establish_peer; 505 needs_establish_peer_ = needs_establish_peer;
477 } 506 }
478 507
479 void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) { 508 void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) {
480 is_playing_ = is_playing; 509 is_playing_ = is_playing;
481 } 510 }
482 511
483 } // namespace webkit_media 512 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/android/webmediaplayer_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698