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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 12090109: Tab Capture: Backing store readbacks to YV12 VideoFrames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix a verb tense parallelism problem in a comment. Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/renderer_host/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 "RenderWidgetHostImpl::CopyFromBackingStore::FromBackingStore"); 594 "RenderWidgetHostImpl::CopyFromBackingStore::FromBackingStore");
595 gfx::Rect copy_rect = src_subrect.IsEmpty() ? 595 gfx::Rect copy_rect = src_subrect.IsEmpty() ?
596 gfx::Rect(backing_store->size()) : src_subrect; 596 gfx::Rect(backing_store->size()) : src_subrect;
597 // When the result size is equal to the backing store size, copy from the 597 // When the result size is equal to the backing store size, copy from the
598 // backing store directly to the output canvas. 598 // backing store directly to the output canvas.
599 skia::PlatformBitmap output; 599 skia::PlatformBitmap output;
600 bool result = backing_store->CopyFromBackingStore(copy_rect, &output); 600 bool result = backing_store->CopyFromBackingStore(copy_rect, &output);
601 callback.Run(result, output.GetBitmap()); 601 callback.Run(result, output.GetBitmap());
602 } 602 }
603 603
604 bool RenderWidgetHostImpl::CanCopyToVideoFrame() const {
605 #if !defined(OS_WIN)
606 return false;
607 #else
608 return view_ && is_accelerated_compositing_active_;
609 #endif
610 }
611
612 void RenderWidgetHostImpl::CopyFromBackingStoreToVideoFrame(
613 const gfx::Rect& src_subrect,
614 const scoped_refptr<media::VideoFrame>& target,
615 const base::Callback<void(bool)>& callback) {
616 #if defined(OS_WIN)
617 if (view_ && is_accelerated_compositing_active_) {
618 TRACE_EVENT0("browser",
619 "RenderWidgetHostImpl::CopyFromBackingStoreToVideoFrame");
620 gfx::Rect copy_rect = src_subrect.IsEmpty() ?
621 gfx::Rect(view_->GetViewBounds().size()) : src_subrect;
622 view_->CopyFromCompositingSurfaceToVideoFrame(copy_rect,
623 target,
624 callback);
625 return;
626 }
627
628 NOTREACHED() << "CopyFromBackingStoreToVideoFrame() called when not possible";
629 #endif
630 callback.Run(false);
631 }
632
604 #if defined(TOOLKIT_GTK) 633 #if defined(TOOLKIT_GTK)
605 bool RenderWidgetHostImpl::CopyFromBackingStoreToGtkWindow( 634 bool RenderWidgetHostImpl::CopyFromBackingStoreToGtkWindow(
606 const gfx::Rect& dest_rect, GdkWindow* target) { 635 const gfx::Rect& dest_rect, GdkWindow* target) {
607 BackingStore* backing_store = GetBackingStore(false); 636 BackingStore* backing_store = GetBackingStore(false);
608 if (!backing_store) 637 if (!backing_store)
609 return false; 638 return false;
610 (static_cast<BackingStoreGtk*>(backing_store))->PaintToRect( 639 (static_cast<BackingStoreGtk*>(backing_store))->PaintToRect(
611 dest_rect, target); 640 dest_rect, target);
612 return true; 641 return true;
613 } 642 }
(...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after
2386 return; 2415 return;
2387 2416
2388 OnRenderAutoResized(new_size); 2417 OnRenderAutoResized(new_size);
2389 } 2418 }
2390 2419
2391 void RenderWidgetHostImpl::DetachDelegate() { 2420 void RenderWidgetHostImpl::DetachDelegate() {
2392 delegate_ = NULL; 2421 delegate_ = NULL;
2393 } 2422 }
2394 2423
2395 } // namespace content 2424 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698