| OLD | NEW |
| 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_view_win.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
| 6 | 6 |
| 7 #include <InputScope.h> | 7 #include <InputScope.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 | 812 |
| 813 void RenderWidgetHostViewWin::CopyFromCompositingSurface( | 813 void RenderWidgetHostViewWin::CopyFromCompositingSurface( |
| 814 const gfx::Rect& src_subrect, | 814 const gfx::Rect& src_subrect, |
| 815 const gfx::Size& dst_size, | 815 const gfx::Size& dst_size, |
| 816 const base::Callback<void(bool, const SkBitmap&)>& callback) { | 816 const base::Callback<void(bool, const SkBitmap&)>& callback) { |
| 817 base::ScopedClosureRunner scoped_callback_runner( | 817 base::ScopedClosureRunner scoped_callback_runner( |
| 818 base::Bind(callback, false, SkBitmap())); | 818 base::Bind(callback, false, SkBitmap())); |
| 819 if (!accelerated_surface_.get()) | 819 if (!accelerated_surface_.get()) |
| 820 return; | 820 return; |
| 821 | 821 |
| 822 if (dst_size.IsEmpty()) | 822 if (dst_size.IsEmpty() || src_subrect.IsEmpty()) |
| 823 return; | 823 return; |
| 824 | 824 |
| 825 scoped_callback_runner.Release(); | 825 scoped_callback_runner.Release(); |
| 826 accelerated_surface_->AsyncCopyTo( | 826 accelerated_surface_->AsyncCopyTo(src_subrect, dst_size, callback); |
| 827 src_subrect, | 827 } |
| 828 dst_size, | 828 |
| 829 callback); | 829 void RenderWidgetHostViewWin::CopyFromCompositingSurfaceToVideoFrame( |
| 830 const gfx::Rect& src_subrect, |
| 831 const scoped_refptr<media::VideoFrame>& target, |
| 832 const base::Callback<void(bool)>& callback) { |
| 833 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); |
| 834 if (!accelerated_surface_.get()) |
| 835 return; |
| 836 |
| 837 if (!target || target->format() != media::VideoFrame::YV12) |
| 838 return; |
| 839 |
| 840 if (src_subrect.IsEmpty()) |
| 841 return; |
| 842 |
| 843 scoped_callback_runner.Release(); |
| 844 accelerated_surface_->AsyncCopyToVideoFrame(src_subrect, target, callback); |
| 845 } |
| 846 |
| 847 bool RenderWidgetHostViewWin::CanCopyToVideoFrame() const { |
| 848 return accelerated_surface_.get() && render_widget_host_ && |
| 849 render_widget_host_->is_accelerated_compositing_active(); |
| 830 } | 850 } |
| 831 | 851 |
| 832 void RenderWidgetHostViewWin::SetBackground(const SkBitmap& background) { | 852 void RenderWidgetHostViewWin::SetBackground(const SkBitmap& background) { |
| 833 RenderWidgetHostViewBase::SetBackground(background); | 853 RenderWidgetHostViewBase::SetBackground(background); |
| 834 render_widget_host_->SetBackground(background); | 854 render_widget_host_->SetBackground(background); |
| 835 } | 855 } |
| 836 | 856 |
| 837 void RenderWidgetHostViewWin::ProcessAckedTouchEvent( | 857 void RenderWidgetHostViewWin::ProcessAckedTouchEvent( |
| 838 const WebKit::WebTouchEvent& touch, InputEventAckState ack_result) { | 858 const WebKit::WebTouchEvent& touch, InputEventAckState ack_result) { |
| 839 DCHECK(touch_events_enabled_); | 859 DCHECK(touch_events_enabled_); |
| (...skipping 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3067 return new RenderWidgetHostViewWin(widget); | 3087 return new RenderWidgetHostViewWin(widget); |
| 3068 } | 3088 } |
| 3069 | 3089 |
| 3070 // static | 3090 // static |
| 3071 void RenderWidgetHostViewPort::GetDefaultScreenInfo( | 3091 void RenderWidgetHostViewPort::GetDefaultScreenInfo( |
| 3072 WebKit::WebScreenInfo* results) { | 3092 WebKit::WebScreenInfo* results) { |
| 3073 GetScreenInfoForWindow(results, 0); | 3093 GetScreenInfoForWindow(results, 0); |
| 3074 } | 3094 } |
| 3075 | 3095 |
| 3076 } // namespace content | 3096 } // namespace content |
| OLD | NEW |