Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(785)

Side by Side Diff: content/renderer/media/webmediaplayer_impl.cc

Issue 441303002: 2D Canvas doesn't blend video with the destination buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove redundant SkCanvas::clear on compositor Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 return duration(); 525 return duration();
526 } 526 }
527 527
528 bool WebMediaPlayerImpl::didLoadingProgress() { 528 bool WebMediaPlayerImpl::didLoadingProgress() {
529 DCHECK(main_loop_->BelongsToCurrentThread()); 529 DCHECK(main_loop_->BelongsToCurrentThread());
530 bool pipeline_progress = pipeline_.DidLoadingProgress(); 530 bool pipeline_progress = pipeline_.DidLoadingProgress();
531 bool data_progress = buffered_data_source_host_.DidLoadingProgress(); 531 bool data_progress = buffered_data_source_host_.DidLoadingProgress();
532 return pipeline_progress || data_progress; 532 return pipeline_progress || data_progress;
533 } 533 }
534 534
535 void WebMediaPlayerImpl::paint(WebCanvas* canvas, 535 void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas,
536 const WebRect& rect, 536 const blink::WebRect& rect,
537 unsigned char alpha) { 537 unsigned char alpha) {
538 paint(canvas, rect, alpha, SkXfermode::kSrcOver_Mode);
539 }
540
541 void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas,
542 const blink::WebRect& rect,
543 unsigned char alpha,
544 SkXfermode::Mode mode) {
538 DCHECK(main_loop_->BelongsToCurrentThread()); 545 DCHECK(main_loop_->BelongsToCurrentThread());
539 TRACE_EVENT0("media", "WebMediaPlayerImpl:paint"); 546 TRACE_EVENT0("media", "WebMediaPlayerImpl:paint");
540 547
541 // TODO(scherkus): Clarify paint() API contract to better understand when and 548 // TODO(scherkus): Clarify paint() API contract to better understand when and
542 // why it's being called. For example, today paint() is called when: 549 // why it's being called. For example, today paint() is called when:
543 // - We haven't reached HAVE_CURRENT_DATA and need to paint black 550 // - We haven't reached HAVE_CURRENT_DATA and need to paint black
544 // - We're painting to a canvas 551 // - We're painting to a canvas
545 // See http://crbug.com/341225 http://crbug.com/342621 for details. 552 // See http://crbug.com/341225 http://crbug.com/342621 for details.
546 scoped_refptr<media::VideoFrame> video_frame = 553 scoped_refptr<media::VideoFrame> video_frame =
547 GetCurrentFrameFromCompositor(); 554 GetCurrentFrameFromCompositor();
548 555
549 gfx::Rect gfx_rect(rect); 556 gfx::Rect gfx_rect(rect);
550 skcanvas_video_renderer_.Paint(video_frame.get(), canvas, gfx_rect, alpha); 557 skcanvas_video_renderer_.Paint(
558 video_frame.get(), canvas, gfx_rect, alpha, mode);
551 } 559 }
552 560
553 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const { 561 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const {
554 if (data_source_) 562 if (data_source_)
555 return data_source_->HasSingleOrigin(); 563 return data_source_->HasSingleOrigin();
556 return true; 564 return true;
557 } 565 }
558 566
559 bool WebMediaPlayerImpl::didPassCORSAccessCheck() const { 567 bool WebMediaPlayerImpl::didPassCORSAccessCheck() const {
560 if (data_source_) 568 if (data_source_)
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 compositor_task_runner_->PostTask(FROM_HERE, 1333 compositor_task_runner_->PostTask(FROM_HERE,
1326 base::Bind(&GetCurrentFrameAndSignal, 1334 base::Bind(&GetCurrentFrameAndSignal,
1327 base::Unretained(compositor_), 1335 base::Unretained(compositor_),
1328 &video_frame, 1336 &video_frame,
1329 &event)); 1337 &event));
1330 event.Wait(); 1338 event.Wait();
1331 return video_frame; 1339 return video_frame;
1332 } 1340 }
1333 1341
1334 } // namespace content 1342 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698