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/webmediaplayer_impl.h" | 5 #include "content/renderer/media/webmediaplayer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 return duration(); | 529 return duration(); |
530 } | 530 } |
531 | 531 |
532 bool WebMediaPlayerImpl::didLoadingProgress() { | 532 bool WebMediaPlayerImpl::didLoadingProgress() { |
533 DCHECK(main_loop_->BelongsToCurrentThread()); | 533 DCHECK(main_loop_->BelongsToCurrentThread()); |
534 bool pipeline_progress = pipeline_.DidLoadingProgress(); | 534 bool pipeline_progress = pipeline_.DidLoadingProgress(); |
535 bool data_progress = buffered_data_source_host_.DidLoadingProgress(); | 535 bool data_progress = buffered_data_source_host_.DidLoadingProgress(); |
536 return pipeline_progress || data_progress; | 536 return pipeline_progress || data_progress; |
537 } | 537 } |
538 | 538 |
539 void WebMediaPlayerImpl::paint(WebCanvas* canvas, | 539 void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas, |
540 const WebRect& rect, | 540 const blink::WebRect& rect, |
541 unsigned char alpha) { | 541 unsigned char alpha) { |
| 542 paint(canvas, rect, alpha, SkXfermode::kSrcOver_Mode); |
| 543 } |
| 544 |
| 545 void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas, |
| 546 const blink::WebRect& rect, |
| 547 unsigned char alpha, |
| 548 SkXfermode::Mode mode) { |
542 DCHECK(main_loop_->BelongsToCurrentThread()); | 549 DCHECK(main_loop_->BelongsToCurrentThread()); |
543 TRACE_EVENT0("media", "WebMediaPlayerImpl:paint"); | 550 TRACE_EVENT0("media", "WebMediaPlayerImpl:paint"); |
544 | 551 |
545 // TODO(scherkus): Clarify paint() API contract to better understand when and | 552 // TODO(scherkus): Clarify paint() API contract to better understand when and |
546 // why it's being called. For example, today paint() is called when: | 553 // why it's being called. For example, today paint() is called when: |
547 // - We haven't reached HAVE_CURRENT_DATA and need to paint black | 554 // - We haven't reached HAVE_CURRENT_DATA and need to paint black |
548 // - We're painting to a canvas | 555 // - We're painting to a canvas |
549 // See http://crbug.com/341225 http://crbug.com/342621 for details. | 556 // See http://crbug.com/341225 http://crbug.com/342621 for details. |
550 scoped_refptr<media::VideoFrame> video_frame = | 557 scoped_refptr<media::VideoFrame> video_frame = |
551 GetCurrentFrameFromCompositor(); | 558 GetCurrentFrameFromCompositor(); |
552 | 559 |
553 gfx::Rect gfx_rect(rect); | 560 gfx::Rect gfx_rect(rect); |
554 | 561 |
555 skcanvas_video_renderer_.Paint(video_frame.get(), | 562 skcanvas_video_renderer_.Paint(video_frame.get(), |
556 canvas, | 563 canvas, |
557 gfx_rect, | 564 gfx_rect, |
558 alpha, | 565 alpha, |
| 566 mode, |
559 pipeline_metadata_.video_rotation); | 567 pipeline_metadata_.video_rotation); |
560 } | 568 } |
561 | 569 |
562 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const { | 570 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const { |
563 if (data_source_) | 571 if (data_source_) |
564 return data_source_->HasSingleOrigin(); | 572 return data_source_->HasSingleOrigin(); |
565 return true; | 573 return true; |
566 } | 574 } |
567 | 575 |
568 bool WebMediaPlayerImpl::didPassCORSAccessCheck() const { | 576 bool WebMediaPlayerImpl::didPassCORSAccessCheck() const { |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 compositor_task_runner_->PostTask(FROM_HERE, | 1406 compositor_task_runner_->PostTask(FROM_HERE, |
1399 base::Bind(&GetCurrentFrameAndSignal, | 1407 base::Bind(&GetCurrentFrameAndSignal, |
1400 base::Unretained(compositor_), | 1408 base::Unretained(compositor_), |
1401 &video_frame, | 1409 &video_frame, |
1402 &event)); | 1410 &event)); |
1403 event.Wait(); | 1411 event.Wait(); |
1404 return video_frame; | 1412 return video_frame; |
1405 } | 1413 } |
1406 | 1414 |
1407 } // namespace content | 1415 } // namespace content |
OLD | NEW |