OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/compositor/delegated_frame_host.h" | 5 #include "content/browser/compositor/delegated_frame_host.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
10 #include "cc/output/compositor_frame_ack.h" | 10 #include "cc/output/compositor_frame_ack.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 131 } |
132 | 132 |
133 const gfx::Size& dst_size_in_pixel = | 133 const gfx::Size& dst_size_in_pixel = |
134 client_->ConvertViewSizeToPixel(dst_size); | 134 client_->ConvertViewSizeToPixel(dst_size); |
135 scoped_ptr<cc::CopyOutputRequest> request = | 135 scoped_ptr<cc::CopyOutputRequest> request = |
136 cc::CopyOutputRequest::CreateRequest(base::Bind( | 136 cc::CopyOutputRequest::CreateRequest(base::Bind( |
137 &DelegatedFrameHost::CopyFromCompositingSurfaceHasResult, | 137 &DelegatedFrameHost::CopyFromCompositingSurfaceHasResult, |
138 dst_size_in_pixel, | 138 dst_size_in_pixel, |
139 config, | 139 config, |
140 callback)); | 140 callback)); |
141 gfx::Rect src_subrect_in_pixel = | 141 request->set_area(src_subrect); |
142 ConvertRectToPixel(client_->CurrentDeviceScaleFactor(), src_subrect); | |
143 request->set_area(src_subrect_in_pixel); | |
144 client_->RequestCopyOfOutput(request.Pass()); | 142 client_->RequestCopyOfOutput(request.Pass()); |
145 } | 143 } |
146 | 144 |
147 void DelegatedFrameHost::CopyFromCompositingSurfaceToVideoFrame( | 145 void DelegatedFrameHost::CopyFromCompositingSurfaceToVideoFrame( |
148 const gfx::Rect& src_subrect, | 146 const gfx::Rect& src_subrect, |
149 const scoped_refptr<media::VideoFrame>& target, | 147 const scoped_refptr<media::VideoFrame>& target, |
150 const base::Callback<void(bool)>& callback) { | 148 const base::Callback<void(bool)>& callback) { |
151 if (!CanCopyToVideoFrame()) { | 149 if (!CanCopyToVideoFrame()) { |
152 callback.Run(false); | 150 callback.Run(false); |
153 return; | 151 return; |
(...skipping 14 matching lines...) Expand all Loading... |
168 } | 166 } |
169 | 167 |
170 scoped_ptr<cc::CopyOutputRequest> request = | 168 scoped_ptr<cc::CopyOutputRequest> request = |
171 cc::CopyOutputRequest::CreateRequest(base::Bind( | 169 cc::CopyOutputRequest::CreateRequest(base::Bind( |
172 &DelegatedFrameHost:: | 170 &DelegatedFrameHost:: |
173 CopyFromCompositingSurfaceHasResultForVideo, | 171 CopyFromCompositingSurfaceHasResultForVideo, |
174 AsWeakPtr(), // For caching the ReadbackYUVInterface on this class. | 172 AsWeakPtr(), // For caching the ReadbackYUVInterface on this class. |
175 subscriber_texture, | 173 subscriber_texture, |
176 target, | 174 target, |
177 callback)); | 175 callback)); |
178 gfx::Rect src_subrect_in_pixel = | 176 request->set_area(src_subrect); |
179 ConvertRectToPixel(client_->CurrentDeviceScaleFactor(), src_subrect); | |
180 request->set_area(src_subrect_in_pixel); | |
181 if (subscriber_texture.get()) { | 177 if (subscriber_texture.get()) { |
182 request->SetTextureMailbox( | 178 request->SetTextureMailbox( |
183 cc::TextureMailbox(subscriber_texture->mailbox(), | 179 cc::TextureMailbox(subscriber_texture->mailbox(), |
184 subscriber_texture->target(), | 180 subscriber_texture->target(), |
185 subscriber_texture->sync_point())); | 181 subscriber_texture->sync_point())); |
186 } | 182 } |
187 client_->RequestCopyOfOutput(request.Pass()); | 183 client_->RequestCopyOfOutput(request.Pass()); |
188 } | 184 } |
189 | 185 |
190 bool DelegatedFrameHost::CanCopyToBitmap() const { | 186 bool DelegatedFrameHost::CanCopyToBitmap() const { |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 // that should keep our frame. old_layer will be returned to the | 854 // that should keep our frame. old_layer will be returned to the |
859 // RecreateLayer caller, and should have a copy. | 855 // RecreateLayer caller, and should have a copy. |
860 if (frame_provider_.get()) { | 856 if (frame_provider_.get()) { |
861 new_layer->SetShowDelegatedContent(frame_provider_.get(), | 857 new_layer->SetShowDelegatedContent(frame_provider_.get(), |
862 current_frame_size_in_dip_); | 858 current_frame_size_in_dip_); |
863 } | 859 } |
864 } | 860 } |
865 | 861 |
866 } // namespace content | 862 } // namespace content |
867 | 863 |
OLD | NEW |