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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
136 | 136 |
137 const gfx::Size& dst_size_in_pixel = client_->ConvertViewSizeToPixel( | 137 const gfx::Size& dst_size_in_pixel = client_->ConvertViewSizeToPixel( |
138 dst_size); | 138 dst_size); |
139 scoped_ptr<cc::CopyOutputRequest> request = | 139 scoped_ptr<cc::CopyOutputRequest> request = |
140 cc::CopyOutputRequest::CreateRequest(base::Bind( | 140 cc::CopyOutputRequest::CreateRequest(base::Bind( |
141 &DelegatedFrameHost::CopyFromCompositingSurfaceHasResult, | 141 &DelegatedFrameHost::CopyFromCompositingSurfaceHasResult, |
142 dst_size_in_pixel, | 142 dst_size_in_pixel, |
143 config, | 143 config, |
144 callback)); | 144 callback)); |
145 gfx::Rect src_subrect_in_pixel = | 145 request->set_area(src_subrect); |
146 ConvertRectToPixel(client_->CurrentDeviceScaleFactor(), src_subrect); | |
147 request->set_area(src_subrect_in_pixel); | |
148 client_->RequestCopyOfOutput(request.Pass()); | 146 client_->RequestCopyOfOutput(request.Pass()); |
149 } | 147 } |
150 | 148 |
151 void DelegatedFrameHost::CopyFromCompositingSurfaceToVideoFrame( | 149 void DelegatedFrameHost::CopyFromCompositingSurfaceToVideoFrame( |
152 const gfx::Rect& src_subrect, | 150 const gfx::Rect& src_subrect, |
153 const scoped_refptr<media::VideoFrame>& target, | 151 const scoped_refptr<media::VideoFrame>& target, |
154 const base::Callback<void(bool)>& callback) { | 152 const base::Callback<void(bool)>& callback) { |
155 if (!CanCopyToVideoFrame()) { | 153 if (!CanCopyToVideoFrame()) { |
156 callback.Run(false); | 154 callback.Run(false); |
157 return; | 155 return; |
(...skipping 14 matching lines...) Expand all Loading... |
172 } | 170 } |
173 | 171 |
174 scoped_ptr<cc::CopyOutputRequest> request = | 172 scoped_ptr<cc::CopyOutputRequest> request = |
175 cc::CopyOutputRequest::CreateRequest(base::Bind( | 173 cc::CopyOutputRequest::CreateRequest(base::Bind( |
176 &DelegatedFrameHost:: | 174 &DelegatedFrameHost:: |
177 CopyFromCompositingSurfaceHasResultForVideo, | 175 CopyFromCompositingSurfaceHasResultForVideo, |
178 AsWeakPtr(), // For caching the ReadbackYUVInterface on this class. | 176 AsWeakPtr(), // For caching the ReadbackYUVInterface on this class. |
179 subscriber_texture, | 177 subscriber_texture, |
180 target, | 178 target, |
181 callback)); | 179 callback)); |
182 gfx::Rect src_subrect_in_pixel = | 180 request->set_area(src_subrect); |
183 ConvertRectToPixel(client_->CurrentDeviceScaleFactor(), src_subrect); | |
184 request->set_area(src_subrect_in_pixel); | |
185 if (subscriber_texture.get()) { | 181 if (subscriber_texture.get()) { |
186 request->SetTextureMailbox( | 182 request->SetTextureMailbox( |
187 cc::TextureMailbox(subscriber_texture->mailbox(), | 183 cc::TextureMailbox(subscriber_texture->mailbox(), |
188 subscriber_texture->target(), | 184 subscriber_texture->target(), |
189 subscriber_texture->sync_point())); | 185 subscriber_texture->sync_point())); |
190 } | 186 } |
191 client_->RequestCopyOfOutput(request.Pass()); | 187 client_->RequestCopyOfOutput(request.Pass()); |
192 } | 188 } |
193 | 189 |
194 bool DelegatedFrameHost::CanCopyToBitmap() const { | 190 bool DelegatedFrameHost::CanCopyToBitmap() const { |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 // that should keep our frame. old_layer will be returned to the | 870 // that should keep our frame. old_layer will be returned to the |
875 // RecreateLayer caller, and should have a copy. | 871 // RecreateLayer caller, and should have a copy. |
876 if (frame_provider_.get()) { | 872 if (frame_provider_.get()) { |
877 new_layer->SetShowDelegatedContent(frame_provider_.get(), | 873 new_layer->SetShowDelegatedContent(frame_provider_.get(), |
878 current_frame_size_in_dip_); | 874 current_frame_size_in_dip_); |
879 } | 875 } |
880 } | 876 } |
881 | 877 |
882 } // namespace content | 878 } // namespace content |
883 | 879 |
OLD | NEW |