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/reflector_impl.h" | 5 #include "content/browser/compositor/reflector_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "content/browser/compositor/browser_compositor_output_surface.h" | 9 #include "content/browser/compositor/browser_compositor_output_surface.h" |
10 #include "content/browser/compositor/owned_mailbox.h" | 10 #include "content/browser/compositor/owned_mailbox.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 y = size.height() - rect.y() - rect.height(); | 163 y = size.height() - rect.y() - rect.height(); |
164 gfx::Rect mirroring_rect(rect.x(), y, rect.width(), rect.height()); | 164 gfx::Rect mirroring_rect(rect.x(), y, rect.width(), rect.height()); |
165 | 165 |
166 // Request redraw of the dirty portion in mirroring compositor. | 166 // Request redraw of the dirty portion in mirroring compositor. |
167 for (LayerData* layer_data : mirroring_layers_) | 167 for (LayerData* layer_data : mirroring_layers_) |
168 UpdateTexture(layer_data, size, mirroring_rect); | 168 UpdateTexture(layer_data, size, mirroring_rect); |
169 composition_count_ = mirroring_layers_.size(); | 169 composition_count_ = mirroring_layers_.size(); |
170 } | 170 } |
171 | 171 |
172 static void ReleaseMailbox(scoped_refptr<OwnedMailbox> mailbox, | 172 static void ReleaseMailbox(scoped_refptr<OwnedMailbox> mailbox, |
173 unsigned int sync_point, | 173 const gpu::SyncToken& sync_token, |
174 bool is_lost) { | 174 bool is_lost) { |
175 mailbox->UpdateSyncPoint(sync_point); | 175 mailbox->UpdateSyncToken(sync_token); |
176 } | 176 } |
177 | 177 |
178 ScopedVector<ReflectorImpl::LayerData>::iterator ReflectorImpl::FindLayerData( | 178 ScopedVector<ReflectorImpl::LayerData>::iterator ReflectorImpl::FindLayerData( |
179 ui::Layer* layer) { | 179 ui::Layer* layer) { |
180 return std::find_if(mirroring_layers_.begin(), mirroring_layers_.end(), | 180 return std::find_if(mirroring_layers_.begin(), mirroring_layers_.end(), |
181 [layer](const LayerData* layer_data) { | 181 [layer](const LayerData* layer_data) { |
182 return layer_data->layer == layer; | 182 return layer_data->layer == layer; |
183 }); | 183 }); |
184 } | 184 } |
185 | 185 |
186 void ReflectorImpl::UpdateTexture(ReflectorImpl::LayerData* layer_data, | 186 void ReflectorImpl::UpdateTexture(ReflectorImpl::LayerData* layer_data, |
187 const gfx::Size& source_size, | 187 const gfx::Size& source_size, |
188 const gfx::Rect& redraw_rect) { | 188 const gfx::Rect& redraw_rect) { |
189 if (layer_data->needs_set_mailbox) { | 189 if (layer_data->needs_set_mailbox) { |
190 layer_data->layer->SetTextureMailbox( | 190 layer_data->layer->SetTextureMailbox( |
191 cc::TextureMailbox(mailbox_->holder()), | 191 cc::TextureMailbox(mailbox_->holder()), |
192 cc::SingleReleaseCallback::Create(base::Bind(ReleaseMailbox, mailbox_)), | 192 cc::SingleReleaseCallback::Create(base::Bind(ReleaseMailbox, mailbox_)), |
193 source_size); | 193 source_size); |
194 layer_data->needs_set_mailbox = false; | 194 layer_data->needs_set_mailbox = false; |
195 } else { | 195 } else { |
196 layer_data->layer->SetTextureSize(source_size); | 196 layer_data->layer->SetTextureSize(source_size); |
197 } | 197 } |
198 layer_data->layer->SetBounds(gfx::Rect(source_size)); | 198 layer_data->layer->SetBounds(gfx::Rect(source_size)); |
199 layer_data->layer->SetTextureFlipped(flip_texture_); | 199 layer_data->layer->SetTextureFlipped(flip_texture_); |
200 layer_data->layer->SchedulePaint(redraw_rect); | 200 layer_data->layer->SchedulePaint(redraw_rect); |
201 } | 201 } |
202 | 202 |
203 } // namespace content | 203 } // namespace content |
OLD | NEW |