| 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 #include "WebDocument.h" | 8 #include "WebDocument.h" |
| 9 #include "WebFrameClient.h" | 9 #include "WebFrameClient.h" |
| 10 #include "WebFrameImpl.h" | 10 #include "WebFrameImpl.h" |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 #endif | 463 #endif |
| 464 WebCanvas* canvas = context->canvas(); | 464 WebCanvas* canvas = context->canvas(); |
| 465 m_webMediaPlayer->paint(canvas, rect, context->getNormalizedAlpha()); | 465 m_webMediaPlayer->paint(canvas, rect, context->getNormalizedAlpha()); |
| 466 } | 466 } |
| 467 } | 467 } |
| 468 | 468 |
| 469 bool WebMediaPlayerClientImpl::copyVideoTextureToPlatformTexture(WebCore::Graphi
csContext3D* context, Platform3DObject texture, GLint level, GLenum type, GLenum
internalFormat, bool premultiplyAlpha, bool flipY) | 469 bool WebMediaPlayerClientImpl::copyVideoTextureToPlatformTexture(WebCore::Graphi
csContext3D* context, Platform3DObject texture, GLint level, GLenum type, GLenum
internalFormat, bool premultiplyAlpha, bool flipY) |
| 470 { | 470 { |
| 471 if (!context || !m_webMediaPlayer) | 471 if (!context || !m_webMediaPlayer) |
| 472 return false; | 472 return false; |
| 473 Extensions3D* extensions = context->extensions(); | 473 if (!context->supportsExtension("GL_CHROMIUM_copy_texture") || !context->sup
portsExtension("GL_CHROMIUM_flipy") |
| 474 if (!extensions || !extensions->supports("GL_CHROMIUM_copy_texture") || !ext
ensions->supports("GL_CHROMIUM_flipy") | 474 || !context->canUseCopyTextureCHROMIUM(internalFormat, type, level) || !
context->makeContextCurrent()) |
| 475 || !extensions->canUseCopyTextureCHROMIUM(internalFormat, type, level) |
| !context->makeContextCurrent()) | |
| 476 return false; | 475 return false; |
| 477 WebGraphicsContext3D* webGraphicsContext3D = context->webContext(); | 476 WebGraphicsContext3D* webGraphicsContext3D = context->webContext(); |
| 478 return m_webMediaPlayer->copyVideoTextureToPlatformTexture(webGraphicsContex
t3D, texture, level, internalFormat, type, premultiplyAlpha, flipY); | 477 return m_webMediaPlayer->copyVideoTextureToPlatformTexture(webGraphicsContex
t3D, texture, level, internalFormat, type, premultiplyAlpha, flipY); |
| 479 } | 478 } |
| 480 | 479 |
| 481 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) | 480 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) |
| 482 { | 481 { |
| 483 m_preload = preload; | 482 m_preload = preload; |
| 484 | 483 |
| 485 if (m_webMediaPlayer) | 484 if (m_webMediaPlayer) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 { | 560 { |
| 562 return adoptPtr(new WebMediaPlayerClientImpl(client)); | 561 return adoptPtr(new WebMediaPlayerClientImpl(client)); |
| 563 } | 562 } |
| 564 | 563 |
| 565 #if OS(ANDROID) | 564 #if OS(ANDROID) |
| 566 void WebMediaPlayerClientImpl::paintOnAndroid(WebCore::GraphicsContext* context,
WebCore::GraphicsContext3D* context3D, const IntRect& rect, uint8_t alpha) | 565 void WebMediaPlayerClientImpl::paintOnAndroid(WebCore::GraphicsContext* context,
WebCore::GraphicsContext3D* context3D, const IntRect& rect, uint8_t alpha) |
| 567 { | 566 { |
| 568 if (!context || !context3D || !m_webMediaPlayer || context->paintingDisabled
()) | 567 if (!context || !context3D || !m_webMediaPlayer || context->paintingDisabled
()) |
| 569 return; | 568 return; |
| 570 | 569 |
| 571 Extensions3D* extensions = context3D->extensions(); | 570 if (!context3D->supportsExtension("GL_CHROMIUM_copy_texture") || !context3D-
>supportsExtension("GL_CHROMIUM_flipy") |
| 572 if (!extensions || !extensions->supports("GL_CHROMIUM_copy_texture") || !ext
ensions->supports("GL_CHROMIUM_flipy") | |
| 573 || !context3D->makeContextCurrent()) | 571 || !context3D->makeContextCurrent()) |
| 574 return; | 572 return; |
| 575 | 573 |
| 576 // Copy video texture into a RGBA texture based bitmap first as video textur
e on Android is GL_TEXTURE_EXTERNAL_OES | 574 // Copy video texture into a RGBA texture based bitmap first as video textur
e on Android is GL_TEXTURE_EXTERNAL_OES |
| 577 // which is not supported by Skia yet. The bitmap's size needs to be the sam
e as the video and use naturalSize() here. | 575 // which is not supported by Skia yet. The bitmap's size needs to be the sam
e as the video and use naturalSize() here. |
| 578 // Check if we could reuse existing texture based bitmap. | 576 // Check if we could reuse existing texture based bitmap. |
| 579 // Otherwise, release existing texture based bitmap and allocate a new one b
ased on video size. | 577 // Otherwise, release existing texture based bitmap and allocate a new one b
ased on video size. |
| 580 if (!ensureTextureBackedSkBitmap(context3D->grContext(), m_bitmap, naturalSi
ze(), kTopLeft_GrSurfaceOrigin, kSkia8888_GrPixelConfig)) | 578 if (!ensureTextureBackedSkBitmap(context3D->grContext(), m_bitmap, naturalSi
ze(), kTopLeft_GrSurfaceOrigin, kSkia8888_GrPixelConfig)) |
| 581 return; | 579 return; |
| 582 | 580 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 | 670 |
| 673 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) | 671 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) |
| 674 { | 672 { |
| 675 if (m_client) | 673 if (m_client) |
| 676 m_client->setFormat(numberOfChannels, sampleRate); | 674 m_client->setFormat(numberOfChannels, sampleRate); |
| 677 } | 675 } |
| 678 | 676 |
| 679 #endif | 677 #endif |
| 680 | 678 |
| 681 } // namespace blink | 679 } // namespace blink |
| OLD | NEW |