OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "config.h" | 5 #include "config.h" |
6 #include "WebMediaPlayerClientImpl.h" | 6 #include "WebMediaPlayerClientImpl.h" |
7 | 7 |
8 #if ENABLE(VIDEO) | 8 #if ENABLE(VIDEO) |
9 | 9 |
10 #include "Frame.h" | 10 #include "Frame.h" |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 } | 390 } |
391 | 391 |
392 void WebMediaPlayerClientImpl::setSize(const IntSize& size) | 392 void WebMediaPlayerClientImpl::setSize(const IntSize& size) |
393 { | 393 { |
394 if (m_webMediaPlayer.get()) | 394 if (m_webMediaPlayer.get()) |
395 m_webMediaPlayer->setSize(WebSize(size.width(), size.height())); | 395 m_webMediaPlayer->setSize(WebSize(size.width(), size.height())); |
396 } | 396 } |
397 | 397 |
398 void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re
ct) | 398 void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re
ct) |
399 { | 399 { |
| 400 #if USE(ACCELERATED_COMPOSITING) |
| 401 // If we are using GPU to render video, ignore requests to paint frames into |
| 402 // canvas because it will be taken care of by VideoLayerChromium. |
| 403 if (acceleratedRenderingInUse()) |
| 404 return; |
| 405 #endif |
| 406 paintCurrentFrameInContext(context, rect); |
| 407 } |
| 408 |
| 409 void WebMediaPlayerClientImpl::paintCurrentFrameInContext(GraphicsContext* conte
xt, const IntRect& rect) |
| 410 { |
400 // Normally GraphicsContext operations do nothing when painting is disabled. | 411 // Normally GraphicsContext operations do nothing when painting is disabled. |
401 // Since we're accessing platformContext() directly we have to manually | 412 // Since we're accessing platformContext() directly we have to manually |
402 // check. | 413 // check. |
403 if (m_webMediaPlayer.get() && !context->paintingDisabled()) { | 414 if (m_webMediaPlayer.get() && !context->paintingDisabled()) { |
404 #if WEBKIT_USING_SKIA | 415 #if WEBKIT_USING_SKIA |
405 PlatformGraphicsContext* platformContext = context->platformContext(); | 416 PlatformGraphicsContext* platformContext = context->platformContext(); |
406 WebCanvas* canvas = platformContext->canvas(); | 417 WebCanvas* canvas = platformContext->canvas(); |
407 | 418 |
408 canvas->saveLayerAlpha(0, platformContext->getNormalizedAlpha()); | 419 canvas->saveLayerAlpha(0, platformContext->getNormalizedAlpha()); |
409 | 420 |
(...skipping 28 matching lines...) Expand all Loading... |
438 m_webMediaPlayer->movieLoadType()); | 449 m_webMediaPlayer->movieLoadType()); |
439 return MediaPlayer::Unknown; | 450 return MediaPlayer::Unknown; |
440 } | 451 } |
441 | 452 |
442 #if USE(ACCELERATED_COMPOSITING) | 453 #if USE(ACCELERATED_COMPOSITING) |
443 bool WebMediaPlayerClientImpl::supportsAcceleratedRendering() const | 454 bool WebMediaPlayerClientImpl::supportsAcceleratedRendering() const |
444 { | 455 { |
445 return m_supportsAcceleratedCompositing; | 456 return m_supportsAcceleratedCompositing; |
446 } | 457 } |
447 | 458 |
| 459 bool WebMediaPlayerClientImpl::acceleratedRenderingInUse() |
| 460 { |
| 461 return m_videoLayer.get() && m_videoLayer->layerRenderer(); |
| 462 } |
| 463 |
448 VideoFrameChromium* WebMediaPlayerClientImpl::getCurrentFrame() | 464 VideoFrameChromium* WebMediaPlayerClientImpl::getCurrentFrame() |
449 { | 465 { |
450 VideoFrameChromium* videoFrame = 0; | 466 VideoFrameChromium* videoFrame = 0; |
451 if (m_webMediaPlayer.get()) { | 467 if (m_webMediaPlayer.get()) { |
452 WebVideoFrame* webkitVideoFrame = m_webMediaPlayer->getCurrentFrame(); | 468 WebVideoFrame* webkitVideoFrame = m_webMediaPlayer->getCurrentFrame(); |
453 if (webkitVideoFrame) | 469 if (webkitVideoFrame) |
454 videoFrame = new VideoFrameChromiumImpl(webkitVideoFrame); | 470 videoFrame = new VideoFrameChromiumImpl(webkitVideoFrame); |
455 } | 471 } |
456 return videoFrame; | 472 return videoFrame; |
457 } | 473 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 #if USE(ACCELERATED_COMPOSITING) | 534 #if USE(ACCELERATED_COMPOSITING) |
519 , m_videoLayer(0) | 535 , m_videoLayer(0) |
520 , m_supportsAcceleratedCompositing(false) | 536 , m_supportsAcceleratedCompositing(false) |
521 #endif | 537 #endif |
522 { | 538 { |
523 } | 539 } |
524 | 540 |
525 } // namespace WebKit | 541 } // namespace WebKit |
526 | 542 |
527 #endif // ENABLE(VIDEO) | 543 #endif // ENABLE(VIDEO) |
OLD | NEW |