| 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 "TemporaryGlue.h" | 10 #include "TemporaryGlue.h" |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 } | 319 } |
| 320 | 320 |
| 321 void WebMediaPlayerClientImpl::setSize(const IntSize& size) | 321 void WebMediaPlayerClientImpl::setSize(const IntSize& size) |
| 322 { | 322 { |
| 323 if (m_webMediaPlayer.get()) | 323 if (m_webMediaPlayer.get()) |
| 324 m_webMediaPlayer->setSize(WebSize(size.width(), size.height())); | 324 m_webMediaPlayer->setSize(WebSize(size.width(), size.height())); |
| 325 } | 325 } |
| 326 | 326 |
| 327 void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& rect) | 327 void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& rect) |
| 328 { | 328 { |
| 329 if (m_webMediaPlayer.get()) { | 329 // Normally GraphicsContext operations do nothing when painting is disabled. |
| 330 // Since we're accessing platformContext() directly we have to manually |
| 331 // check. |
| 332 if (m_webMediaPlayer.get() && !context->paintingDisabled()) { |
| 330 #if WEBKIT_USING_SKIA | 333 #if WEBKIT_USING_SKIA |
| 331 m_webMediaPlayer->paint(context->platformContext()->canvas(), rect); | 334 m_webMediaPlayer->paint(context->platformContext()->canvas(), rect); |
| 332 #elif WEBKIT_USING_CG | 335 #elif WEBKIT_USING_CG |
| 333 // If there is no preexisting platform canvas, or if the size has | 336 // If there is no preexisting platform canvas, or if the size has |
| 334 // changed, recreate the canvas. This is to avoid recreating the bitmap | 337 // changed, recreate the canvas. This is to avoid recreating the bitmap |
| 335 // buffer over and over for each frame of video. | 338 // buffer over and over for each frame of video. |
| 336 if (!m_webCanvas || | 339 if (!m_webCanvas || |
| 337 m_webCanvas->getDevice()->width() != rect.width() || | 340 m_webCanvas->getDevice()->width() != rect.width() || |
| 338 m_webCanvas->getDevice()->height() != rect.height()) { | 341 m_webCanvas->getDevice()->height() != rect.height()) { |
| 339 m_webCanvas.set(new WebCanvas(rect.width(), rect.height(), true)); | 342 m_webCanvas.set(new WebCanvas(rect.width(), rect.height(), true)); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 } | 429 } |
| 427 | 430 |
| 428 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl() | 431 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl() |
| 429 : m_mediaPlayer(0) | 432 : m_mediaPlayer(0) |
| 430 { | 433 { |
| 431 } | 434 } |
| 432 | 435 |
| 433 } // namespace WebKit | 436 } // namespace WebKit |
| 434 | 437 |
| 435 #endif // ENABLE(VIDEO) | 438 #endif // ENABLE(VIDEO) |
| OLD | NEW |