| 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 // which is not supported by Skia yet. The bitmap's size needs to be the sam
e as the video and use naturalSize() here. | 587 // which is not supported by Skia yet. The bitmap's size needs to be the sam
e as the video and use naturalSize() here. |
| 588 // Check if we could reuse existing texture based bitmap. | 588 // Check if we could reuse existing texture based bitmap. |
| 589 // Otherwise, release existing texture based bitmap and allocate a new one b
ased on video size. | 589 // Otherwise, release existing texture based bitmap and allocate a new one b
ased on video size. |
| 590 if (!ensureTextureBackedSkBitmap(context3D->grContext(), m_bitmap, naturalSi
ze(), kTopLeft_GrSurfaceOrigin, kSkia8888_GrPixelConfig)) | 590 if (!ensureTextureBackedSkBitmap(context3D->grContext(), m_bitmap, naturalSi
ze(), kTopLeft_GrSurfaceOrigin, kSkia8888_GrPixelConfig)) |
| 591 return; | 591 return; |
| 592 | 592 |
| 593 // Copy video texture to bitmap texture. | 593 // Copy video texture to bitmap texture. |
| 594 WebGraphicsContext3D* webGraphicsContext3D = context3D->webContext(); | 594 WebGraphicsContext3D* webGraphicsContext3D = context3D->webContext(); |
| 595 WebCanvas* canvas = context->canvas(); | 595 WebCanvas* canvas = context->canvas(); |
| 596 unsigned textureId = static_cast<unsigned>((m_bitmap.getTexture())->getTextu
reHandle()); | 596 unsigned textureId = static_cast<unsigned>((m_bitmap.getTexture())->getTextu
reHandle()); |
| 597 if (!m_webMediaPlayer->copyVideoTextureToPlatformTexture(webGraphicsContext3
D, textureId, 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, true
, false)) | 597 if (!m_webMediaPlayer->copyVideoTextureToPlatformTexture(webGraphicsContext3
D, textureId, 0, GL_RGBA, GL_UNSIGNED_BYTE, true, false)) |
| 598 return; | 598 return; |
| 599 | 599 |
| 600 // Draw the texture based bitmap onto the Canvas. If the canvas is hardware
based, this will do a GPU-GPU texture copy. If the canvas is software based, | 600 // Draw the texture based bitmap onto the Canvas. If the canvas is hardware
based, this will do a GPU-GPU texture copy. If the canvas is software based, |
| 601 // the texture based bitmap will be readbacked to system memory then draw on
to the canvas. | 601 // the texture based bitmap will be readbacked to system memory then draw on
to the canvas. |
| 602 SkRect dest; | 602 SkRect dest; |
| 603 dest.set(rect.x(), rect.y(), rect.x() + rect.width(), rect.y() + rect.height
()); | 603 dest.set(rect.x(), rect.y(), rect.x() + rect.width(), rect.y() + rect.height
()); |
| 604 SkPaint paint; | 604 SkPaint paint; |
| 605 paint.setAlpha(alpha); | 605 paint.setAlpha(alpha); |
| 606 // It is not necessary to pass the dest into the drawBitmap call since all t
he context have been set up before calling paintCurrentFrameInContext. | 606 // It is not necessary to pass the dest into the drawBitmap call since all t
he context have been set up before calling paintCurrentFrameInContext. |
| 607 canvas->drawBitmapRect(m_bitmap, NULL, dest, &paint); | 607 canvas->drawBitmapRect(m_bitmap, NULL, dest, &paint); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 | 681 |
| 682 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) | 682 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) |
| 683 { | 683 { |
| 684 if (m_client) | 684 if (m_client) |
| 685 m_client->setFormat(numberOfChannels, sampleRate); | 685 m_client->setFormat(numberOfChannels, sampleRate); |
| 686 } | 686 } |
| 687 | 687 |
| 688 #endif | 688 #endif |
| 689 | 689 |
| 690 } // namespace blink | 690 } // namespace blink |
| OLD | NEW |