OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/android/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 bitmap.setInfo(info); | 507 bitmap.setInfo(info); |
508 bitmap.setPixelRef(pixelRef)->unref(); | 508 bitmap.setPixelRef(pixelRef)->unref(); |
509 } | 509 } |
510 | 510 |
511 return true; | 511 return true; |
512 } | 512 } |
513 | 513 |
514 void WebMediaPlayerAndroid::paint(blink::WebCanvas* canvas, | 514 void WebMediaPlayerAndroid::paint(blink::WebCanvas* canvas, |
515 const blink::WebRect& rect, | 515 const blink::WebRect& rect, |
516 unsigned char alpha) { | 516 unsigned char alpha) { |
| 517 paint(canvas, rect, alpha, SkXfermode::kSrcOver_Mode); |
| 518 } |
| 519 |
| 520 void WebMediaPlayerAndroid::paint(blink::WebCanvas* canvas, |
| 521 const blink::WebRect& rect, |
| 522 unsigned char alpha, |
| 523 SkXfermode::Mode mode) { |
517 DCHECK(main_thread_checker_.CalledOnValidThread()); | 524 DCHECK(main_thread_checker_.CalledOnValidThread()); |
518 scoped_ptr<blink::WebGraphicsContext3DProvider> provider = | 525 scoped_ptr<blink::WebGraphicsContext3DProvider> provider = |
519 scoped_ptr<blink::WebGraphicsContext3DProvider>(blink::Platform::current( | 526 scoped_ptr<blink::WebGraphicsContext3DProvider>(blink::Platform::current( |
520 )->createSharedOffscreenGraphicsContext3DProvider()); | 527 )->createSharedOffscreenGraphicsContext3DProvider()); |
521 if (!provider) | 528 if (!provider) |
522 return; | 529 return; |
523 blink::WebGraphicsContext3D* context3D = provider->context3d(); | 530 blink::WebGraphicsContext3D* context3D = provider->context3d(); |
524 if (!context3D || !context3D->makeContextCurrent()) | 531 if (!context3D || !context3D->makeContextCurrent()) |
525 return; | 532 return; |
526 | 533 |
(...skipping 16 matching lines...) Expand all Loading... |
543 } | 550 } |
544 | 551 |
545 // Draw the texture based bitmap onto the Canvas. If the canvas is | 552 // Draw the texture based bitmap onto the Canvas. If the canvas is |
546 // hardware based, this will do a GPU-GPU texture copy. | 553 // hardware based, this will do a GPU-GPU texture copy. |
547 // If the canvas is software based, the texture based bitmap will be | 554 // If the canvas is software based, the texture based bitmap will be |
548 // readbacked to system memory then draw onto the canvas. | 555 // readbacked to system memory then draw onto the canvas. |
549 SkRect dest; | 556 SkRect dest; |
550 dest.set(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height); | 557 dest.set(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height); |
551 SkPaint paint; | 558 SkPaint paint; |
552 paint.setAlpha(alpha); | 559 paint.setAlpha(alpha); |
| 560 paint.setXfermodeMode(mode); |
553 // It is not necessary to pass the dest into the drawBitmap call since all | 561 // It is not necessary to pass the dest into the drawBitmap call since all |
554 // the context have been set up before calling paintCurrentFrameInContext. | 562 // the context have been set up before calling paintCurrentFrameInContext. |
555 canvas->drawBitmapRect(bitmap_, 0, dest, &paint); | 563 canvas->drawBitmapRect(bitmap_, 0, dest, &paint); |
556 } | 564 } |
557 | 565 |
558 bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture( | 566 bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture( |
559 blink::WebGraphicsContext3D* web_graphics_context, | 567 blink::WebGraphicsContext3D* web_graphics_context, |
560 unsigned int texture, | 568 unsigned int texture, |
561 unsigned int level, | 569 unsigned int level, |
562 unsigned int internal_format, | 570 unsigned int internal_format, |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 player_manager_->EnterFullscreen(player_id_, frame_); | 1729 player_manager_->EnterFullscreen(player_id_, frame_); |
1722 SetNeedsEstablishPeer(false); | 1730 SetNeedsEstablishPeer(false); |
1723 } | 1731 } |
1724 } | 1732 } |
1725 | 1733 |
1726 bool WebMediaPlayerAndroid::canEnterFullscreen() const { | 1734 bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
1727 return player_manager_->CanEnterFullscreen(frame_); | 1735 return player_manager_->CanEnterFullscreen(frame_); |
1728 } | 1736 } |
1729 | 1737 |
1730 } // namespace content | 1738 } // namespace content |
OLD | NEW |