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