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

Side by Side Diff: Source/WebCore/html/HTMLVideoElement.cpp

Issue 13685002: Enable video painting on Canvas for Chrome on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 16 matching lines...) Expand all
27 #if ENABLE(VIDEO) 27 #if ENABLE(VIDEO)
28 #include "HTMLVideoElement.h" 28 #include "HTMLVideoElement.h"
29 29
30 #include "Attribute.h" 30 #include "Attribute.h"
31 #include "CSSPropertyNames.h" 31 #include "CSSPropertyNames.h"
32 #include "Chrome.h" 32 #include "Chrome.h"
33 #include "ChromeClient.h" 33 #include "ChromeClient.h"
34 #include "Document.h" 34 #include "Document.h"
35 #include "ExceptionCode.h" 35 #include "ExceptionCode.h"
36 #include "Frame.h" 36 #include "Frame.h"
37 #include "GraphicsContext3D.h"
37 #include "HTMLImageLoader.h" 38 #include "HTMLImageLoader.h"
38 #include "HTMLNames.h" 39 #include "HTMLNames.h"
39 #include "HTMLParserIdioms.h" 40 #include "HTMLParserIdioms.h"
40 #include "Page.h" 41 #include "Page.h"
41 #include "RenderImage.h" 42 #include "RenderImage.h"
42 #include "RenderVideo.h" 43 #include "RenderVideo.h"
43 #include "ScriptController.h" 44 #include "ScriptController.h"
44 #include "Settings.h" 45 #include "Settings.h"
46 #include "SharedGraphicsContext3D.h"
45 47
46 namespace WebCore { 48 namespace WebCore {
47 49
48 using namespace HTMLNames; 50 using namespace HTMLNames;
49 51
50 inline HTMLVideoElement::HTMLVideoElement(const QualifiedName& tagName, Document * document, bool createdByParser) 52 inline HTMLVideoElement::HTMLVideoElement(const QualifiedName& tagName, Document * document, bool createdByParser)
51 : HTMLMediaElement(tagName, document, createdByParser) 53 : HTMLMediaElement(tagName, document, createdByParser)
52 { 54 {
53 ASSERT(hasTagName(videoTag)); 55 ASSERT(hasTagName(videoTag));
54 if (document->settings()) 56 if (document->settings())
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 setDisplayMode(Poster); 236 setDisplayMode(Poster);
235 } 237 }
236 238
237 void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, cons t IntRect& destRect) 239 void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, cons t IntRect& destRect)
238 { 240 {
239 MediaPlayer* player = HTMLMediaElement::player(); 241 MediaPlayer* player = HTMLMediaElement::player();
240 if (!player) 242 if (!player)
241 return; 243 return;
242 244
243 player->setVisible(true); // Make player visible or it won't draw. 245 player->setVisible(true); // Make player visible or it won't draw.
246
247 // Go through the fast path trying to do a GPU-GPU texture copy without a re adback to system memory if possible.
248 // Otherwise, it will fallback to the normal SW path.
249 RefPtr<GraphicsContext3D> context3D = SharedGraphicsContext3D::get();
250 if (context3D && player->copyVideoTextureToCanvas(context, context3D.get()))
scherkus (not reviewing) 2013/04/05 20:47:09 this seems strange there are other callers of pai
Ken Russell (switch to Gerrit) 2013/04/05 22:40:38 I'll be more blunt and say that there is no way th
hkuang 2013/04/09 17:46:10 Done.
hkuang 2013/04/09 17:46:10 Fix the naming issue when addressing Ken's comment
251 return;
252
253 // Normal pure SW path
244 player->paintCurrentFrameInContext(context, destRect); 254 player->paintCurrentFrameInContext(context, destRect);
245 } 255 }
246 256
247 bool HTMLVideoElement::copyVideoTextureToPlatformTexture(GraphicsContext3D* cont ext, Platform3DObject texture, GC3Dint level, GC3Denum type, GC3Denum internalFo rmat, bool premultiplyAlpha, bool flipY) 257 bool HTMLVideoElement::copyVideoTextureToPlatformTexture(GraphicsContext3D* cont ext, Platform3DObject texture, GC3Dint level, GC3Denum type, GC3Denum internalFo rmat, bool premultiplyAlpha, bool flipY)
248 { 258 {
249 if (!player()) 259 if (!player())
250 return false; 260 return false;
251 return player()->copyVideoTextureToPlatformTexture(context, texture, level, type, internalFormat, premultiplyAlpha, flipY); 261 return player()->copyVideoTextureToPlatformTexture(context, texture, level, type, internalFormat, premultiplyAlpha, flipY);
252 } 262 }
253 263
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 { 329 {
320 String url = stripLeadingAndTrailingHTMLSpaces(imageSourceURL()); 330 String url = stripLeadingAndTrailingHTMLSpaces(imageSourceURL());
321 if (url.isEmpty()) 331 if (url.isEmpty())
322 return KURL(); 332 return KURL();
323 return document()->completeURL(url); 333 return document()->completeURL(url);
324 } 334 }
325 335
326 } 336 }
327 337
328 #endif 338 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/WebCore/platform/graphics/MediaPlayer.h » ('j') | Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698